Expand description
2D vector (double precision)
Usually used as either a coordinate or a difference of coordinates, but may have some other uses.
Vectors are partially ordered and support component-wise comparison via
methods like lhs.lt(rhs). The PartialOrd trait is not implemented since
it implements lhs ≤ rhs as lhs < rhs || lhs == rhs which is wrong for
vectors (consider for lhs = (0, 1), rhs = (1, 0)).
Tuple Fields
0: f641: f64Implementations
sourceimpl DVec2
impl DVec2
sourcepub const NEG_INFINITY: DVec2 = _
pub const NEG_INFINITY: DVec2 = _
Negative infinity
sourcepub const fn splat(value: f64) -> Self
pub const fn splat(value: f64) -> Self
Constructs a new instance with each element initialized to value.
sourcepub fn complex_mul(self, rhs: Self) -> Self
pub fn complex_mul(self, rhs: Self) -> Self
Multiply two vectors as if they are complex numbers
sourcepub fn complex_div(self, rhs: Self) -> Self
pub fn complex_div(self, rhs: Self) -> Self
Divide by a second vector as if they are complex numbers
sourcepub fn complex_inv(self) -> Self
pub fn complex_inv(self) -> Self
Take the complex reciprocal
sourcepub fn sum_square(self) -> f64
pub fn sum_square(self) -> f64
Return the sum of the square of the terms
sourcepub fn extract<D: Directional>(self, dir: D) -> f64
pub fn extract<D: Directional>(self, dir: D) -> f64
Extract one component, based on a direction
This merely extracts the horizontal or vertical component. It never negates it, even if the axis is reversed.
Trait Implementations
sourceimpl AddAssign<DVec2> for DVec2
impl AddAssign<DVec2> for DVec2
sourcefn add_assign(&mut self, rhs: DVec2)
fn add_assign(&mut self, rhs: DVec2)
Performs the += operation. Read more
sourceimpl AddAssign<f64> for DVec2
impl AddAssign<f64> for DVec2
sourcefn add_assign(&mut self, rhs: f64)
fn add_assign(&mut self, rhs: f64)
Performs the += operation. Read more
sourceimpl ConvApprox<DVec2> for Coord
impl ConvApprox<DVec2> for Coord
sourcefn try_conv_approx(arg: DVec2) -> Result<Self>
fn try_conv_approx(arg: DVec2) -> Result<Self>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl ConvApprox<DVec2> for Offset
impl ConvApprox<DVec2> for Offset
sourcefn try_conv_approx(arg: DVec2) -> Result<Self>
fn try_conv_approx(arg: DVec2) -> Result<Self>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl ConvApprox<DVec2> for Size
impl ConvApprox<DVec2> for Size
sourcefn try_conv_approx(arg: DVec2) -> Result<Self>
fn try_conv_approx(arg: DVec2) -> Result<Self>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl ConvApprox<DVec2> for Vec2
impl ConvApprox<DVec2> for Vec2
sourcefn try_conv_approx(size: DVec2) -> Result<Vec2>
fn try_conv_approx(size: DVec2) -> Result<Vec2>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl ConvFloat<DVec2> for Coord
impl ConvFloat<DVec2> for Coord
sourcefn try_conv_trunc(x: DVec2) -> Result<Self>
fn try_conv_trunc(x: DVec2) -> Result<Self>
Try converting to integer with truncation Read more
sourcefn try_conv_nearest(x: DVec2) -> Result<Self>
fn try_conv_nearest(x: DVec2) -> Result<Self>
Try converting to the nearest integer Read more
sourcefn try_conv_floor(x: DVec2) -> Result<Self>
fn try_conv_floor(x: DVec2) -> Result<Self>
Try converting the floor to an integer Read more
sourcefn try_conv_ceil(x: DVec2) -> Result<Self>
fn try_conv_ceil(x: DVec2) -> Result<Self>
Try convert the ceiling to an integer Read more
sourcefn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
sourcefn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
sourcefn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
sourceimpl ConvFloat<DVec2> for Offset
impl ConvFloat<DVec2> for Offset
sourcefn try_conv_trunc(x: DVec2) -> Result<Self>
fn try_conv_trunc(x: DVec2) -> Result<Self>
Try converting to integer with truncation Read more
sourcefn try_conv_nearest(x: DVec2) -> Result<Self>
fn try_conv_nearest(x: DVec2) -> Result<Self>
Try converting to the nearest integer Read more
sourcefn try_conv_floor(x: DVec2) -> Result<Self>
fn try_conv_floor(x: DVec2) -> Result<Self>
Try converting the floor to an integer Read more
sourcefn try_conv_ceil(x: DVec2) -> Result<Self>
fn try_conv_ceil(x: DVec2) -> Result<Self>
Try convert the ceiling to an integer Read more
sourcefn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
sourcefn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
sourcefn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
sourceimpl ConvFloat<DVec2> for Size
impl ConvFloat<DVec2> for Size
sourcefn try_conv_trunc(x: DVec2) -> Result<Self>
fn try_conv_trunc(x: DVec2) -> Result<Self>
Try converting to integer with truncation Read more
sourcefn try_conv_nearest(x: DVec2) -> Result<Self>
fn try_conv_nearest(x: DVec2) -> Result<Self>
Try converting to the nearest integer Read more
sourcefn try_conv_floor(x: DVec2) -> Result<Self>
fn try_conv_floor(x: DVec2) -> Result<Self>
Try converting the floor to an integer Read more
sourcefn try_conv_ceil(x: DVec2) -> Result<Self>
fn try_conv_ceil(x: DVec2) -> Result<Self>
Try convert the ceiling to an integer Read more
sourcefn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
sourcefn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
sourcefn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
sourceimpl<'de> Deserialize<'de> for DVec2
impl<'de> Deserialize<'de> for DVec2
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<DVec2> for DVec2
impl PartialEq<DVec2> for DVec2
sourceimpl SubAssign<DVec2> for DVec2
impl SubAssign<DVec2> for DVec2
sourcefn sub_assign(&mut self, rhs: DVec2)
fn sub_assign(&mut self, rhs: DVec2)
Performs the -= operation. Read more
sourceimpl SubAssign<f64> for DVec2
impl SubAssign<f64> for DVec2
sourcefn sub_assign(&mut self, rhs: f64)
fn sub_assign(&mut self, rhs: f64)
Performs the -= operation. Read more
impl Copy for DVec2
impl StructuralPartialEq for DVec2
Auto Trait Implementations
impl RefUnwindSafe for DVec2
impl Send for DVec2
impl Sync for DVec2
impl Unpin for DVec2
impl UnwindSafe for DVec2
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
sourcefn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Try approximate conversion from Self to T Read more
sourcefn cast_approx(self) -> T
fn cast_approx(self) -> T
Cast approximately from Self to T Read more
sourceimpl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
sourcefn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
sourcefn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
sourcefn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
sourcefn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
sourcefn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
sourcefn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
sourcefn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
sourceimpl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
sourcefn try_conv_approx(x: S) -> Result<T, Error>
fn try_conv_approx(x: S) -> Result<T, Error>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: S) -> T
fn conv_approx(x: S) -> T
Converting from T to Self, allowing approximation of value Read more