Struct Matrix4x4
Source pub struct Matrix4x4 {
pub elements: [f64; 16],
}
Expand description
A 4x4 matrix stored in column-major order, used for 3D transformations.
The 16 elements of the matrix in column-major order.
get_elements is public: example/src/page/game_3d reads the matrix
from outside this crate. get_mut / set stay crate-internal.
Source§Implements matrix operations for Matrix4x4.
Returns the identity matrix.
§Returns
Matrix4x4 - The identity matrix.
Creates a translation matrix.
§Arguments
Vector3D - The translation vector.
§Returns
Matrix4x4 - The translation matrix.
Creates a scaling matrix.
§Arguments
Vector3D - The scale factors.
§Returns
Matrix4x4 - The scaling matrix.
Creates a rotation matrix from a quaternion.
§Arguments
Quaternion - The rotation quaternion.
§Returns
Matrix4x4 - The rotation matrix.
Creates a perspective projection matrix.
§Arguments
f64 - The vertical field of view in radians.
f64 - The aspect ratio (width / height).
f64 - The near clipping plane distance.
f64 - The far clipping plane distance.
§Returns
Matrix4x4 - The perspective projection matrix.
Creates an orthographic projection matrix.
§Arguments
f64 - The left boundary.
f64 - The right boundary.
f64 - The bottom boundary.
f64 - The top boundary.
f64 - The near clipping plane distance.
f64 - The far clipping plane distance.
§Returns
Matrix4x4 - The orthographic projection matrix.
Creates a view matrix using the “look at” convention.
§Arguments
Vector3D - The eye position.
Vector3D - The target position to look at.
Vector3D - The up direction.
§Returns
Matrix4x4 - The view matrix.
Multiplies this matrix by another using fully unrolled arithmetic.
Eliminates all loop overhead and allows the compiler to maximize
register allocation and instruction-level parallelism.
§Arguments
Matrix4x4 - The other matrix.
§Returns
Matrix4x4 - The product matrix.
Transforms a 3D point by this matrix, applying the perspective divide.
§Arguments
Vector3D - The point to transform.
§Returns
Vector3D - The transformed point.
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read moreSource§Implements Default for Matrix4x4 as the identity matrix.
Constructs a default Matrix4x4 value.
§Returns
Matrix4x4 - A default-constructed instance with the documented initial state.
This method returns an ordering between
self and
other values if one exists.
Read more
Tests less than (for
self and
other) and is used by the
< operator.
Read more
Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more
Tests greater than (for
self and
other) and is used by the
>
operator.
Read more
Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Perform a zero-cost type-safe upcast to a wider ref type within the Wasm
bindgen generics type system.
Read more
Perform a zero-cost type-safe upcast to a wider type within the Wasm
bindgen generics type system.
Read more