Struct euler::DTrs

source ·
pub struct DTrs {
    pub t: DVec3,
    pub r: DQuat,
    pub s: DVec3,
}
Expand description

Double-precision translation + rotation + non-uniform scale transform.

Fields§

§t: DVec3

Translation vector.

§r: DQuat

Rotation quaternion.

§s: DVec3

Non-uniform scale factor.

Implementations§

source§

impl DTrs

source

pub fn new(t: DVec3, r: DQuat, s: DVec3) -> Self

Full constructor.

Examples found in repository?
examples/unproject.rs (lines 26-30)
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 identity() -> Self

Identity constructor.

source

pub fn matrix(&self) -> DMat4

Returns the equivalent matrix representation for this transform.

Examples found in repository?
examples/unproject.rs (line 31)
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
}

Trait Implementations§

source§

impl ApproxEq for DTrs

§

type Epsilon = <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 Clone for DTrs

source§

fn clone(&self) -> DTrs

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 DTrs

source§

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

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

impl Default for DTrs

source§

fn default() -> Self

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

impl Display for DTrs

source§

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

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

impl PartialEq<DTrs> for DTrs

source§

fn eq(&self, other: &DTrs) -> 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 Copy for DTrs

source§

impl StructuralPartialEq for DTrs

Auto Trait Implementations§

§

impl RefUnwindSafe for DTrs

§

impl Send for DTrs

§

impl Sync for DTrs

§

impl Unpin for DTrs

§

impl UnwindSafe for DTrs

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.