matrix/mat3f
3x3 matrices of floats
Types
Values
pub fn add(
a: vec3.Vec3(vec3.Vec3(Float)),
b: vec3.Vec3(vec3.Vec3(Float)),
) -> vec3.Vec3(vec3.Vec3(Float))
Adds two Mat3f together.
pub fn determinant(mat: vec3.Vec3(vec3.Vec3(Float))) -> Float
Returns the determinant for the Mat3f.
pub fn divide(
a: vec3.Vec3(vec3.Vec3(Float)),
b: vec3.Vec3(vec3.Vec3(Float)),
) -> Result(vec3.Vec3(vec3.Vec3(Float)), Nil)
Divides one Mat3f by another. Equivalent to multiplying the inverse of the second matrix.
pub fn from_cols(
a: vec3.Vec3(Float),
b: vec3.Vec3(Float),
c: vec3.Vec3(Float),
) -> vec3.Vec3(vec3.Vec3(Float))
Constructs a Mat3f from its three columns.
| ax bx cx |
| ay by cy |
| az bz cz |
pub fn from_diagonal(
diag: vec3.Vec3(Float),
) -> vec3.Vec3(vec3.Vec3(Float))
Constructs a Mat3f with the given diagonal and all other entries set to 0.
| x 0.0 0.0 |
| 0.0 y 0.0 |
| 0.0 0.0 z |
pub fn from_quaternion(
q: vec4.Vec4(Float),
) -> vec3.Vec3(vec3.Vec3(Float))
Constructs a 3D rotation matrix from the given quaternion, represented as a vec4.Vec4(Float).
pub const identity: vec3.Vec3(vec3.Vec3(Float))
A Mat3f representing the identity, i.e. 1.0 is on the diagonal.
pub fn inverse(
mat: vec3.Vec3(vec3.Vec3(Float)),
) -> Result(vec3.Vec3(vec3.Vec3(Float)), Nil)
Inverts the Mat3f, returning an error if the determinant is zero.
pub fn mul_transpose_vec3(
mat: vec3.Vec3(vec3.Vec3(Float)),
rhs: vec3.Vec3(Float),
) -> vec3.Vec3(Float)
Transforms a Vec3f by the transpose of this Mat3f.
pub fn mul_vec3(
mat: vec3.Vec3(vec3.Vec3(Float)),
rhs: vec3.Vec3(Float),
) -> vec3.Vec3(Float)
Transforms a Vec3f by this Mat3f.
pub fn multiply(
a: vec3.Vec3(vec3.Vec3(Float)),
b: vec3.Vec3(vec3.Vec3(Float)),
) -> vec3.Vec3(vec3.Vec3(Float))
Multiplies two Mat3f together.
pub fn negate(
mat: vec3.Vec3(vec3.Vec3(Float)),
) -> vec3.Vec3(vec3.Vec3(Float))
Negates all elements of the Mat3f
pub fn new(
a: Float,
b: Float,
c: Float,
d: Float,
e: Float,
f: Float,
g: Float,
h: Float,
i: Float,
) -> vec3.Vec3(vec3.Vec3(Float))
Constructs a Mat3f from its components:
| a d g |
| b e h |
| c f i |
pub fn scale(
mat: vec3.Vec3(vec3.Vec3(Float)),
scale: Float,
) -> vec3.Vec3(vec3.Vec3(Float))
Scales the Mat3f by a Float factor.
pub fn scale_diagonal(
mat: vec3.Vec3(vec3.Vec3(Float)),
scale: vec3.Vec3(Float),
) -> vec3.Vec3(vec3.Vec3(Float))
Scales the Mat3f by a Vec3f.
This is faster than creating a diagonal scaling matrix and then multiplying that.
pub fn subtract(
a: vec3.Vec3(vec3.Vec3(Float)),
b: vec3.Vec3(vec3.Vec3(Float)),
) -> vec3.Vec3(vec3.Vec3(Float))
Subtracts one Mat3f from the other.