pub struct Mat4 { /* private fields */ }Expand description
A 4x4 matrix that moves, turns and scales points in 3D. It maps a point
p to M * (p, 1), so the last column holds the translation.
Implementations§
Source§impl Mat4
impl Mat4
Sourcepub const fn from_axes(x: Vec3, y: Vec3, z: Vec3, origin: Vec3) -> Mat4
pub const fn from_axes(x: Vec3, y: Vec3, z: Vec3, origin: Vec3) -> Mat4
The matrix whose columns map the x, y and z axes onto x, y and
z and the origin onto origin.
Sourcepub const fn translation(offset: Vec3) -> Mat4
pub const fn translation(offset: Vec3) -> Mat4
Moves every point by offset.
Sourcepub fn rotation_x(radians: f32) -> Mat4
pub fn rotation_x(radians: f32) -> Mat4
Turns points about the x axis by radians. A positive angle tips the
y axis, which points down, away from the viewer.
Sourcepub fn rotation_y(radians: f32) -> Mat4
pub fn rotation_y(radians: f32) -> Mat4
Turns points about the y axis by radians. A positive angle swings
the x axis away from the viewer.
Sourcepub fn rotation_z(radians: f32) -> Mat4
pub fn rotation_z(radians: f32) -> Mat4
Turns points about the z axis by radians. A positive angle turns
clockwise on screen.
Sourcepub fn transform_point(&self, point: Vec3) -> Vec3
pub fn transform_point(&self, point: Vec3) -> Vec3
Maps point, dividing by the resulting w.
Sourcepub fn transform_homogeneous(&self, point: Vec3) -> [f32; 4]
pub fn transform_homogeneous(&self, point: Vec3) -> [f32; 4]
Maps point and returns all four coordinates of the result, before
any division by w.
Sourcepub fn transform_vector(&self, vector: Vec3) -> Vec3
pub fn transform_vector(&self, vector: Vec3) -> Vec3
Maps a direction: the translation does not apply.
Sourcepub fn length_scale(&self) -> f32
pub fn length_scale(&self) -> f32
How long the map makes a unit length, averaged over the three axes: the cube root of how much it scales volume.
Trait Implementations§
impl Copy for Mat4
impl StructuralPartialEq for Mat4
Auto Trait Implementations§
impl Freeze for Mat4
impl RefUnwindSafe for Mat4
impl Send for Mat4
impl Sync for Mat4
impl Unpin for Mat4
impl UnsafeUnpin for Mat4
impl UnwindSafe for Mat4
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more