#[repr(C)]pub struct DVec3 {
pub x: f64,
pub y: f64,
pub z: f64,
}
Expand description
Double-precision 3D vector.
Fields§
§x: f64
§y: f64
§z: f64
Implementations§
source§impl DVec3
impl DVec3
sourcepub fn squared_length(self) -> f64
pub fn squared_length(self) -> f64
Returns the squared length of the vector.
sourcepub fn normalize(self) -> DVec3
pub fn normalize(self) -> DVec3
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<DVec3> for DVec3
impl AddAssign<DVec3> for DVec3
source§fn add_assign(&mut self, rhs: DVec3)
fn add_assign(&mut self, rhs: DVec3)
Performs the
+=
operation. Read moresource§impl ApproxEq for DVec3
impl ApproxEq for DVec3
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 DVec3
impl DivAssign<f64> for DVec3
source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/=
operation. Read moresource§impl MulAssign<f64> for DVec3
impl MulAssign<f64> for DVec3
source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*=
operation. Read moresource§impl PartialEq<DVec3> for DVec3
impl PartialEq<DVec3> for DVec3
source§impl SubAssign<DVec3> for DVec3
impl SubAssign<DVec3> for DVec3
source§fn sub_assign(&mut self, rhs: DVec3)
fn sub_assign(&mut self, rhs: DVec3)
Performs the
-=
operation. Read moreimpl Copy for DVec3
impl StructuralPartialEq for DVec3
Auto Trait Implementations§
impl RefUnwindSafe for DVec3
impl Send for DVec3
impl Sync for DVec3
impl Unpin for DVec3
impl UnwindSafe for DVec3
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