ebiten/graphics/geometry_matrix.go

68 lines
1.4 KiB
Go
Raw Normal View History

2013-06-15 10:07:14 +02:00
package graphics
type GeometryMatrix struct {
AffineMatrix
}
const geometryMatrixDimension = 3
func NewGeometryMatrix() *GeometryMatrix {
return &GeometryMatrix{*NewAffineMatrix(geometryMatrixDimension)}
}
func IdentityGeometryMatrix() *GeometryMatrix {
return &GeometryMatrix{*IdentityAffineMatrix(geometryMatrixDimension)}
}
func (matrix *GeometryMatrix) Clone() *GeometryMatrix {
return &GeometryMatrix{*(matrix.AffineMatrix.Clone())}
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) A() float64 {
2013-06-15 10:07:14 +02:00
return matrix.Element(0, 0)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) B() float64 {
2013-06-15 10:07:14 +02:00
return matrix.Element(0, 1)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) C() float64 {
2013-06-15 10:07:14 +02:00
return matrix.Element(1, 0)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) D() float64 {
2013-06-15 10:07:14 +02:00
return matrix.Element(1, 1)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) Tx() float64 {
2013-06-15 10:07:14 +02:00
return matrix.Element(0, 2)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) Ty() float64 {
2013-06-15 10:07:14 +02:00
return matrix.Element(1, 2)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) SetA(a float64) {
2013-06-15 10:07:14 +02:00
matrix.SetElement(0, 0, a)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) SetB(b float64) {
2013-06-15 10:07:14 +02:00
matrix.SetElement(0, 1, b)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) SetC(c float64) {
2013-06-15 10:07:14 +02:00
matrix.SetElement(1, 0, c)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) SetD(d float64) {
2013-06-15 10:07:14 +02:00
matrix.SetElement(1, 1, d)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) SetTx(tx float64) {
2013-06-15 10:07:14 +02:00
matrix.SetElement(0, 2, tx)
}
2013-06-19 02:29:17 +02:00
func (matrix *GeometryMatrix) SetTy(ty float64) {
2013-06-15 10:07:14 +02:00
matrix.SetElement(1, 2, ty)
}