Struct euler::DMat4

source ·
#[repr(C)]
pub struct DMat4 {
Show 16 fields pub m00: f64, pub m01: f64, pub m02: f64, pub m03: f64, pub m10: f64, pub m11: f64, pub m12: f64, pub m13: f64, pub m20: f64, pub m21: f64, pub m22: f64, pub m23: f64, pub m30: f64, pub m31: f64, pub m32: f64, pub m33: f64,
}
Expand description

Double-precision 2x2 column major matrix.

Fields§

§m00: f64§m01: f64§m02: f64§m03: f64§m10: f64§m11: f64§m12: f64§m13: f64§m20: f64§m21: f64§m22: f64§m23: f64§m30: f64§m31: f64§m32: f64§m33: f64

Implementations§

source§

impl DMat4

source

pub fn new( m00: f64, m01: f64, m02: f64, m03: f64, m10: f64, m11: f64, m12: f64, m13: f64, m20: f64, m21: f64, m22: f64, m23: f64, m30: f64, m31: f64, m32: f64, m33: f64 ) -> Self

Full constructor.

source

pub fn identity() -> Self

Identity constructor.

source

pub fn diagonal(di: f64) -> Self

Diagonal constructor.

source

pub fn tridiagonal(lo: f64, di: f64, up: f64) -> Self

Tri-diagonal constructor.

source§

impl DMat4

source

pub fn determinant(self) -> f64

Computes the matrix determinant.

source

pub fn trace(self) -> f64

Computes the matrix trace.

source

pub fn inverse(self) -> DMat4

Computes the matrix inverse.

Panics

Panics if the matrix has no inverse (i.e. has zero determinant).

Examples found in repository?
examples/unproject.rs (line 24)
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn unproject_double_precision(ndc: euler::Vec2) -> euler::DVec3 {
    let projection = dmat4!();
    let inverse_projection = projection.inverse();
    let eye = inverse_projection * dvec4!(dvec2!(ndc), -1, 1);
    let view = euler::DTrs::new(
        dvec3!(1, 0, -1),
        dquat!(1, 0, 0; f64::consts::PI / 2.0),
        dvec3!(1.0),
    )
    .matrix();
    let inverse_view = view.inverse();
    let world = inverse_view * dvec4!(eye.xy(), -1, 0);
    let ray = world.xyz().normalize();
    ray
}
source

pub fn transpose(self) -> DMat4

Returns the matrix transpose.

source

pub fn try_invert(self) -> Option<DMat4>

Attempts to compute the matrix inverse, returning None if the matrix is non-invertible (i.e. has zero determinant).

Trait Implementations§

source§

impl Add<DMat4> for DMat4

§

type Output = DMat4

The resulting type after applying the + operator.
source§

fn add(self, rhs: DMat4) -> Self::Output

Performs the + operation. Read more
source§

impl ApproxEq for DMat4

§

type Epsilon = <Matrix4<f64> as ApproxEq>::Epsilon

Used for specifying relative comparisons.
source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
source§

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
source§

fn relative_ne( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

The inverse of ApproxEq::relative_eq.
source§

fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.
source§

impl AsRef<[[f64; 4]; 4]> for DMat4

source§

fn as_ref(&self) -> &[[f64; 4]; 4]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for DMat4

source§

fn clone(&self) -> DMat4

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for DMat4

source§

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

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

impl Default for DMat4

source§

fn default() -> Self

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

impl Display for DMat4

source§

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

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

impl From<[[f64; 4]; 4]> for DMat4

source§

fn from(array: [[f64; 4]; 4]) -> Self

Converts to this type from the input type.
source§

impl From<DMat2> for DMat4

source§

fn from(arg: DMat2) -> Self

Converts to this type from the input type.
source§

impl From<DMat3> for DMat4

source§

fn from(arg: DMat3) -> Self

Converts to this type from the input type.
source§

impl From<DMat4> for DMat2

source§

fn from(arg: DMat4) -> Self

Converts to this type from the input type.
source§

impl From<DMat4> for DMat3

source§

fn from(arg: DMat4) -> Self

Converts to this type from the input type.
source§

impl From<DMat4> for Mat2

source§

fn from(arg: DMat4) -> Self

Converts to this type from the input type.
source§

impl From<DMat4> for Mat3

source§

fn from(arg: DMat4) -> Self

Converts to this type from the input type.
source§

impl From<DMat4> for Mat4

source§

fn from(arg: DMat4) -> Self

Converts to this type from the input type.
source§

impl From<Mat2> for DMat4

source§

fn from(arg: Mat2) -> Self

Converts to this type from the input type.
source§

impl From<Mat3> for DMat4

source§

fn from(arg: Mat3) -> Self

Converts to this type from the input type.
source§

impl From<Mat4> for DMat4

source§

fn from(arg: Mat4) -> Self

Converts to this type from the input type.
source§

impl From<f32> for DMat4

source§

fn from(arg: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for DMat4

source§

fn from(arg: f64) -> Self

Converts to this type from the input type.
source§

impl Into<[[f64; 4]; 4]> for DMat4

source§

fn into(self) -> [[f64; 4]; 4]

Converts this type into the (usually inferred) input type.
source§

impl Mul<DMat4> for DMat4

§

type Output = DMat4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: DMat4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<DMat4> for f64

§

type Output = DMat4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: DMat4) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<DVec4> for &'a DMat4

§

type Output = DVec4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: DVec4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<DVec4> for DMat4

§

type Output = DVec4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: DVec4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f64> for DMat4

§

type Output = DMat4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
source§

impl PartialEq<DMat4> for DMat4

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<DMat4> for DMat4

§

type Output = DMat4

The resulting type after applying the - operator.
source§

fn sub(self, rhs: DMat4) -> Self::Output

Performs the - operation. Read more
source§

impl Copy for DMat4

source§

impl StructuralPartialEq for DMat4

Auto Trait Implementations§

§

impl RefUnwindSafe for DMat4

§

impl Send for DMat4

§

impl Sync for DMat4

§

impl Unpin for DMat4

§

impl UnwindSafe for DMat4

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<T> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.