Expand description
A 4x4 matrix, suitable for 3D transformations.
Tuple Fields
0: [Vector4; 4]
Implementations
sourceimpl Matrix4
impl Matrix4
sourcepub const fn from_1d_array(a: [f32; 16]) -> Self
pub const fn from_1d_array(a: [f32; 16]) -> Self
A new matrix from a 1D array.
sourcepub fn look_at(eye: Point, target: Point, up: Vector3) -> Self
pub fn look_at(eye: Point, target: Point, up: Vector3) -> Self
A look-at matrix suitable for positioning a camera.
sourcepub fn perspective(
aspect_ratio: f32,
fov_radians: f32,
znear: f32,
zfar: f32
) -> Self
pub fn perspective(
aspect_ratio: f32,
fov_radians: f32,
znear: f32,
zfar: f32
) -> Self
A perspective matrix suitable for use as a camera projection.
sourcepub fn orthographic(
left: f32,
right: f32,
bottom: f32,
top: f32,
near: f32,
far: f32
) -> Self
pub fn orthographic(
left: f32,
right: f32,
bottom: f32,
top: f32,
near: f32,
far: f32
) -> Self
An orthographic matrix suitable for rendering user interfaces.
sourcepub fn translation(v: Vector3) -> Self
pub fn translation(v: Vector3) -> Self
A matrix that translates by the given vector.
sourcepub fn rotation_x(angle_radians: f32) -> Self
pub fn rotation_x(angle_radians: f32) -> Self
A matrix that rotates around the x-axis.
sourcepub fn rotation_y(angle_radians: f32) -> Self
pub fn rotation_y(angle_radians: f32) -> Self
A matrix that rotates around the y-axis.
sourcepub fn rotation_z(angle_radians: f32) -> Self
pub fn rotation_z(angle_radians: f32) -> Self
A matrix that rotates around the z-axis.
sourcepub fn rotation_axis_angle(axis: Vector3, angle_radians: f32) -> Self
pub fn rotation_axis_angle(axis: Vector3, angle_radians: f32) -> Self
A matrix that rotates around an arbitrary axis.
sourcepub fn rotation_from_vector_to_vector(start: Vector3, end: Vector3) -> Self
pub fn rotation_from_vector_to_vector(start: Vector3, end: Vector3) -> Self
A matrix that rotates from a given vector to another.
sourcepub fn uniform_scale(scale: f32) -> Self
pub fn uniform_scale(scale: f32) -> Self
A matrix that scales uniformly in all dimensions.
sourcepub fn transpose(&self) -> Self
pub fn transpose(&self) -> Self
The transpose of this matrix (i.e. this matrix flipped along the diagonal)
pub fn as_slice(&self) -> &[f32]
Trait Implementations
sourceimpl NearlyEqual for &Matrix4
impl NearlyEqual for &Matrix4
fn nearly_equals(self, rhs: Self) -> bool
impl Copy for Matrix4
impl StructuralPartialEq for Matrix4
Auto Trait Implementations
impl RefUnwindSafe for Matrix4
impl Send for Matrix4
impl Sync for Matrix4
impl Unpin for Matrix4
impl UnwindSafe for Matrix4
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more