Expand description
A simple and generic library for vector math.
Notice that row major is mathematical standard, while OpenGL uses column major format. This library supports both formats, prefixing functions with ‘row_’ or ‘col_’.
For row major affine transforms, use Matrix2x3 (2D) and Matrix3x4 (3D).
For column major affine transforms, use Matrix3x2 (2D) and Matrix4x3 (3D).
If you are using Matrix3 or Matrix4,
then you need to pick either row or column major.
Notice that there are two kinds of transforms: Positions and vectors.
The vector transforms ignores the translate component.
For example, row_mat2x3_transform_pos2 transforms a position.
row_mat2x3_transform_vec2 transforms a vector.
Modules§
- traits
- Various useful traits
Functions§
- col_
mat2x3_ row - Returns a row vector of a column matrix.
- col_
mat3_ mul - Multiplies two matrices.
- col_
mat3_ mul_ col - Computes column vector in column matrix product.
- col_
mat3_ row - Returns a row vector of a column matrix.
- col_
mat3_ transform - Transforms a 3D vector through a matrix.
- col_
mat3_ transform_ pos2 - Transforms a 2D position through column matrix.
- col_
mat3_ transform_ vec2 - Transforms a 2D vector through column matrix.
- col_
mat3x2_ mul - Multiplies two matrices.
- col_
mat3x2_ mul_ col - Computes column vector in column matrix product.
- col_
mat3x2_ row - Returns a row vector of a column matrix.
- col_
mat3x2_ transform_ pos2 - Transforms a 2D position through matrix.
- col_
mat3x2_ transform_ vec2 - Transforms a 2D vector through matrix.
- col_
mat3x4_ row - Returns a row vector of a column matrix.
- col_
mat4_ mul - Multiplies two matrices.
- col_
mat4_ mul_ col - Computes column vector in column matrix product.
- col_
mat4_ row - Returns a row vector of a column matrix.
- col_
mat4_ transform - Transforms a 4D vector through a matrix.
- col_
mat4x3_ mul - Multiplies two matrices.
- col_
mat4x3_ mul_ col - Computes column vector in column matrix product.
- col_
mat4x3_ row - Returns a column vector of a row matrix.
- col_
mat4x3_ transform_ pos3 - Transforms a 3D position through matrix.
- col_
mat4x3_ transform_ vec3 - Transforms a 3D vector through matrix.
- mat2x3_
add - Adds two matrices.
- mat2x3_
cast - Converts to another matrix type.
- mat2x3_
det - Computes the determinant of a matrix.
- mat2x3_
id - Constructs identity matrix.
- mat2x3_
inv - Computes the inverse of a 2x3 matrix.
- mat2x3_
inv_ det - Computes inverse determinant of a 2x3 matrix.
- mat2x3_
sub - Subtracts ‘b’ from ‘a’.
- mat2x3_
transposed - Constructs the transpose of a matrix.
- mat3_
add - Adds two matrices.
- mat3_
cast - Converts to another matrix type.
- mat3_
det - Computes the determinant of a matrix.
- mat3_id
- Constructs identity matrix.
- mat3_
inv - Computes the inverse of a 3x3 matrix.
- mat3_
inv_ det - Computes inverse determinant of a 3x3 matrix.
- mat3_
sub - Subtracts ‘b’ from ‘a’.
- mat3_
transposed - Constructs the transpose of a matrix.
- mat3x2_
add - Adds two matrices.
- mat3x2_
cast - Converts to another matrix type.
- mat3x2_
det - Computes the determinant of a matrix.
- mat3x2_
id - Constructs identity matrix.
- mat3x2_
inv - Computes the inverse of a 3x2 matrix.
- mat3x2_
inv_ det - Computes inverse determinant of a 3x2 matrix.
- mat3x2_
sub - Subtracts ‘b’ from ‘a’.
- mat3x2_
transposed - Constructs the transpose of a matrix.
- mat3x4_
add - Adds two matrices.
- mat3x4_
cast - Converts to another matrix type.
- mat3x4_
det - Computes the determinant of a matrix.
- mat3x4_
id - Constructs identity matrix.
- mat3x4_
inv - Computes the inverse of a 3x4 matrix.
- mat3x4_
inv_ det - Computes inverse determinant of a 3x4 matrix.
- mat3x4_
sub - Subtracts ‘b’ from ‘a’.
- mat3x4_
transposed - Constructs the transpose of a matrix.
- mat4_
add - Adds two matrices.
- mat4_
cast - Converts to another matrix type.
- mat4_
det - Computes the determinant of a 4x4 matrix.
- mat4_id
- Constructs identity matrix.
- mat4_
inv - Computes the inverse of a 4x4 matrix.
- mat4_
inv_ det - Computes the inverse determinant of a 4x4 matrix.
- mat4_
sub - Subtracts ‘b’ from ‘a’.
- mat4_
transposed - Constructs the transpose of a matrix.
- mat4x3_
add - Adds two matrices.
- mat4x3_
cast - Converts to another matrix type.
- mat4x3_
det - Computes the determinant of a matrix.
- mat4x3_
id - Constructs identity matrix.
- mat4x3_
inv - Computes the inverse of a 4x3 matrix.
- mat4x3_
inv_ det - Computes inverse determinant of a 4x3 matrix.
- mat4x3_
sub - Subtracts ‘b’ from ‘a’.
- mat4x3_
transposed - Constructs the transpose of a matrix.
- row_
mat2x3_ col - Returns a column vector of a row matrix.
- row_
mat2x3_ mul - Multiplies two matrices.
- row_
mat2x3_ mul_ row - Computes row vector in row matrix product.
- row_
mat2x3_ transform_ pos2 - Transforms a 2D position through matrix.
- row_
mat2x3_ transform_ vec2 - Transforms a 2D vector through matrix.
- row_
mat3_ col - Returns a column vector of a row matrix.
- row_
mat3_ mul - Multiplies two matrices.
- row_
mat3_ mul_ row - Computes row vector in row matrix product.
- row_
mat3_ transform - Transforms a 3D vector through a matrix.
- row_
mat3_ transform_ pos2 - Transforms a 2D position through row matrix.
- row_
mat3_ transform_ vec2 - Transforms a 2D vector through row matrix.
- row_
mat3x2_ col - Returns a column vector of a row matrix.
- row_
mat3x4_ col - Returns a column vector of a row matrix.
- row_
mat3x4_ mul - Multiplies two matrices.
- row_
mat3x4_ mul_ row - Computes row vector in row matrix product.
- row_
mat3x4_ transform_ pos3 - Transforms a 3D position through matrix.
- row_
mat3x4_ transform_ vec3 - Transforms a 3D vector through matrix.
- row_
mat4_ col - Returns a column vector of a row matrix.
- row_
mat4_ mul - Multiplies two matrices.
- row_
mat4_ mul_ row - Computes row vector in row matrix product.
- row_
mat4_ transform - Transforms a 4D vector through a matrix.
- row_
mat4x3_ col - Returns a column vector of a row matrix.
- vec2_
add - Adds two vectors.
- vec2_
cast - Converts to another vector type.
- vec2_
cross - Computes the cross product.
- vec2_
dot - Computes the dot product.
- vec2_
inv_ len - Computes the inverse length of a vector.
- vec2_
len - Computes the length of vector.
- vec2_
mul - Multiplies two vectors component wise.
- vec2_
neg - Negates the vector.
- vec2_
normalized - Computes the normalized.
- vec2_
normalized_ sub - Computes the normalized difference between two vectors.
- vec2_
scale - Multiplies the vector with a scalar.
- vec2_
square_ len - Computes the square length of a vector.
- vec2_
sub - Subtracts ‘b’ from ‘a’.
- vec3_
add - Adds two vectors.
- vec3_
cast - Converts to another vector type.
- vec3_
cross - Computes the cross product.
- vec3_
dot - Computes the dot product.
- vec3_
dot_ pos2 - Computes transformed position component.
- vec3_
dot_ vec2 - Computes transformed vector component.
- vec3_
inv_ len - Computes the inverse length of a vector.
- vec3_
len - Computes the length of vector.
- vec3_
mul - Multiplies two vectors component wise.
- vec3_
neg - Negates the vector.
- vec3_
normalized - Computes the normalized.
- vec3_
normalized_ sub - Computes the normalized difference between two vectors.
- vec3_
scale - Multiplies the vector with a scalar.
- vec3_
square_ len - Computes the square length of a vector.
- vec3_
sub - Subtracts ‘b’ from ‘a’.
- vec4_
add - Adds two vectors.
- vec4_
cast - Converts to another vector type.
- vec4_
dot - Computes the dot product.
- vec4_
dot_ pos3 - Computes transformed position component.
- vec4_
dot_ vec3 - Computes transformed vector component.
- vec4_
inv_ len - Computes the inverse length of a vector.
- vec4_
len - Computes the length of vector.
- vec4_
mul - Multiplies two vectors component wise.
- vec4_
neg - Negates the vector.
- vec4_
normalized - Computes the normalized.
- vec4_
normalized_ sub - Computes the normalized difference between two vectors.
- vec4_
scale - Multiplies the vector with a scalar.
- vec4_
square_ len - Computes the square length of a vector.
- vec4_
sub - Subtracts ‘b’ from ‘a’.