Documentation
¶
Index ¶
- Variables
- type Matrix
- func (m Matrix) Determinant() float64
- func (l Matrix) Equal(r Matrix) bool
- func (m Matrix) Invert() (inv Matrix, ok bool)
- func (l Matrix) Mul(r Matrix) Matrix
- func (m Matrix) RotateX(theta float64) Matrix
- func (m Matrix) RotateY(theta float64) Matrix
- func (m Matrix) RotateZ(theta float64) Matrix
- func (m Matrix) Scale(sx, sy, sz float64) Matrix
- func (m Matrix) Transform(vx, vy, vz, vw float64) (x, y, z, w float64)
- func (m Matrix) Transform3(vx, vy, vz float64) (x, y, z float64)
- func (m Matrix) Translate(tx, ty, tz float64) Matrix
- func (m Matrix) Transpose() (t Matrix)
Constants ¶
This section is empty.
Variables ¶
var Identity = Matrix{
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
{0, 0, 0, 1},
}
Identity is a matrix that does a 1:1 scale, no rotation and no translation.
Functions ¶
This section is empty.
Types ¶
type Matrix ¶
type Matrix [4][4]float64
Matrix is a 4x4 homogeneous matrix used to transform an object's points from 'Object Space' to 'Parent Space'. When broken into scale, rotation, and translation components, it is best constructed in the order T * R * S, where transformations are applied from right to left. The object is scaled first, then rotated around its origin in 'Object Space', and finally translated in 'Parent Space' to its final position. This sequence is largely a matter of choice, but it is often considered the most intuitive.
func (Matrix) Determinant ¶
func (Matrix) RotateX ¶
RotateX applies a rotation about the X axis. `theta` is measured in Radians.
func (Matrix) RotateY ¶
RotateY applies a rotation about the Y axis. `theta` is measured in Radians.
func (Matrix) RotateZ ¶
RotateZ applies a rotation about the Z axis. `theta` is measured in Radians.
func (Matrix) Transform3 ¶
Transform a vector. Uses 9 multiplications and 9 additions.