Skip to main content

Mat4

Struct Mat4 

Source
#[repr(C)]
pub struct Mat4<T: Float = f32> { pub m: [[T; 4]; 4], }
Expand description

A packed 4×4 row-major matrix.

Fields§

§m: [[T; 4]; 4]

Implementations§

Source§

impl<T: Float> Mat4<T>

Source

pub fn is_identity(self, tolerance: T) -> bool

Source

pub fn try_view_from_pose( position: Vec3<T>, rotation: Quat<T>, tolerance: T, ) -> Option<Self>

Source

pub fn try_look_at( eye: Vec3<T>, target: Vec3<T>, world_up: Vec3<T>, tolerance: T, ) -> Option<Self>

Source

pub fn compose_affine(decomposition: AffineDecomposition<T>) -> Option<Self>

Source

pub fn try_decompose_affine( self, tolerance: T, ) -> Option<AffineDecomposition<T>>

Source

pub fn try_decompose_trs(self, tolerance: T) -> Option<TrsDecomposition<T>>

Source§

impl<T: Float> Mat4<T>

Source

pub fn identity() -> Self

Source

pub fn is_finite(self) -> bool

Source

pub fn transpose(self) -> Self

Source

pub fn determinant(self) -> T

Source

pub fn try_inverse(self, tolerance: T) -> Option<Self>

Source

pub fn linear_part(self) -> Mat3<T>

Source

pub fn translation_part(self) -> Vec3<T>

Source

pub fn new_from_affine(linear: Mat3<T>, translation: Vec3<T>) -> Self

Source

pub fn is_affine(self, tolerance: T) -> bool

Source

pub fn try_affine_inverse(self, tolerance: T) -> Option<Self>

Source

pub fn try_normal_matrix(self, tolerance: T) -> Option<Mat3<T>>

Source

pub fn transform(self, value: Vec4<T>) -> Vec4<T>

Source

pub fn transform_point(self, point: Vec3<T>) -> Vec3<T>

Source

pub fn transform_direction(self, direction: Vec3<T>) -> Vec3<T>

Source

pub fn try_project_point(self, point: Vec3<T>, tolerance: T) -> Option<Vec3<T>>

Source

pub fn try_transform_normal( self, normal: Vec3<T>, tolerance: T, ) -> Option<Vec3<T>>

Source

pub fn translation(value: Vec3<T>) -> Self

Source

pub fn scaling(value: Vec3<T>) -> Self

Source

pub fn try_from_quaternion(rotation: Quat<T>) -> Option<Self>

Source

pub fn try_compose_trs( translation: Vec3<T>, rotation: Quat<T>, scale: Vec3<T>, ) -> Option<Self>

Source

pub fn approximately_equal(self, other: Self, absolute: T, relative: T) -> bool

Source§

impl<T: Float> Mat4<T>

Source

pub fn try_perspective_off_center( left: T, right: T, bottom: T, top: T, near: T, far: T, ) -> Option<Self>

Source

pub fn try_perspective( fov_y_degrees: T, aspect: T, near: T, far: T, ) -> Option<Self>

Source

pub fn try_perspective_shifted( fov_y_degrees: T, aspect: T, near: T, far: T, ndc_offset: Vec2<T>, ) -> Option<Self>

Source

pub fn try_orthographic_off_center( left: T, right: T, bottom: T, top: T, near: T, far: T, ) -> Option<Self>

Source

pub fn try_orthographic( width: T, height: T, near: T, far: T, zoom: T, ) -> Option<Self>

Source

pub fn try_orthographic_shifted( width: T, height: T, near: T, far: T, zoom: T, ndc_offset: Vec2<T>, ) -> Option<Self>

Source

pub fn try_perspective_reverse_z( fov_y_degrees: T, aspect: T, near: T, far: T, ) -> Option<Self>

Source

pub fn try_perspective_reverse_z_infinite( fov_y_degrees: T, aspect: T, near: T, ) -> Option<Self>

Trait Implementations§

Source§

impl<T: Float> Add for Mat4<T>

Source§

type Output = Mat4<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<T: Float> AddAssign for Mat4<T>

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T: Clone + Float> Clone for Mat4<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Copy + Float> Copy for Mat4<T>

Source§

impl<T: Debug + Float> Debug for Mat4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + Float> Default for Mat4<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Float> Div<T> for Mat4<T>

Source§

type Output = Mat4<T>

The resulting type after applying the / operator.
Source§

fn div(self, scalar: T) -> Self

Performs the / operation. Read more
Source§

impl<T: Float> DivAssign<T> for Mat4<T>

Source§

fn div_assign(&mut self, scalar: T)

Performs the /= operation. Read more
Source§

impl<T: Float> Mul for Mat4<T>

Source§

type Output = Mat4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
Source§

impl<T: Float> Mul<Mat4<T>> for Vec4<T>

Source§

type Output = Vec4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, matrix: Mat4<T>) -> Self

Performs the * operation. Read more
Source§

impl Mul<Mat4<f64>> for f64

Source§

type Output = Mat4<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, matrix: Mat4<f64>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Mat4> for f32

Source§

type Output = Mat4

The resulting type after applying the * operator.
Source§

fn mul(self, matrix: Mat4<f32>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Float> Mul<T> for Mat4<T>

Source§

type Output = Mat4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: T) -> Self

Performs the * operation. Read more
Source§

impl<T: Float> MulAssign for Mat4<T>

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T: Float> MulAssign<T> for Mat4<T>

Source§

fn mul_assign(&mut self, scalar: T)

Performs the *= operation. Read more
Source§

impl<T: Float> Neg for Mat4<T>

Source§

type Output = Mat4<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T: PartialEq + Float> PartialEq for Mat4<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq + Float> StructuralPartialEq for Mat4<T>

Source§

impl<T: Float> Sub for Mat4<T>

Source§

type Output = Mat4<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl<T: Float> SubAssign for Mat4<T>

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T> Forget for Mat4<T>

§

impl<T> Freeze for Mat4<T>
where T: Freeze,

§

impl<T> Move for Mat4<T>

§

impl<T> RefUnwindSafe for Mat4<T>
where T: RefUnwindSafe,

§

impl<T> Send for Mat4<T>
where T: Send,

§

impl<T> Sync for Mat4<T>
where T: Sync,

§

impl<T> Unpin for Mat4<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Mat4<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Mat4<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.