Documentation ¶
Overview ¶
Package mat3 contains a 3x3 float64 matrix type T and functions.
Index ¶
- Variables
- type T
- func (matrix *T) Adjugate() *T
- func (mat *T) Adjugated() T
- func (mat *T) Array() *[9]float64
- func (mat *T) AssignCoordinateSystem(x, y, z *vec3.T) *T
- func (mat *T) AssignEulerRotation(yHead, xPitch, zRoll float64) *T
- func (mat *T) AssignMat2x2(m *mat2.T) *T
- func (mat *T) AssignMul(a, b *T) *T
- func (mat *T) AssignQuaternion(q *quaternion.T) *T
- func (mat *T) AssignXRotation(angle float64) *T
- func (mat *T) AssignYRotation(angle float64) *T
- func (mat *T) AssignZRotation(angle float64) *T
- func (mat *T) Cols() int
- func (mat *T) Determinant() float64
- func (mat *T) ExtractEulerAngles() (yHead, xPitch, zRoll float64)
- func (mat *T) Get(col, row int) float64
- func (mat *T) Invert() (*T, error)
- func (mat *T) Inverted() (T, error)
- func (mat *T) IsReflective() bool
- func (mat *T) IsZero() bool
- func (mat *T) Mul(f float64) *T
- func (mat *T) MulVec3(v *vec3.T) vec3.T
- func (mat *T) Muled(f float64) T
- func (mat *T) PracticallyEquals(matrix *T, allowedDelta float64) bool
- func (mat *T) Quaternion() quaternion.T
- func (mat *T) Rows() int
- func (mat *T) Scale(f float64) *T
- func (mat *T) ScaleVec2(s *vec2.T) *T
- func (mat *T) Scaled(f float64) T
- func (mat *T) Scaling() vec3.T
- func (mat *T) SetScaling(s *vec3.T) *T
- func (mat *T) SetTranslation(v *vec2.T) *T
- func (mat *T) Size() int
- func (mat *T) Slice() []float64
- func (mat *T) String() string
- func (mat *T) Trace() float64
- func (mat *T) TransformVec3(v *vec3.T)
- func (mat *T) Translate(v *vec2.T) *T
- func (mat *T) TranslateX(dx float64) *T
- func (mat *T) TranslateY(dy float64) *T
- func (mat *T) Transpose() *T
- func (mat *T) Transposed() T
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type T ¶
T represents a 3x3 matrix.
func (*T) Array ¶
Array returns the elements of the matrix as array pointer. The data may be a copy depending on the platform implementation.
func (*T) AssignCoordinateSystem ¶
AssignCoordinateSystem assigns the rotation of a orthogonal coordinates system to the rotation part of the matrix and sets the remaining elements to their ident value.
func (*T) AssignEulerRotation ¶
AssignEulerRotation assigns Euler angle rotations to the rotation part of the matrix and sets the remaining elements to their ident value.
func (*T) AssignMat2x2 ¶
AssignMat2x2 assigns a 2x2 sub-matrix and sets the rest of the matrix to the ident value.
func (*T) AssignQuaternion ¶
func (mat *T) AssignQuaternion(q *quaternion.T) *T
AssignQuaternion assigns a quaternion to the rotations part of the matrix and sets the other elements to their ident value.
func (*T) AssignXRotation ¶
AssignXRotation assigns a rotation around the x axis to the rotation part of the matrix and sets the remaining elements to their ident value.
func (*T) AssignYRotation ¶
AssignYRotation assigns a rotation around the y axis to the rotation part of the matrix and sets the remaining elements to their ident value.
func (*T) AssignZRotation ¶
AssignZRotation assigns a rotation around the z axis to the rotation part of the matrix and sets the remaining elements to their ident value.
func (*T) Determinant ¶
Determinant returns the determinant of the matrix.
func (*T) ExtractEulerAngles ¶
ExtractEulerAngles extracts the rotation part of the matrix as Euler angle rotation values.
func (*T) Get ¶
Get returns one element of the matrix. Matrices are defined by (three) column vectors.
Note that this function use the opposite reference order of rows and columns to the mathematical matrix indexing.
A value in this matrix is referenced by <col><row> where both row and column is in the range [0..2]. This notation and range reflects the underlying representation.
A value in a matrix A is mathematically referenced by A<row><col> where both row and column is in the range [1..3]. (It is really the lower case 'a' followed by <row><col> but this documentation syntax is somewhat limited.)
matrixA.Get(1, 2) == matrixA[1][2] ( == A32 in mathematical indexing)
func (*T) Invert ¶
Invert inverts the given matrix. Destructive operation. Does not check if matrix is singular and may lead to strange results!
func (*T) Inverted ¶
Inverted inverts a copy of the given matrix. Does not check if matrix is singular and may lead to strange results!
func (*T) IsReflective ¶
IsReflective returns true if the matrix can be reflected by a plane.
func (*T) PracticallyEquals ¶
PracticallyEquals compares two matrices if they are equal with each other within a delta tolerance.
func (*T) Quaternion ¶
func (mat *T) Quaternion() quaternion.T
Quaternion extracts a quaternion from the rotation part of the matrix.
func (*T) Scaled ¶
Scaled returns a copy of the matrix with the diagonal scale elements multiplied by f.
func (*T) SetScaling ¶
SetScaling sets the scaling diagonal of the matrix.
func (*T) SetTranslation ¶
SetTranslation sets the 2D translation elements of the matrix.
func (*T) TransformVec3 ¶
TransformVec3 multiplies v with mat and saves the result in v.
func (*T) TranslateX ¶
TranslateX adds dx to the 2D X-translation element of the matrix.
func (*T) TranslateY ¶
TranslateY adds dy to the 2D Y-translation element of the matrix.
func (*T) Transposed ¶
Transposed returns a transposed copy the matrix.