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
impl DTrs
sourcepub fn new(t: DVec3, r: DQuat, s: DVec3) -> Self
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
}
sourcepub fn matrix(&self) -> DMat4
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
impl ApproxEq for DTrs
source§fn default_epsilon() -> Self::Epsilon
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
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
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
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
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§impl PartialEq<DTrs> for DTrs
impl PartialEq<DTrs> for DTrs
impl Copy for DTrs
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> 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