#[repr(C)]pub struct Mat4 {
pub data: [[f32; 4]; 4],
}Expand description
4x4 matrix for transforms.
Fields§
§data: [[f32; 4]; 4]Row-major matrix data [row][col]
Implementations§
Source§impl Mat4
impl Mat4
Sourcepub const fn translation_2d(x: f32, y: f32) -> Mat4
pub const fn translation_2d(x: f32, y: f32) -> Mat4
Create 2D translation matrix.
Sourcepub const fn scale_uniform(s: f32) -> Mat4
pub const fn scale_uniform(s: f32) -> Mat4
Create uniform scale matrix.
Sourcepub fn rotation_z(angle_rad: f32) -> Mat4
pub fn rotation_z(angle_rad: f32) -> Mat4
Create rotation around Z axis (2D rotation).
Sourcepub fn ortho(
left: f32,
right: f32,
bottom: f32,
top: f32,
near: f32,
far: f32,
) -> Mat4
pub fn ortho( left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32, ) -> Mat4
Create orthographic projection matrix.
Sourcepub fn ortho_screen(width: f32, height: f32) -> Mat4
pub fn ortho_screen(width: f32, height: f32) -> Mat4
Create orthographic projection for screen coordinates (Y down).
Sourcepub fn transform_vec4(&self, v: Vec4) -> Vec4
pub fn transform_vec4(&self, v: Vec4) -> Vec4
Transform a Vec4.
Sourcepub fn transform_point(&self, p: Point) -> Point
pub fn transform_point(&self, p: Point) -> Point
Transform a 2D point (assumes z=0, w=1).
Sourcepub fn transform_rect(&self, rect: &Rect) -> Rect
pub fn transform_rect(&self, rect: &Rect) -> Rect
Transform a rectangle.
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
Mutably borrows from an owned value. Read more