matrix
An array of arrays of floats that represent a matrix. Can be any size but transformation matrices are 4x4.
ident
ident()
Create a (square) identity matrix with dimensions
diag
diag()
Create a square matrix with the diagonal set to the given values
dim
dim()
Returns the dimension of the given matrix as (m, n)
column
column()
Returns the n-th column of a matrix as a vector
round
round()
Rounds each value in the matrix to a precision.
transform-translate
transform-translate()
Returns a
translation matrix
transform-shear-x
transform-shear-x()
Returns a
x-shear matrix
transform-shear-z
transform-shear-z()
Returns a
z-shear matrix
transform-scale
transform-scale()
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()
Returns a
rotation xyz matrix for a direction and up vector
transform-rotate-x
transform-rotate-x()
Returns a
rotation matrix
transform-rotate-y
transform-rotate-y()
Returns a
rotation matrix
transform-rotate-z
transform-rotate-z()
Returns a
rotation matrix
transform-rotate-aer
transform-rotate-aer()
Returns a
rotation matrix from azimuth/elevation/roll. Assumes the viewing convention where
points up and
points toward the viewer.
transform-rotate-xz
transform-rotate-xz()
Returns a
rotation matrix
transform-rotate-ypr
transform-rotate-ypr()
Returns a
rotation matrix - yaw-pitch-roll
transform-rotate-xyz
transform-rotate-xyz()
Returns a
rotation matrix - euler angles
Calculates the product of the three rotation matrices
mul-mat
mul-mat()
Multiplies matrices on top of each other.
mul4x4-vec3
mul4x4-vec3()
Multiplies a
matrix with a vector of size 3 or 4. The resulting is three dimensional
mul-vec
mul-vec()
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()
Calculates the inverse matrix of any size.