#[repr(C)]pub struct Matrix4(pub [Vector4; 4]);
Expand description
A 4x4 matrix, suitable for 3D transformations.
Tuple Fields§
§0: [Vector4; 4]
Implementations§
Source§impl 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 const fn from_2d_array(a: [[f32; 4]; 4]) -> Self
pub const fn from_2d_array(a: [[f32; 4]; 4]) -> Self
A new matrix from a 2D 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§
Source§impl 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 Freeze for Matrix4
impl RefUnwindSafe for Matrix4
impl Send for Matrix4
impl Sync for Matrix4
impl Unpin for Matrix4
impl UnwindSafe for Matrix4
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more