#[repr(C)]pub struct DVec2(pub f64, pub f64);Expand description
2D vector (double precision)
Usually used as either a coordinate or a difference of coordinates, but may have some other uses.
DVec2 implements PartialOrd such that the comparison must be true of
all components: for example a < b == a.0 < b.0 && a.1 < b.1.
If c == DVec2(0, 1) and d == DVec2(1, 0) then
c != d && !(c < d) && !(c > d). DVec2 does not implement Ord.
Tuple Fields§
§0: f64§1: f64Implementations§
Source§impl DVec2
impl DVec2
Sourcepub const NEG_INFINITY: DVec2
pub const NEG_INFINITY: DVec2
Negative infinity
Sourcepub const fn splat(value: f64) -> DVec2
pub const fn splat(value: f64) -> DVec2
Constructs a new instance with each element initialized to value.
Sourcepub fn clamp(self, min: DVec2, max: DVec2) -> DVec2
pub fn clamp(self, min: DVec2, max: DVec2) -> DVec2
Restrict a value to a certain interval unless it is NaN
Returns max if self is greater than max, and min if
self is less than min. Otherwise this returns self.
Note that this function returns NaN if the initial value was NaN as well.
§Panics
Panics if min > max, min is NaN, or max is NaN.
Sourcepub fn complex_mul(self, rhs: DVec2) -> DVec2
pub fn complex_mul(self, rhs: DVec2) -> DVec2
Multiply two vectors as if they are complex numbers
Sourcepub fn complex_div(self, rhs: DVec2) -> DVec2
pub fn complex_div(self, rhs: DVec2) -> DVec2
Divide by a second vector as if they are complex numbers
Sourcepub fn complex_inv(self) -> DVec2
pub fn complex_inv(self) -> DVec2
Take the complex reciprocal
If both components are zero then the result will not be finite.
Sourcepub fn sum_square(self) -> f64
pub fn sum_square(self) -> f64
Return the sum of the square of the terms
Sourcepub fn distance_l1(self) -> f64
pub fn distance_l1(self) -> f64
Return the L1 (rectilinear / taxicab) distance
Sourcepub fn distance_l_inf(self) -> f64
pub fn distance_l_inf(self) -> f64
Return the L-inf (max) distance
Sourcepub fn extract<D>(self, dir: D) -> f64where
D: Directional,
pub fn extract<D>(self, dir: D) -> f64where
D: Directional,
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§
Source§impl AddAssign<DVec2> for Affine
impl AddAssign<DVec2> for Affine
Source§fn add_assign(&mut self, rhs: DVec2)
fn add_assign(&mut self, rhs: DVec2)
+= operation. Read moreSource§impl AddAssign<f64> for DVec2
impl AddAssign<f64> for DVec2
Source§fn add_assign(&mut self, rhs: f64)
fn add_assign(&mut self, rhs: f64)
+= operation. Read moreSource§impl AddAssign for DVec2
impl AddAssign for DVec2
Source§fn add_assign(&mut self, rhs: DVec2)
fn add_assign(&mut self, rhs: DVec2)
+= operation. Read moreSource§impl ConvApprox<DVec2> for Coord
impl ConvApprox<DVec2> for Coord
Source§impl ConvApprox<DVec2> for Offset
impl ConvApprox<DVec2> for Offset
Source§impl ConvApprox<DVec2> for Size
impl ConvApprox<DVec2> for Size
Source§impl ConvApprox<DVec2> for Vec2
impl ConvApprox<DVec2> for Vec2
Source§impl ConvFloat<DVec2> for Coord
impl ConvFloat<DVec2> for Coord
Source§fn try_conv_trunc(x: DVec2) -> Result<Coord, Error>
fn try_conv_trunc(x: DVec2) -> Result<Coord, Error>
Source§fn try_conv_nearest(x: DVec2) -> Result<Coord, Error>
fn try_conv_nearest(x: DVec2) -> Result<Coord, Error>
Source§fn try_conv_floor(x: DVec2) -> Result<Coord, Error>
fn try_conv_floor(x: DVec2) -> Result<Coord, Error>
Source§fn try_conv_ceil(x: DVec2) -> Result<Coord, Error>
fn try_conv_ceil(x: DVec2) -> Result<Coord, Error>
Source§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Source§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Source§fn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Source§impl ConvFloat<DVec2> for Offset
impl ConvFloat<DVec2> for Offset
Source§fn try_conv_trunc(x: DVec2) -> Result<Offset, Error>
fn try_conv_trunc(x: DVec2) -> Result<Offset, Error>
Source§fn try_conv_nearest(x: DVec2) -> Result<Offset, Error>
fn try_conv_nearest(x: DVec2) -> Result<Offset, Error>
Source§fn try_conv_floor(x: DVec2) -> Result<Offset, Error>
fn try_conv_floor(x: DVec2) -> Result<Offset, Error>
Source§fn try_conv_ceil(x: DVec2) -> Result<Offset, Error>
fn try_conv_ceil(x: DVec2) -> Result<Offset, Error>
Source§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Source§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Source§fn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Source§impl ConvFloat<DVec2> for Size
impl ConvFloat<DVec2> for Size
Source§fn try_conv_trunc(x: DVec2) -> Result<Size, Error>
fn try_conv_trunc(x: DVec2) -> Result<Size, Error>
Source§fn try_conv_nearest(x: DVec2) -> Result<Size, Error>
fn try_conv_nearest(x: DVec2) -> Result<Size, Error>
Source§fn try_conv_floor(x: DVec2) -> Result<Size, Error>
fn try_conv_floor(x: DVec2) -> Result<Size, Error>
Source§fn try_conv_ceil(x: DVec2) -> Result<Size, Error>
fn try_conv_ceil(x: DVec2) -> Result<Size, Error>
Source§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Source§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Source§fn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Source§impl<'de> Deserialize<'de> for DVec2
impl<'de> Deserialize<'de> for DVec2
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DVec2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DVec2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl DivAssign<f64> for DVec2
impl DivAssign<f64> for DVec2
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
/= operation. Read moreSource§impl MulAssign<f64> for DVec2
impl MulAssign<f64> for DVec2
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
*= operation. Read moreSource§impl MulAssign for DVec2
impl MulAssign for DVec2
Source§fn mul_assign(&mut self, rhs: DVec2)
fn mul_assign(&mut self, rhs: DVec2)
*= operation. Read moreSource§impl PartialOrd<Coord> for DVec2
impl PartialOrd<Coord> for DVec2
Source§impl PartialOrd for DVec2
impl PartialOrd for DVec2
Source§impl Serialize for DVec2
impl Serialize for DVec2
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl SubAssign<DVec2> for Affine
impl SubAssign<DVec2> for Affine
Source§fn sub_assign(&mut self, rhs: DVec2)
fn sub_assign(&mut self, rhs: DVec2)
-= operation. Read moreSource§impl SubAssign<f64> for DVec2
impl SubAssign<f64> for DVec2
Source§fn sub_assign(&mut self, rhs: f64)
fn sub_assign(&mut self, rhs: f64)
-= operation. Read moreSource§impl SubAssign for DVec2
impl SubAssign for DVec2
Source§fn sub_assign(&mut self, rhs: DVec2)
fn sub_assign(&mut self, rhs: DVec2)
-= operation. Read moreimpl Copy for DVec2
impl StructuralPartialEq for DVec2
Auto Trait Implementations§
impl Freeze for DVec2
impl RefUnwindSafe for DVec2
impl Send for DVec2
impl Sync for DVec2
impl Unpin for DVec2
impl UnwindSafe for DVec2
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
Source§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
Source§fn try_conv_approx(x: S) -> Result<T, Error>
fn try_conv_approx(x: S) -> Result<T, Error>
Source§fn conv_approx(x: S) -> T
fn conv_approx(x: S) -> T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().