Documentation ¶
Overview ¶
Package mat4 contains a 4x4 float64 matrix type T and functions.
Index ¶
- Variables
- type T
- func (mat *T) Array() *[16]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) AssignMat3x3(m *mat3.T) *T
- func (mat *T) AssignMul(a, b *T) *T
- func (mat *T) AssignOrthogonalProjection(left, right, bottom, top, znear, zfar float64) *T
- func (mat *T) AssignPerspectiveProjection(left, right, bottom, top, znear, zfar float64) *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) Determinant3x3() float64
- func (mat *T) ExtractEulerAngles() (yHead, xPitch, zRoll float64)
- func (mat *T) Get(col, row int) float64
- func (mat *T) IsReflective() bool
- func (mat *T) IsZero() bool
- func (mat *T) MulVec3(v *vec3.T) vec3.T
- func (mat *T) MulVec3W(v *vec3.T, w float64) vec3.T
- func (mat *T) MulVec4(v *vec4.T) vec4.T
- func (mat *T) Quaternion() quaternion.T
- func (mat *T) Rows() int
- func (mat *T) Scale(f float64) *T
- func (mat *T) ScaleVec3(s *vec3.T) *T
- func (mat *T) Scaled(f float64) T
- func (mat *T) Scaling() vec4.T
- func (mat *T) SetScaling(s *vec4.T) *T
- func (mat *T) SetTranslation(v *vec3.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) Trace3() float64
- func (mat *T) TransformVec3(v *vec3.T)
- func (mat *T) TransformVec3W(v *vec3.T, w float64)
- func (mat *T) TransformVec4(v *vec4.T)
- func (mat *T) Translate(v *vec3.T) *T
- func (mat *T) TranslateX(dx float64) *T
- func (mat *T) TranslateY(dy float64) *T
- func (mat *T) TranslateZ(dz float64) *T
- func (mat *T) Transpose() *T
- func (mat *T) Transpose3x3() *T
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type T ¶
T represents a 4x4 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) AssignMat3x3 ¶
AssignMat3x3 assigns a 3x3 sub-matrix and sets the rest of the matrix to the ident value.
func (*T) AssignOrthogonalProjection ¶
AssignOrthogonalProjection assigns an orthogonal projection transformation.
func (*T) AssignPerspectiveProjection ¶
AssignPerspectiveProjection assigns a perspective projection transformation.
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) Determinant3x3 ¶
Determinant3x3 returns the determinant of the 3x3 sub-matrix.
func (*T) ExtractEulerAngles ¶
ExtractEulerAngles extracts the rotation part of the matrix as Euler angle rotation values.
func (*T) IsReflective ¶
IsReflective returns true if the matrix can be reflected by a plane.
func (*T) MulVec3 ¶
MulVec3 multiplies v (converted to a vec4 as (v_1, v_2, v_3, 1)) with mat and divides the result by w. Returns a new vec3.
func (*T) MulVec3W ¶
MulVec3W multiplies v with mat with w as fourth component of the vector. Useful to differentiate between vectors (w = 0) and points (w = 1) without transforming them to vec4.
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 translation elements of the matrix.
func (*T) TransformVec3 ¶
TransformVec3 multiplies v (converted to a vec4 as (v_1, v_2, v_3, 1)) with mat, divides the result by w and saves the result in v.
func (*T) TransformVec3W ¶
TransformVec3W multiplies v with mat with w as fourth component of the vector and saves the result in v. Useful to differentiate between vectors (w = 0) and points (w = 1) without transforming them to vec4.
func (*T) TransformVec4 ¶
MulVec4 multiplies v with mat and saves the result in v.
func (*T) TranslateX ¶
TranslateX adds dx to the X-translation element of the matrix.
func (*T) TranslateY ¶
TranslateY adds dy to the Y-translation element of the matrix.
func (*T) TranslateZ ¶
TranslateZ adds dz to the Z-translation element of the matrix.
func (*T) Transpose3x3 ¶
Transpose3x3 transposes the 3x3 sub-matrix.