matrix
An array of arrays of floats that represent a matrix. Can be any size but transformation matrices are 4x4.
ident
ident() -> matrix
Create identity matrix with dimensions
dim
dim() -> array
Returns the dimension of the given matrix as (m, n)
column
column() -> vector
Returns the nth column of a matrix as a vector
set-column
set-column() -> matrix
Replaces the nth column of a matrix with the given vector.
round
round() -> matrix
Rounds each value in the matrix to a precision.
transform-translate
transform-translate() -> matrix
Returns a translation matrix
transform-shear-x
transform-shear-x() -> matrix
Returns a x-shear matrix
transform-shear-z
transform-shear-z() -> matrix
Returns a z-shear matrix
transform-scale
transform-scale() -> matrix
Returns a scale matrix
f:
The scale factor(s) of the matrix. An array of at least 3 floats sets the x, y and z scale factors. A dictionary sets the scale in the direction of the corresponding x, y and z keys. A single float sets the scale for all directions.
transform-rotate-dir
transform-rotate-dir() -> matrix
Returns a rotation xyz matrix for a direction and up vector
transform-rotate-x
transform-rotate-x() -> matrix
Returns a rotation matrix
transform-rotate-y
transform-rotate-y() -> matrix
Returns a rotation matrix
transform-rotate-z
transform-rotate-z() -> matrix
Returns a rotation matrix
transform-rotate-xz
transform-rotate-xz() -> matrix
Returns a rotation matrix
transform-rotate-ypr
transform-rotate-ypr() -> matrix
Returns a rotation matrix - yaw-pitch-roll
Calculates the product of the three rotation matrices
transform-rotate-xyz
transform-rotate-xyz() -> matrix
Returns a rotation matrix - euler angles
Calculates the product of the three rotation matrices
mul-mat
mul-mat() -> matrix
Multiplies matrices on top of each other.
mul4x4-vec3
mul4x4-vec3() -> vector
Multiplies a matrix with a vector of size 3 or 4. The resulting is three dimensional
The default value for the fourth element of the vector if it is three dimensional.
mul-vec
mul-vec() -> vector
Multiplies an matrix with an th dimensional vector where . Prefer the use of mul4x4-vec3
when possible as it does not use loops.
inverse
inverse() -> matrix
Calculates the inverse matrix of any size.
swap-cols
swap-cols() -> matrix
Swaps the ath column with the bth column.
translate
translate()
Translates a matrix by a vector.