mat

package
v0.0.0-...-e6cdf45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 2 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type Matrix ¶

type Matrix [][]float32

func New ¶

func New(rows, cols int, arr ...float32) Matrix

func (Matrix) Add ¶

func (m Matrix) Add(m1 Matrix) Matrix

func (Matrix) Clone ¶

func (m Matrix) Clone() Matrix

func (Matrix) Col ¶

func (m Matrix) Col(col int, v vec.Vector) vec.Vector

Returns a copy of the matrix column.

func (Matrix) Det ¶

func (m Matrix) Det() float32

Determinant only valid for square matrix Undefined behavior for non square matrices

func (Matrix) Diagonal ¶

func (m Matrix) Diagonal(dst vec.Vector) vec.Vector

Size of the destination vector must equal to number of rows

func (Matrix) DivC ¶

func (m Matrix) DivC(c float32) Matrix

func (Matrix) Eye ¶

func (m Matrix) Eye() Matrix

Fills destination matrix with identity matrix.

func (Matrix) Flat ¶

func (m Matrix) Flat(v vec.Vector) vec.Vector

Returns a flat representation of this matrix.

func (Matrix) LU ¶

func (m Matrix) LU(L, U Matrix)

LU decomposition into two triangular matrices NOTE: Assume, that l&u matrices are set to zero Matrix must be square and M, L and U matrix sizes must be equal

func (Matrix) Matrix ¶

func (m Matrix) Matrix() Matrix

Returns a Matrix view of this matrix. The view actually contains slices of original matrix rows. This way original matrix can be modified.

func (Matrix) Mul ¶

func (m Matrix) Mul(a Matrix, b Matrix) Matrix

Destination matrix must be properly sized. given that a is MxN and b is NxK then destinatiom matrix must be MxK

func (Matrix) MulC ¶

func (m Matrix) MulC(c float32) Matrix

func (Matrix) MulDiag ¶

func (m Matrix) MulDiag(a Matrix, b vec.Vector) Matrix

Only makes sense for square matrices. Vector size must be equal to number of rows/cols

func (Matrix) MulVec ¶

func (m Matrix) MulVec(v vec.Vector, dst vec.Vector) vec.Vector

Vector must have a size equal to number of cols. Destination vector must have a size equal to number of rows.

func (Matrix) MulVecT ¶

func (m Matrix) MulVecT(v vec.Vector, dst vec.Vector) vec.Vector

Vector must have a size equal to number of rows. Destination vector must have a size equal to number of cols.

func (Matrix) Orientation ¶

func (m Matrix) Orientation(q vec.Quaternion) Matrix

Build orientation matrix from quaternion Matrix size must be at least 3x3 Quaternion axis must be unit vector

func (Matrix) Rotation2D ¶

func (m Matrix) Rotation2D(a float32) Matrix

Fills destination matrix with a 2D rotation Matrix size must be at least 2x2

func (Matrix) RotationX ¶

func (m Matrix) RotationX(a float32) Matrix

Fills destination matrix with a rotation around X axis Matrix size must be at least 3x3

func (Matrix) RotationY ¶

func (m Matrix) RotationY(a float32) Matrix

Fills destination matrix with a rotation around Y axis Matrix size must be at least 3x3

func (Matrix) RotationZ ¶

func (m Matrix) RotationZ(a float32) Matrix

Fills destination matrix with a rotation around Z axis Matrix size must be at least 3x3

func (Matrix) Row ¶

func (m Matrix) Row(row int) vec.Vector

Returns a slice to the row.

func (Matrix) SetCol ¶

func (m Matrix) SetCol(col int, v vec.Vector) Matrix

func (Matrix) SetDiagonal ¶

func (m Matrix) SetDiagonal(v vec.Vector) Matrix

Size of the vector must equal to number of rows

func (Matrix) SetRow ¶

func (m Matrix) SetRow(row int, v vec.Vector) Matrix

func (Matrix) SetSubmatrix ¶

func (m Matrix) SetSubmatrix(row, col int, m1 Matrix) Matrix

func (Matrix) SetSubmatrixRaw ¶

func (m Matrix) SetSubmatrixRaw(row, col, rows1, cols1 int, m1 ...float32) Matrix

func (Matrix) Sub ¶

func (m Matrix) Sub(m1 Matrix) Matrix

func (Matrix) Submatrix ¶

func (m Matrix) Submatrix(row, col int, m1 Matrix) Matrix

func (Matrix) Transpose ¶

func (m Matrix) Transpose(m1 Matrix) Matrix

Transposes matrix m1 and stores the result in the destination matrix destination matrix must be of appropriate size. NOTE: Does not support in place transpose

type Matrix2x2 ¶

type Matrix2x2 [2][2]float32

func New2x2 ¶

func New2x2(arr ...float32) Matrix2x2

func (*Matrix2x2) Add ¶

func (m *Matrix2x2) Add(m1 Matrix2x2) *Matrix2x2

func (*Matrix2x2) Clone ¶

func (m *Matrix2x2) Clone() *Matrix2x2

func (*Matrix2x2) Col ¶

func (m *Matrix2x2) Col(col int, v vec.Vector) vec.Vector

Returns a copy of the matrix column.

func (*Matrix2x2) Det ¶

func (m *Matrix2x2) Det() float32

Determinant only valid for square matrix Undefined behavior for non square matrices

func (*Matrix2x2) Diagonal ¶

func (m *Matrix2x2) Diagonal(dst vec.Vector) vec.Vector

Size of the destination vector must equal to number of rows

func (*Matrix2x2) DivC ¶

func (m *Matrix2x2) DivC(c float32) *Matrix2x2

func (*Matrix2x2) Eye ¶

func (m *Matrix2x2) Eye() *Matrix2x2

Fills destination matrix with identity matrix.

func (*Matrix2x2) Flat ¶

func (m *Matrix2x2) Flat(v vec.Vector) vec.Vector

Returns a flat representation of this matrix.

func (*Matrix2x2) LU ¶

func (m *Matrix2x2) LU(L, U *Matrix2x2)

LU decomposition into two triangular matrices NOTE: Assume, that l&u matrices are set to zero Matrix must be square and M, L and U matrix sizes must be equal

func (*Matrix2x2) Matrix ¶

func (m *Matrix2x2) Matrix() Matrix

Returns a Matrix view of this matrix. The view actually contains slices of original matrix rows. This way original matrix can be modified.

func (*Matrix2x2) Mul ¶

func (m *Matrix2x2) Mul(a Matrix2x2, b Matrix2x2) *Matrix2x2

Destination matrix must be properly sized. given that a is MxN and b is NxK then destinatiom matrix must be MxK

func (*Matrix2x2) MulC ¶

func (m *Matrix2x2) MulC(c float32) *Matrix2x2

func (*Matrix2x2) MulDiag ¶

func (m *Matrix2x2) MulDiag(a Matrix2x2, b vec.Vector2D) *Matrix2x2

Only makes sense for square matrices. Vector size must be equal to number of rows/cols

func (*Matrix2x2) MulVec ¶

func (m *Matrix2x2) MulVec(v vec.Vector2D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of cols. Destination vector must have a size equal to number of rows.

func (*Matrix2x2) MulVecT ¶

func (m *Matrix2x2) MulVecT(v vec.Vector2D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of rows. Destination vector must have a size equal to number of cols.

func (*Matrix2x2) Rotation2D ¶

func (m *Matrix2x2) Rotation2D(a float32) *Matrix2x2

Fills destination matrix with a 2D rotation Matrix size must be at least 2x2

func (*Matrix2x2) Row ¶

func (m *Matrix2x2) Row(row int) vec.Vector

Returns a slice to the row.

func (*Matrix2x2) SetCol ¶

func (m *Matrix2x2) SetCol(col int, v vec.Vector) *Matrix2x2

func (*Matrix2x2) SetDiagonal ¶

func (m *Matrix2x2) SetDiagonal(v vec.Vector2D) *Matrix2x2

Size of the vector must equal to number of rows

func (*Matrix2x2) SetRow ¶

func (m *Matrix2x2) SetRow(row int, v vec.Vector) *Matrix2x2

func (*Matrix2x2) SetSubmatrix ¶

func (m *Matrix2x2) SetSubmatrix(row, col int, m1 Matrix) *Matrix2x2

func (*Matrix2x2) SetSubmatrixRaw ¶

func (m *Matrix2x2) SetSubmatrixRaw(row, col, rows1, cols1 int, m1 ...float32) *Matrix2x2

func (*Matrix2x2) Sub ¶

func (m *Matrix2x2) Sub(m1 Matrix2x2) *Matrix2x2

func (*Matrix2x2) Submatrix ¶

func (m *Matrix2x2) Submatrix(row, col int, m1 Matrix) Matrix

func (*Matrix2x2) Transpose ¶

func (m *Matrix2x2) Transpose(m1 Matrix2x2) *Matrix2x2

Transposes matrix m1 and stores the result in the destination matrix destination matrix must be of appropriate size. NOTE: Does not support in place transpose

type Matrix3x3 ¶

type Matrix3x3 [3][3]float32

func New3x3 ¶

func New3x3(arr ...float32) Matrix3x3

func (*Matrix3x3) Add ¶

func (m *Matrix3x3) Add(m1 Matrix3x3) *Matrix3x3

func (*Matrix3x3) Clone ¶

func (m *Matrix3x3) Clone() *Matrix3x3

func (*Matrix3x3) Col ¶

func (m *Matrix3x3) Col(col int, v vec.Vector) vec.Vector

Returns a copy of the matrix column.

func (*Matrix3x3) Det ¶

func (m *Matrix3x3) Det() float32

Determinant only valid for square matrix Undefined behavior for non square matrices

func (*Matrix3x3) Diagonal ¶

func (m *Matrix3x3) Diagonal(dst vec.Vector) vec.Vector

Size of the destination vector must equal to number of rows

func (*Matrix3x3) DivC ¶

func (m *Matrix3x3) DivC(c float32) *Matrix3x3

func (*Matrix3x3) Eye ¶

func (m *Matrix3x3) Eye() *Matrix3x3

Fills destination matrix with identity matrix.

func (*Matrix3x3) Flat ¶

func (m *Matrix3x3) Flat(v vec.Vector) vec.Vector

Returns a flat representation of this matrix.

func (*Matrix3x3) LU ¶

func (m *Matrix3x3) LU(L, U *Matrix3x3)

LU decomposition into two triangular matrices NOTE: Assume, that l&u matrices are set to zero Matrix must be square and M, L and U matrix sizes must be equal

func (*Matrix3x3) Matrix ¶

func (m *Matrix3x3) Matrix() Matrix

Returns a Matrix view of this matrix. The view actually contains slices of original matrix rows. This way original matrix can be modified.

func (*Matrix3x3) Mul ¶

func (m *Matrix3x3) Mul(a Matrix3x3, b Matrix3x3) *Matrix3x3

Destination matrix must be properly sized. given that a is MxN and b is NxK then destinatiom matrix must be MxK

func (*Matrix3x3) MulC ¶

func (m *Matrix3x3) MulC(c float32) *Matrix3x3

func (*Matrix3x3) MulDiag ¶

func (m *Matrix3x3) MulDiag(a Matrix3x3, b vec.Vector3D) *Matrix3x3

Only makes sense for square matrices. Vector size must be equal to number of rows/cols

func (*Matrix3x3) MulVec ¶

func (m *Matrix3x3) MulVec(v vec.Vector3D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of cols. Destination vector must have a size equal to number of rows.

func (*Matrix3x3) MulVecT ¶

func (m *Matrix3x3) MulVecT(v vec.Vector3D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of rows. Destination vector must have a size equal to number of cols.

func (*Matrix3x3) Orientation ¶

func (m *Matrix3x3) Orientation(q vec.Quaternion) *Matrix3x3

Build orientation matrix from quaternion Matrix size must be at least 3x3 Quaternion axis must be unit vector

func (*Matrix3x3) Quaternion ¶

func (m *Matrix3x3) Quaternion() (q *vec.Quaternion)

/ https://math.stackexchange.com/questions/893984/conversion-of-rotation-matrix-to-quaternion / Must be at least 3x3 matrix

func (*Matrix3x3) RotationX ¶

func (m *Matrix3x3) RotationX(a float32) *Matrix3x3

Fills destination matrix with a rotation around X axis Matrix size must be at least 3x3

func (*Matrix3x3) RotationY ¶

func (m *Matrix3x3) RotationY(a float32) *Matrix3x3

Fills destination matrix with a rotation around Y axis Matrix size must be at least 3x3

func (*Matrix3x3) RotationZ ¶

func (m *Matrix3x3) RotationZ(a float32) *Matrix3x3

Fills destination matrix with a rotation around Z axis Matrix size must be at least 3x3

func (*Matrix3x3) Row ¶

func (m *Matrix3x3) Row(row int) vec.Vector

Returns a slice to the row.

func (*Matrix3x3) SetCol ¶

func (m *Matrix3x3) SetCol(col int, v vec.Vector) *Matrix3x3

func (*Matrix3x3) SetDiagonal ¶

func (m *Matrix3x3) SetDiagonal(v vec.Vector3D) *Matrix3x3

Size of the vector must equal to number of rows

func (*Matrix3x3) SetRow ¶

func (m *Matrix3x3) SetRow(row int, v vec.Vector) *Matrix3x3

func (*Matrix3x3) SetSubmatrix ¶

func (m *Matrix3x3) SetSubmatrix(row, col int, m1 Matrix) *Matrix3x3

func (*Matrix3x3) SetSubmatrixRaw ¶

func (m *Matrix3x3) SetSubmatrixRaw(row, col, rows1, cols1 int, m1 ...float32) *Matrix3x3

func (*Matrix3x3) Sub ¶

func (m *Matrix3x3) Sub(m1 Matrix3x3) *Matrix3x3

func (*Matrix3x3) Submatrix ¶

func (m *Matrix3x3) Submatrix(row, col int, m1 Matrix) Matrix

func (*Matrix3x3) Transpose ¶

func (m *Matrix3x3) Transpose(m1 Matrix3x3) *Matrix3x3

Transposes matrix m1 and stores the result in the destination matrix destination matrix must be of appropriate size. NOTE: Does not support in place transpose

type Matrix3x4 ¶

type Matrix3x4 [3][4]float32

func New3x4 ¶

func New3x4(arr ...float32) Matrix3x4

func (*Matrix3x4) Add ¶

func (m *Matrix3x4) Add(m1 Matrix3x4) *Matrix3x4

func (*Matrix3x4) Clone ¶

func (m *Matrix3x4) Clone() *Matrix3x4

func (*Matrix3x4) Col ¶

func (m *Matrix3x4) Col(col int, v vec.Vector) vec.Vector

Returns a copy of the matrix column.

func (*Matrix3x4) DivC ¶

func (m *Matrix3x4) DivC(c float32) *Matrix3x4

func (*Matrix3x4) Flat ¶

func (m *Matrix3x4) Flat(v vec.Vector) vec.Vector

Returns a flat representation of this matrix.

func (*Matrix3x4) Matrix ¶

func (m *Matrix3x4) Matrix() Matrix

Returns a Matrix view of this matrix. The view actually contains slices of original matrix rows. This way original matrix can be modified.

func (*Matrix3x4) Mul ¶

func (m *Matrix3x4) Mul(a Matrix, b Matrix4x3) *Matrix3x4

Destination matrix must be properly sized. given that a is MxN and b is NxK then destinatiom matrix must be MxK

func (*Matrix3x4) MulC ¶

func (m *Matrix3x4) MulC(c float32) *Matrix3x4

func (*Matrix3x4) MulVec ¶

func (m *Matrix3x4) MulVec(v vec.Vector4D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of cols. Destination vector must have a size equal to number of rows.

func (*Matrix3x4) MulVecT ¶

func (m *Matrix3x4) MulVecT(v vec.Vector3D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of rows. Destination vector must have a size equal to number of cols.

func (*Matrix3x4) Orientation ¶

func (m *Matrix3x4) Orientation(q vec.Quaternion) *Matrix3x4

Build orientation matrix from quaternion Matrix size must be at least 3x3 Quaternion axis must be unit vector

func (*Matrix3x4) Quaternion ¶

func (m *Matrix3x4) Quaternion() (q *vec.Quaternion)

/ https://math.stackexchange.com/questions/893984/conversion-of-rotation-matrix-to-quaternion / Must be at least 3x3 matrix

func (*Matrix3x4) RotationX ¶

func (m *Matrix3x4) RotationX(a float32) *Matrix3x4

Fills destination matrix with a rotation around X axis Matrix size must be at least 3x3

func (*Matrix3x4) RotationY ¶

func (m *Matrix3x4) RotationY(a float32) *Matrix3x4

Fills destination matrix with a rotation around Y axis Matrix size must be at least 3x3

func (*Matrix3x4) RotationZ ¶

func (m *Matrix3x4) RotationZ(a float32) *Matrix3x4

Fills destination matrix with a rotation around Z axis Matrix size must be at least 3x3

func (*Matrix3x4) Row ¶

func (m *Matrix3x4) Row(row int) vec.Vector

Returns a slice to the row.

func (*Matrix3x4) SetCol ¶

func (m *Matrix3x4) SetCol(col int, v vec.Vector) *Matrix3x4

func (*Matrix3x4) SetRow ¶

func (m *Matrix3x4) SetRow(row int, v vec.Vector) *Matrix3x4

func (*Matrix3x4) SetSubmatrix ¶

func (m *Matrix3x4) SetSubmatrix(row, col int, m1 Matrix) *Matrix3x4

func (*Matrix3x4) SetSubmatrixRaw ¶

func (m *Matrix3x4) SetSubmatrixRaw(row, col, rows1, cols1 int, m1 ...float32) *Matrix3x4

func (*Matrix3x4) Sub ¶

func (m *Matrix3x4) Sub(m1 Matrix3x4) *Matrix3x4

func (*Matrix3x4) Submatrix ¶

func (m *Matrix3x4) Submatrix(row, col int, m1 Matrix) Matrix

func (*Matrix3x4) Transpose ¶

func (m *Matrix3x4) Transpose(m1 Matrix4x3) *Matrix3x4

Transposes matrix m1 and stores the result in the destination matrix destination matrix must be of appropriate size. NOTE: Does not support in place transpose

type Matrix4x3 ¶

type Matrix4x3 [4][3]float32

func New4x3 ¶

func New4x3(arr ...float32) Matrix4x3

func (*Matrix4x3) Add ¶

func (m *Matrix4x3) Add(m1 Matrix4x3) *Matrix4x3

func (*Matrix4x3) Clone ¶

func (m *Matrix4x3) Clone() *Matrix4x3

func (*Matrix4x3) Col ¶

func (m *Matrix4x3) Col(col int, v vec.Vector) vec.Vector

Returns a copy of the matrix column.

func (*Matrix4x3) DivC ¶

func (m *Matrix4x3) DivC(c float32) *Matrix4x3

func (*Matrix4x3) Flat ¶

func (m *Matrix4x3) Flat(v vec.Vector) vec.Vector

Returns a flat representation of this matrix.

func (*Matrix4x3) Matrix ¶

func (m *Matrix4x3) Matrix() Matrix

Returns a Matrix view of this matrix. The view actually contains slices of original matrix rows. This way original matrix can be modified.

func (*Matrix4x3) Mul ¶

func (m *Matrix4x3) Mul(a Matrix, b Matrix3x4) *Matrix4x3

Destination matrix must be properly sized. given that a is MxN and b is NxK then destinatiom matrix must be MxK

func (*Matrix4x3) MulC ¶

func (m *Matrix4x3) MulC(c float32) *Matrix4x3

func (*Matrix4x3) MulVec ¶

func (m *Matrix4x3) MulVec(v vec.Vector3D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of cols. Destination vector must have a size equal to number of rows.

func (*Matrix4x3) MulVecT ¶

func (m *Matrix4x3) MulVecT(v vec.Vector4D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of rows. Destination vector must have a size equal to number of cols.

func (*Matrix4x3) Orientation ¶

func (m *Matrix4x3) Orientation(q vec.Quaternion) *Matrix4x3

Build orientation matrix from quaternion Matrix size must be at least 3x3 Quaternion axis must be unit vector

func (*Matrix4x3) Quaternion ¶

func (m *Matrix4x3) Quaternion() (q *vec.Quaternion)

/ https://math.stackexchange.com/questions/893984/conversion-of-rotation-matrix-to-quaternion / Must be at least 3x3 matrix

func (*Matrix4x3) RotationX ¶

func (m *Matrix4x3) RotationX(a float32) *Matrix4x3

Fills destination matrix with a rotation around X axis Matrix size must be at least 3x3

func (*Matrix4x3) RotationY ¶

func (m *Matrix4x3) RotationY(a float32) *Matrix4x3

Fills destination matrix with a rotation around Y axis Matrix size must be at least 3x3

func (*Matrix4x3) RotationZ ¶

func (m *Matrix4x3) RotationZ(a float32) *Matrix4x3

Fills destination matrix with a rotation around Z axis Matrix size must be at least 3x3

func (*Matrix4x3) Row ¶

func (m *Matrix4x3) Row(row int) vec.Vector

Returns a slice to the row.

func (*Matrix4x3) SetCol ¶

func (m *Matrix4x3) SetCol(col int, v vec.Vector) *Matrix4x3

func (*Matrix4x3) SetRow ¶

func (m *Matrix4x3) SetRow(row int, v vec.Vector) *Matrix4x3

func (*Matrix4x3) SetSubmatrix ¶

func (m *Matrix4x3) SetSubmatrix(row, col int, m1 Matrix) *Matrix4x3

func (*Matrix4x3) SetSubmatrixRaw ¶

func (m *Matrix4x3) SetSubmatrixRaw(row, col, rows1, cols1 int, m1 ...float32) *Matrix4x3

func (*Matrix4x3) Sub ¶

func (m *Matrix4x3) Sub(m1 Matrix4x3) *Matrix4x3

func (*Matrix4x3) Submatrix ¶

func (m *Matrix4x3) Submatrix(row, col int, m1 Matrix) Matrix

func (*Matrix4x3) Transpose ¶

func (m *Matrix4x3) Transpose(m1 Matrix3x4) *Matrix4x3

Transposes matrix m1 and stores the result in the destination matrix destination matrix must be of appropriate size. NOTE: Does not support in place transpose

type Matrix4x4 ¶

type Matrix4x4 [4][4]float32

func New4x4 ¶

func New4x4(arr ...float32) Matrix4x4

func (*Matrix4x4) Add ¶

func (m *Matrix4x4) Add(m1 Matrix4x4) *Matrix4x4

func (*Matrix4x4) Clone ¶

func (m *Matrix4x4) Clone() *Matrix4x4

func (*Matrix4x4) Col ¶

func (m *Matrix4x4) Col(col int, v vec.Vector) vec.Vector

Returns a copy of the matrix column.

func (*Matrix4x4) Det ¶

func (m *Matrix4x4) Det() float32

Determinant only valid for square matrix Undefined behavior for non square matrices

func (*Matrix4x4) Diagonal ¶

func (m *Matrix4x4) Diagonal(dst vec.Vector) vec.Vector

Size of the destination vector must equal to number of rows

func (*Matrix4x4) DivC ¶

func (m *Matrix4x4) DivC(c float32) *Matrix4x4

func (*Matrix4x4) Eye ¶

func (m *Matrix4x4) Eye() *Matrix4x4

Fills destination matrix with identity matrix.

func (*Matrix4x4) Flat ¶

func (m *Matrix4x4) Flat(v vec.Vector) vec.Vector

Returns a flat representation of this matrix.

func (*Matrix4x4) LU ¶

func (m *Matrix4x4) LU(L, U *Matrix4x4)

LU decomposition into two triangular matrices NOTE: Assume, that l&u matrices are set to zero Matrix must be square and M, L and U matrix sizes must be equal

func (*Matrix4x4) Matrix ¶

func (m *Matrix4x4) Matrix() Matrix

Returns a Matrix view of this matrix. The view actually contains slices of original matrix rows. This way original matrix can be modified.

func (*Matrix4x4) Mul ¶

func (m *Matrix4x4) Mul(a Matrix4x4, b Matrix4x4) *Matrix4x4

Destination matrix must be properly sized. given that a is MxN and b is NxK then destinatiom matrix must be MxK

func (*Matrix4x4) MulC ¶

func (m *Matrix4x4) MulC(c float32) *Matrix4x4

func (*Matrix4x4) MulDiag ¶

func (m *Matrix4x4) MulDiag(a Matrix4x4, b vec.Vector4D) *Matrix4x4

Only makes sense for square matrices. Vector size must be equal to number of rows/cols

func (*Matrix4x4) MulVec ¶

func (m *Matrix4x4) MulVec(v vec.Vector4D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of cols. Destination vector must have a size equal to number of rows.

func (*Matrix4x4) MulVecT ¶

func (m *Matrix4x4) MulVecT(v vec.Vector4D, dst vec.Vector) vec.Vector

Vector must have a size equal to number of rows. Destination vector must have a size equal to number of cols.

func (*Matrix4x4) Orientation ¶

func (m *Matrix4x4) Orientation(q vec.Quaternion) *Matrix4x4

Build orientation matrix from quaternion Matrix size must be at least 3x3 Quaternion axis must be unit vector

func (*Matrix4x4) Quaternion ¶

func (m *Matrix4x4) Quaternion() (q *vec.Quaternion)

/ https://math.stackexchange.com/questions/893984/conversion-of-rotation-matrix-to-quaternion / Must be at least 3x3 matrix

func (*Matrix4x4) RotationX ¶

func (m *Matrix4x4) RotationX(a float32) *Matrix4x4

Fills destination matrix with a rotation around X axis Matrix size must be at least 3x3

func (*Matrix4x4) RotationY ¶

func (m *Matrix4x4) RotationY(a float32) *Matrix4x4

Fills destination matrix with a rotation around Y axis Matrix size must be at least 3x3

func (*Matrix4x4) RotationZ ¶

func (m *Matrix4x4) RotationZ(a float32) *Matrix4x4

Fills destination matrix with a rotation around Z axis Matrix size must be at least 3x3

func (*Matrix4x4) Row ¶

func (m *Matrix4x4) Row(row int) vec.Vector

Returns a slice to the row.

func (*Matrix4x4) SetCol ¶

func (m *Matrix4x4) SetCol(col int, v vec.Vector) *Matrix4x4

func (*Matrix4x4) SetDiagonal ¶

func (m *Matrix4x4) SetDiagonal(v vec.Vector4D) *Matrix4x4

Size of the vector must equal to number of rows

func (*Matrix4x4) SetRow ¶

func (m *Matrix4x4) SetRow(row int, v vec.Vector) *Matrix4x4

func (*Matrix4x4) SetSubmatrix ¶

func (m *Matrix4x4) SetSubmatrix(row, col int, m1 Matrix) *Matrix4x4

func (*Matrix4x4) SetSubmatrixRaw ¶

func (m *Matrix4x4) SetSubmatrixRaw(row, col, rows1, cols1 int, m1 ...float32) *Matrix4x4

func (*Matrix4x4) Sub ¶

func (m *Matrix4x4) Sub(m1 Matrix4x4) *Matrix4x4

func (*Matrix4x4) Submatrix ¶

func (m *Matrix4x4) Submatrix(row, col int, m1 Matrix) Matrix

func (*Matrix4x4) Transpose ¶

func (m *Matrix4x4) Transpose(m1 Matrix4x4) *Matrix4x4

Transposes matrix m1 and stores the result in the destination matrix destination matrix must be of appropriate size. NOTE: Does not support in place transpose

type MatrixSparse ¶

type MatrixSparse struct {
	Rows, Cols int
	Data       []MatrixSparseTriplet
}

type MatrixSparseTriplet ¶

type MatrixSparseTriplet struct {
	Row, Col int
	Value    float32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL