#[repr(C)]pub struct DVec4 {
pub x: f64,
pub y: f64,
pub z: f64,
pub w: f64,
}
Expand description
Double-precision 4D vector.
Fields§
§x: f64
§y: f64
§z: f64
§w: f64
Implementations§
source§impl DVec4
impl DVec4
sourcepub fn xy(self) -> DVec2
pub fn xy(self) -> DVec2
Returns the XY components of the vector.
Examples found in repository?
examples/unproject.rs (line 33)
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 xyz(self) -> DVec3
pub fn xyz(self) -> DVec3
Returns the XYZ components of the vector.
Examples found in repository?
examples/unproject.rs (line 34)
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 AddAssign<DVec4> for DVec4
impl AddAssign<DVec4> for DVec4
source§fn add_assign(&mut self, rhs: DVec4)
fn add_assign(&mut self, rhs: DVec4)
Performs the
+=
operation. Read moresource§impl ApproxEq for DVec4
impl ApproxEq for DVec4
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 DivAssign<f64> for DVec4
impl DivAssign<f64> for DVec4
source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/=
operation. Read moresource§impl MulAssign<f64> for DVec4
impl MulAssign<f64> for DVec4
source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*=
operation. Read moresource§impl PartialEq<DVec4> for DVec4
impl PartialEq<DVec4> for DVec4
source§impl SubAssign<DVec4> for DVec4
impl SubAssign<DVec4> for DVec4
source§fn sub_assign(&mut self, rhs: DVec4)
fn sub_assign(&mut self, rhs: DVec4)
Performs the
-=
operation. Read moreimpl Copy for DVec4
impl StructuralPartialEq for DVec4
Auto Trait Implementations§
impl RefUnwindSafe for DVec4
impl Send for DVec4
impl Sync for DVec4
impl Unpin for DVec4
impl UnwindSafe for DVec4
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