pub struct Vector<const N: usize, T, A: Alignment>(/* private fields */)
where
Length<N>: SupportedLength,
T: Scalar;Expand description
A generic vector type.
Vector is the generic form of:
Vector is generic over:
To initialize vectors, use the macros vec2,
vec3, vec4. To initialize a vector of an
unknown length, use Vector::from_array.
§Guarantees
Vector<N, T, A> represents N consecutive values of T followed by
optional padding due to alignment.
Padding bytes are initialized and accept any bit-pattern. It is sound to
store any bit-pattern in padding, and it is unsound to assume that
padding contains valid values of T unless T accepts all bit-patterns.
-
Vector<N, T, Unaligned>: has no padding, has no additional alignment. -
Vector<2, T, Aligned>: has no padding, may have additional alignment. -
Vector<3, T, Aligned>: may have one padding element, may have additional alignment. -
Vector<4, T, Aligned>: has no padding, may have additional alignment.
Vectors of scalar types with the same Scalar::Repr are guaranteed to
have compatible memory layouts, unless Repr = (). They are guaranteed to
have the same size and element positions, but their alignment may differ.
Types containing Vector are not guaranteed to have the same memory
layout as types containing equivalent arrays. For example, even though
Vec2U<T> and [T; 2] have the same memory layout, Option<Vec2U<T>> and
Option<[T; 2]> may not.
Implementations§
Source§impl<const N: usize, T, A: Alignment> Vector<N, T, A>
impl<const N: usize, T, A: Alignment> Vector<N, T, A>
Sourcepub const fn from_array(array: [T; N]) -> Self
pub const fn from_array(array: [T; N]) -> Self
Sourcepub const fn splat(value: T) -> Self
pub const fn splat(value: T) -> Self
Creates a vector with all components set to the given value.
Sourcepub fn from_fn<F>(f: F) -> Self
pub fn from_fn<F>(f: F) -> Self
Creates a vector by calling function f for each component index.
Equivalent to (f(0), f(1), f(2), ...).
Sourcepub const fn to_alignment<A2: Alignment>(self) -> Vector<N, T, A2>
pub const fn to_alignment<A2: Alignment>(self) -> Vector<N, T, A2>
Converts the vector to the specified alignment.
See Alignment for more information.
Sourcepub const fn as_array_ref(&self) -> &[T; N]
pub const fn as_array_ref(&self) -> &[T; N]
Returns a reference to the vector’s components.
Sourcepub const fn as_array_mut(&mut self) -> &mut [T; N]
pub const fn as_array_mut(&mut self) -> &mut [T; N]
Returns a mutable reference to the vector’s components.
Sourcepub fn iter(self) -> IntoIter<T, N>
pub fn iter(self) -> IntoIter<T, N>
Returns an iterator over the vector’s components.
This method returns an iterator over T and not &T. to iterate over
references use vec.as_array_ref().iter().
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns an iterator over mutable references to the vector’s components.
Sourcepub fn map<T2, F>(self, f: F) -> Vector<N, T2, A>
pub fn map<T2, F>(self, f: F) -> Vector<N, T2, A>
Creates a vector by calling function f for each component of the input
vector.
Equivalent to (f(vec.x), f(vec.y), f(vec.z), ...).
§Example
use ggmath::{Vec3, vec3};
let vec: Vec3<f32> = vec3!(1.0, 2.0, 3.0);
assert_eq!(vec.map(|x| x * 2.0), vec3!(2.0, 4.0, 6.0));
assert_eq!(vec.map(|x| x.is_sign_negative()), vec3!(false, false, false));Sourcepub fn reverse(self) -> Self
pub fn reverse(self) -> Self
Returns the vector’s components in reverse order.
§Example
use ggmath::{Vec3, vec3};
let vec: Vec3<f32> = vec3!(1.0, 2.0, 3.0);
assert_eq!(vec.reverse(), vec3!(3.0, 2.0, 1.0));Sourcepub fn eq_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialEq,
pub fn eq_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialEq,
Returns a mask where each component is true if the corresponding
components of self and other are equal.
Equivalent to (self.x == other.x, self.y == other.y, ...).
Sourcepub fn ne_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialEq,
pub fn ne_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialEq,
Returns a mask where each component is true if the corresponding
components of self and other are not equal.
Equivalent to (self.x != other.x, self.y != other.y, ...).
Sourcepub fn lt_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
pub fn lt_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
Returns a mask where each component is true if the corresponding
component of self is less than the corresponding component of other.
Equivalent to (self.x < other.x, self.y < other.y, ...).
Sourcepub fn gt_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
pub fn gt_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
Returns a mask where each component is true if the corresponding
component of self is greater than the corresponding component of
other.
Equivalent to (self.x > other.x, self.y > other.y, ...).
Sourcepub fn le_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
pub fn le_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
Returns a mask where each component is true if the corresponding
component of self is less than or equal to the corresponding component
of other.
Equivalent to (self.x <= other.x, self.y <= other.y, ...).
Sourcepub fn ge_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
pub fn ge_mask(self, other: Self) -> Mask<N, T, A>where
T: PartialOrd,
Returns a mask where each component is true if the corresponding
component of self is greater than or equal to the corresponding
component of other.
Equivalent to (self.x >= other.x, self.y >= other.y, ...).
Sourcepub const unsafe fn to_repr<T2>(self) -> Vector<N, T2, A>
pub const unsafe fn to_repr<T2>(self) -> Vector<N, T2, A>
Reinterprets the bits of the vector to a different scalar type.
The two scalar types must have compatible memory layouts. This is enforced via trait bounds in this function’s signature.
This function is used to make SIMD optimizations in implementations of Scalar.
§Safety
The components of the input must be valid for the output vector type.
For example, when converting vectors from u8 to bool the
input components must be either 0 or 1.
The optional padding does not need to be a valid value of T2.
Source§impl<const N: usize, A: Alignment> Vector<N, f32, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, f32, A>where
Length<N>: SupportedLength,
Sourcepub fn nan_mask(self) -> Mask<N, f32, A>
pub fn nan_mask(self) -> Mask<N, f32, A>
Returns a mask where each component is true if the
corresponding component of self is NaN (Not a Number).
Equivalent to (self.x.is_nan(), self.y.is_nan(), ...).
Sourcepub fn is_finite(self) -> bool
pub fn is_finite(self) -> bool
Returns true if all of the vector’s components are finite.
Finite corresponds to not NaN and not positive/negative infinity.
Sourcepub fn finite_mask(self) -> Mask<N, f32, A>
pub fn finite_mask(self) -> Mask<N, f32, A>
Returns a mask where each component is true if the
corresponding component of self is finite.
Finite corresponds to not NaN and not positive/negative infinity.
Equivalent to (self.x.is_finite(), self.y.is_finite(), ...).
Sourcepub fn sign_positive_mask(self) -> Mask<N, f32, A>
pub fn sign_positive_mask(self) -> Mask<N, f32, A>
Returns a mask where each component is true if the
corresponding component of self has a positive sign.
Equivalent to
(self.x.is_sign_positive(), self.y.is_sign_positive(), ...).
Sourcepub fn sign_negative_mask(self) -> Mask<N, f32, A>
pub fn sign_negative_mask(self) -> Mask<N, f32, A>
Returns a mask where each component is true if the
corresponding component of self has a negative sign.
Equivalent to
(self.x.is_sign_negative(), self.y.is_sign_negative(), ...).
Sourcepub fn element_sum(self) -> f32
pub fn element_sum(self) -> f32
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
The order of addition is unspecified and may differ between target architectures.
Sourcepub fn element_product(self) -> f32
pub fn element_product(self) -> f32
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
The order of multiplication is unspecified and may differ between target architectures.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN, or if min > max.
Sourcepub fn max_element(self) -> f32
pub fn max_element(self) -> f32
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn min_element(self) -> f32
pub fn min_element(self) -> f32
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
1.0if the component is positive,+0.0orINFINITY-1.0if the component is negative,-0.0orNEG_INFINITY- NaN if the component is NaN
Sourcepub fn copysign(self, sign: Self) -> Self
pub fn copysign(self, sign: Self) -> Self
Returns a vector with the magnitudes of self and the signs of sign.
Equivalent to (self.x.copysign(sign.x), self.y.copysign(sign.y), ...).
Sourcepub fn length_squared(self) -> f32
pub fn length_squared(self) -> f32
Computes the squared length/magnitude of the vector.
Sourcepub fn distance_squared(self, other: Self) -> f32
pub fn distance_squared(self, other: Self) -> f32
Computes the squared Euclidean distance between self and other.
Sourcepub fn lerp(self, other: Self, t: f32) -> Self
pub fn lerp(self, other: Self, t: f32) -> Self
Computes the linear interpolation between self and other based on
the value t.
When t is 0.0, the result is self. When t is 1.0, the result
is rhs. When t is outside of the range [0.0, 1.0], the result is
linearly extrapolated.
Sourcepub fn midpoint(self, other: Self) -> Self
pub fn midpoint(self, other: Self) -> Self
Computes the middle point between self and other.
Equivalent to self.lerp(other, 0.5) but is cheaper to compute and may
return a slightly different value.
Sourcepub fn is_normalized(self) -> bool
pub fn is_normalized(self) -> bool
Returns whether the vector has the length 1.0 or not.
This function uses a precision threshold of approximately 1e-4.
Sourcepub fn project_onto(self, other: Self) -> Self
pub fn project_onto(self, other: Self) -> Self
Returns the vector projection of self onto other.
other must not be a zero vector.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is a zero vector.
Sourcepub fn project_onto_normalized(self, other: Self) -> Self
pub fn project_onto_normalized(self, other: Self) -> Self
Returns the vector projection of self onto other.
other must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is not normalized.
Sourcepub fn reject_from(self, other: Self) -> Self
pub fn reject_from(self, other: Self) -> Self
Returns the vector rejection of self from other.
Corresponds to a vector pointing at self from the projection of self
onto other, or simply self - self.project_onto(other).
other must not be a zero vector.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is a zero vector.
Sourcepub fn reject_from_normalized(self, other: Self) -> Self
pub fn reject_from_normalized(self, other: Self) -> Self
Returns the vector rejection of self from other.
Corresponds to a vector pointing at self from the projection of self
onto other, or simply self - self.project_onto(other).
other must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is not normalized.
Sourcepub fn reflect(self, normal: Self) -> Self
pub fn reflect(self, normal: Self) -> Self
Returns the reflection of self through normal.
normal must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if normal is not normalized.
§Example
use ggmath::{Vec2, vec2};
let vec: Vec2<f32> = vec2!(1.0, 2.0);
assert_eq!(vec.reflect(Vec2::X), vec2!(-1.0, 2.0));Source§impl<A: Alignment> Vector<3, f32, A>
impl<A: Alignment> Vector<3, f32, A>
Sourcepub fn any_orthogonal_vector(self) -> Self
pub fn any_orthogonal_vector(self) -> Self
Returns some vector that is orthogonal to self.
self must be finite and not a zero vector.
The result is not necessarily normalized. For that use
Self::any_orthonormal_vector() instead.
Sourcepub fn any_orthonormal_vector(self) -> Self
pub fn any_orthonormal_vector(self) -> Self
Returns some unit vector that is orthogonal to self.
self must normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if self is not normalized.
Sourcepub fn any_orthonormal_pair(self) -> (Self, Self)
pub fn any_orthonormal_pair(self) -> (Self, Self)
Returns two unit vectors that are orthogonal to self and to each
other.
Together with self, they form an orthonormal basis where the three
vectors are all orthogonal to each other and are normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if self is not normalized.
Source§impl<const N: usize, A: Alignment> Vector<N, f32, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, f32, A>where
Length<N>: SupportedLength,
Sourcepub fn fract(self) -> Self
pub fn fract(self) -> Self
Returns the fractional part of the vector.
Equivalent to self - self.trunc().
Sourcepub fn mul_add(self, a: Self, b: Self) -> Self
pub fn mul_add(self, a: Self, b: Self) -> Self
Fused multiply-add. Computes (self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add.
Using mul_add is slower than an unfused multiply-add on most target
architectures.
§Precision
The result of this operation is guaranteed to be the rounded
infinite-precision result. It is specified by IEEE 754 as
fusedMultiplyAdd and guaranteed not to change.
Sourcepub fn div_euclid(self, rhs: Self) -> Self
pub fn div_euclid(self, rhs: Self) -> Self
Euclidiean Division.
Equivalent to (self.x.div_euclid(rhs.x), self.y.div_euclid(rhs.y), ...).
§Precision
The result of this operation is guaranteed to be the rounded infinite-precision result.
Sourcepub fn rem_euclid(self, rhs: Self) -> Self
pub fn rem_euclid(self, rhs: Self) -> Self
Euclidiean Remainder.
Equivalent to (self.x.rem_euclid(rhs.x), self.y.rem_euclid(rhs.y), ...).
§Precision
The result of this operation is guaranteed to be the rounded infinite-precision result.
Sourcepub fn sqrt(self) -> Self
pub fn sqrt(self) -> Self
Returns the square root of the vector’s components.
Equivalent to (self.x.sqrt(), self.y.sqrt(), ...).
§Precision
The result of this operation is guaranteed to be the rounded
infinite-precision result. It is specified by IEEE 754 as squareRoot
and guaranteed not to change.
Sourcepub fn sin(self) -> Self
pub fn sin(self) -> Self
Computes the sine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn cos(self) -> Self
pub fn cos(self) -> Self
Computes the cosine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn tan(self) -> Self
pub fn tan(self) -> Self
Computes the tangent of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn asin(self) -> Self
pub fn asin(self) -> Self
Computes the arcsine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn acos(self) -> Self
pub fn acos(self) -> Self
Computes the arccosine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn atan(self) -> Self
pub fn atan(self) -> Self
Computes the arctangent of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn sin_cos(self) -> (Self, Self)
pub fn sin_cos(self) -> (Self, Self)
Simultaneously computes the sine and cosine of the vector’s components.
Equivalent to (self.sin(), self.cos()) but may be more performant and
might return a slightly different value.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn distance(self, other: Self) -> f32
pub fn distance(self, other: Self) -> f32
Computes the Euclidean distance between self and other.
Sourcepub fn move_towards(self, other: Self, max_delta: f32) -> Self
pub fn move_towards(self, other: Self, max_delta: f32) -> Self
Moves self towards other by at most max_delta.
When max_delta is 0.0, the result is self. When max_delta is
equal to or greater than self.distance(other), the result is other.
Sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
Returns a vector with the direction of self and length 1.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if the input is a zero vector, or if the result is non finite or zero.
Sourcepub fn try_normalize(self) -> Option<Self>
pub fn try_normalize(self) -> Option<Self>
Returns Self::normalize, or None if the input is zero or if the
result is non finite or zero.
Sourcepub fn normalize_or(self, fallback: Self) -> Self
pub fn normalize_or(self, fallback: Self) -> Self
Returns Self::normalize, or fallback if the input is zero or if
the result is non finite or zero.
Sourcepub fn normalize_or_zero(self) -> Self
pub fn normalize_or_zero(self) -> Self
Returns Self::normalize, or a zero vector if the input is zero or if
the result is non finite.
Sourcepub fn normalize_and_length(self) -> (Self, f32)
pub fn normalize_and_length(self) -> (Self, f32)
Simultaneously computes Self::normalize and Self::length.
If self is a zero vector, the result is (Self::ZERO, 0.0).
Sourcepub fn with_max_length(self, max: f32) -> Self
pub fn with_max_length(self, max: f32) -> Self
Returns the input vector but with a length of no more than max.
§Panics
When assertions are enabled (see the crate documentation):
Panics if max is negative.
Sourcepub fn with_min_length(self, min: f32) -> Self
pub fn with_min_length(self, min: f32) -> Self
Returns the input vector but with a length of no less than min.
§Panics
When assertions are enabled (see the crate documentation):
Panics if min is negative.
Sourcepub fn clamp_length(self, min: f32, max: f32) -> Self
pub fn clamp_length(self, min: f32, max: f32) -> Self
Returns the input vector buth with a length of no less than min and no
more than max.
§Panics
When assertions are enabled (see the crate documentation):
Panics if min > max, or if min or max are negative.
Sourcepub fn angle_between(self, other: Self) -> f32
pub fn angle_between(self, other: Self) -> f32
Returns the angle (in radians) between self and other in the range
[0, +π].
The vectors do not need to be unit vectors but they do need to be non-zero.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn exp(self) -> Self
pub fn exp(self) -> Self
Computes the exponential function e^self for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn exp2(self) -> Self
pub fn exp2(self) -> Self
Computes 2^self for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn ln(self) -> Self
pub fn ln(self) -> Self
Computes the natural logarithm for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn log2(self) -> Self
pub fn log2(self) -> Self
Computes the base 2 logarithm for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn powf(self, n: f32) -> Self
pub fn powf(self, n: f32) -> Self
Computes self^n for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn refract(self, normal: Self, eta: f32) -> Self
pub fn refract(self, normal: Self, eta: f32) -> Self
Returns the vector refraction of self through normal and eta.
eta is the incident refraction-index divided by the transmitted
refraction-index.
When total internal reflection occurs, the result is a zero vector.
self and normal must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if self or normal are not normalized.
Source§impl<A: Alignment> Vector<3, f32, A>
impl<A: Alignment> Vector<3, f32, A>
Sourcepub fn rotate_x(self, angle: f32) -> Self
pub fn rotate_x(self, angle: f32) -> Self
Rotates self around the x axis by angle (in radians).
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Source§impl<const N: usize, A: Alignment> Vector<N, f64, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, f64, A>where
Length<N>: SupportedLength,
Sourcepub fn nan_mask(self) -> Mask<N, f64, A>
pub fn nan_mask(self) -> Mask<N, f64, A>
Returns a mask where each component is true if the
corresponding component of self is NaN (Not a Number).
Equivalent to (self.x.is_nan(), self.y.is_nan(), ...).
Sourcepub fn is_finite(self) -> bool
pub fn is_finite(self) -> bool
Returns true if all of the vector’s components are finite.
Finite corresponds to not NaN and not positive/negative infinity.
Sourcepub fn finite_mask(self) -> Mask<N, f64, A>
pub fn finite_mask(self) -> Mask<N, f64, A>
Returns a mask where each component is true if the
corresponding component of self is finite.
Finite corresponds to not NaN and not positive/negative infinity.
Equivalent to (self.x.is_finite(), self.y.is_finite(), ...).
Sourcepub fn sign_positive_mask(self) -> Mask<N, f64, A>
pub fn sign_positive_mask(self) -> Mask<N, f64, A>
Returns a mask where each component is true if the
corresponding component of self has a positive sign.
Equivalent to
(self.x.is_sign_positive(), self.y.is_sign_positive(), ...).
Sourcepub fn sign_negative_mask(self) -> Mask<N, f64, A>
pub fn sign_negative_mask(self) -> Mask<N, f64, A>
Returns a mask where each component is true if the
corresponding component of self has a negative sign.
Equivalent to
(self.x.is_sign_negative(), self.y.is_sign_negative(), ...).
Sourcepub fn element_sum(self) -> f64
pub fn element_sum(self) -> f64
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
The order of addition is unspecified and may differ between target architectures.
Sourcepub fn element_product(self) -> f64
pub fn element_product(self) -> f64
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
The order of multiplication is unspecified and may differ between target architectures.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN, or if min > max.
Sourcepub fn max_element(self) -> f64
pub fn max_element(self) -> f64
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn min_element(self) -> f64
pub fn min_element(self) -> f64
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
This function is not consistent with IEEE semantics in regards to NaN
propagation and handling of -0.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if any input is NaN.
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
1.0if the component is positive,+0.0orINFINITY-1.0if the component is negative,-0.0orNEG_INFINITY- NaN if the component is NaN
Sourcepub fn copysign(self, sign: Self) -> Self
pub fn copysign(self, sign: Self) -> Self
Returns a vector with the magnitudes of self and the signs of sign.
Equivalent to (self.x.copysign(sign.x), self.y.copysign(sign.y), ...).
Sourcepub fn length_squared(self) -> f64
pub fn length_squared(self) -> f64
Computes the squared length/magnitude of the vector.
Sourcepub fn distance_squared(self, other: Self) -> f64
pub fn distance_squared(self, other: Self) -> f64
Computes the squared Euclidean distance between self and other.
Sourcepub fn lerp(self, other: Self, t: f64) -> Self
pub fn lerp(self, other: Self, t: f64) -> Self
Computes the linear interpolation between self and other based on
the value t.
When t is 0.0, the result is self. When t is 1.0, the result
is rhs. When t is outside of the range [0.0, 1.0], the result is
linearly extrapolated.
Sourcepub fn midpoint(self, other: Self) -> Self
pub fn midpoint(self, other: Self) -> Self
Computes the middle point between self and other.
Equivalent to self.lerp(other, 0.5) but is cheaper to compute and may
return a slightly different value.
Sourcepub fn is_normalized(self) -> bool
pub fn is_normalized(self) -> bool
Returns whether the vector has the length 1.0 or not.
This function uses a precision threshold of approximately 1e-4.
Sourcepub fn project_onto(self, other: Self) -> Self
pub fn project_onto(self, other: Self) -> Self
Returns the vector projection of self onto other.
other must not be a zero vector.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is a zero vector.
Sourcepub fn project_onto_normalized(self, other: Self) -> Self
pub fn project_onto_normalized(self, other: Self) -> Self
Returns the vector projection of self onto other.
other must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is not normalized.
Sourcepub fn reject_from(self, other: Self) -> Self
pub fn reject_from(self, other: Self) -> Self
Returns the vector rejection of self from other.
Corresponds to a vector pointing at self from the projection of self
onto other, or simply self - self.project_onto(other).
other must not be a zero vector.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is a zero vector.
Sourcepub fn reject_from_normalized(self, other: Self) -> Self
pub fn reject_from_normalized(self, other: Self) -> Self
Returns the vector rejection of self from other.
Corresponds to a vector pointing at self from the projection of self
onto other, or simply self - self.project_onto(other).
other must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if other is not normalized.
Sourcepub fn reflect(self, normal: Self) -> Self
pub fn reflect(self, normal: Self) -> Self
Returns the reflection of self through normal.
normal must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if normal is not normalized.
§Example
use ggmath::{Vec2, vec2};
let vec: Vec2<f32> = vec2!(1.0, 2.0);
assert_eq!(vec.reflect(Vec2::X), vec2!(-1.0, 2.0));Source§impl<A: Alignment> Vector<3, f64, A>
impl<A: Alignment> Vector<3, f64, A>
Sourcepub fn any_orthogonal_vector(self) -> Self
pub fn any_orthogonal_vector(self) -> Self
Returns some vector that is orthogonal to self.
self must be finite and not a zero vector.
The result is not necessarily normalized. For that use
Self::any_orthonormal_vector() instead.
Sourcepub fn any_orthonormal_vector(self) -> Self
pub fn any_orthonormal_vector(self) -> Self
Returns some unit vector that is orthogonal to self.
self must normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if self is not normalized.
Sourcepub fn any_orthonormal_pair(self) -> (Self, Self)
pub fn any_orthonormal_pair(self) -> (Self, Self)
Returns two unit vectors that are orthogonal to self and to each
other.
Together with self, they form an orthonormal basis where the three
vectors are all orthogonal to each other and are normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if self is not normalized.
Source§impl<const N: usize, A: Alignment> Vector<N, f64, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, f64, A>where
Length<N>: SupportedLength,
Sourcepub fn fract(self) -> Self
pub fn fract(self) -> Self
Returns the fractional part of the vector.
Equivalent to self - self.trunc().
Sourcepub fn mul_add(self, a: Self, b: Self) -> Self
pub fn mul_add(self, a: Self, b: Self) -> Self
Fused multiply-add. Computes (self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add.
Using mul_add is slower than an unfused multiply-add on most target
architectures.
§Precision
The result of this operation is guaranteed to be the rounded
infinite-precision result. It is specified by IEEE 754 as
fusedMultiplyAdd and guaranteed not to change.
Sourcepub fn div_euclid(self, rhs: Self) -> Self
pub fn div_euclid(self, rhs: Self) -> Self
Euclidiean Division.
Equivalent to (self.x.div_euclid(rhs.x), self.y.div_euclid(rhs.y), ...).
§Precision
The result of this operation is guaranteed to be the rounded infinite-precision result.
Sourcepub fn rem_euclid(self, rhs: Self) -> Self
pub fn rem_euclid(self, rhs: Self) -> Self
Euclidiean Remainder.
Equivalent to (self.x.rem_euclid(rhs.x), self.y.rem_euclid(rhs.y), ...).
§Precision
The result of this operation is guaranteed to be the rounded infinite-precision result.
Sourcepub fn sqrt(self) -> Self
pub fn sqrt(self) -> Self
Returns the square root of the vector’s components.
Equivalent to (self.x.sqrt(), self.y.sqrt(), ...).
§Precision
The result of this operation is guaranteed to be the rounded
infinite-precision result. It is specified by IEEE 754 as squareRoot
and guaranteed not to change.
Sourcepub fn sin(self) -> Self
pub fn sin(self) -> Self
Computes the sine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn cos(self) -> Self
pub fn cos(self) -> Self
Computes the cosine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn tan(self) -> Self
pub fn tan(self) -> Self
Computes the tangent of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn asin(self) -> Self
pub fn asin(self) -> Self
Computes the arcsine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn acos(self) -> Self
pub fn acos(self) -> Self
Computes the arccosine of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn atan(self) -> Self
pub fn atan(self) -> Self
Computes the arctangent of the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn sin_cos(self) -> (Self, Self)
pub fn sin_cos(self) -> (Self, Self)
Simultaneously computes the sine and cosine of the vector’s components.
Equivalent to (self.sin(), self.cos()) but may be more performant and
might return a slightly different value.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn distance(self, other: Self) -> f64
pub fn distance(self, other: Self) -> f64
Computes the Euclidean distance between self and other.
Sourcepub fn move_towards(self, other: Self, max_delta: f64) -> Self
pub fn move_towards(self, other: Self, max_delta: f64) -> Self
Moves self towards other by at most max_delta.
When max_delta is 0.0, the result is self. When max_delta is
equal to or greater than self.distance(other), the result is other.
Sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
Returns a vector with the direction of self and length 1.0.
§Panics
When assertions are enabled (see the crate documentation):
Panics if the input is a zero vector, or if the result is non finite or zero.
Sourcepub fn try_normalize(self) -> Option<Self>
pub fn try_normalize(self) -> Option<Self>
Returns Self::normalize, or None if the input is zero or if the
result is non finite or zero.
Sourcepub fn normalize_or(self, fallback: Self) -> Self
pub fn normalize_or(self, fallback: Self) -> Self
Returns Self::normalize, or fallback if the input is zero or if
the result is non finite or zero.
Sourcepub fn normalize_or_zero(self) -> Self
pub fn normalize_or_zero(self) -> Self
Returns Self::normalize, or a zero vector if the input is zero or if
the result is non finite.
Sourcepub fn normalize_and_length(self) -> (Self, f64)
pub fn normalize_and_length(self) -> (Self, f64)
Simultaneously computes Self::normalize and Self::length.
If self is a zero vector, the result is (Self::ZERO, 0.0).
Sourcepub fn with_max_length(self, max: f64) -> Self
pub fn with_max_length(self, max: f64) -> Self
Returns the input vector but with a length of no more than max.
§Panics
When assertions are enabled (see the crate documentation):
Panics if max is negative.
Sourcepub fn with_min_length(self, min: f64) -> Self
pub fn with_min_length(self, min: f64) -> Self
Returns the input vector but with a length of no less than min.
§Panics
When assertions are enabled (see the crate documentation):
Panics if min is negative.
Sourcepub fn clamp_length(self, min: f64, max: f64) -> Self
pub fn clamp_length(self, min: f64, max: f64) -> Self
Returns the input vector buth with a length of no less than min and no
more than max.
§Panics
When assertions are enabled (see the crate documentation):
Panics if min > max, or if min or max are negative.
Sourcepub fn angle_between(self, other: Self) -> f64
pub fn angle_between(self, other: Self) -> f64
Returns the angle (in radians) between self and other in the range
[0, +π].
The vectors do not need to be unit vectors but they do need to be non-zero.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn exp(self) -> Self
pub fn exp(self) -> Self
Computes the exponential function e^self for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn exp2(self) -> Self
pub fn exp2(self) -> Self
Computes 2^self for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn ln(self) -> Self
pub fn ln(self) -> Self
Computes the natural logarithm for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn log2(self) -> Self
pub fn log2(self) -> Self
Computes the base 2 logarithm for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn powf(self, n: f64) -> Self
pub fn powf(self, n: f64) -> Self
Computes self^n for the vector’s components.
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Sourcepub fn refract(self, normal: Self, eta: f64) -> Self
pub fn refract(self, normal: Self, eta: f64) -> Self
Returns the vector refraction of self through normal and eta.
eta is the incident refraction-index divided by the transmitted
refraction-index.
When total internal reflection occurs, the result is a zero vector.
self and normal must be normalized.
§Panics
When assertions are enabled (see the crate documentation):
Panics if self or normal are not normalized.
Source§impl<A: Alignment> Vector<3, f64, A>
impl<A: Alignment> Vector<3, f64, A>
Sourcepub fn rotate_x(self, angle: f64) -> Self
pub fn rotate_x(self, angle: f64) -> Self
Rotates self around the x axis by angle (in radians).
§Unspecified precision
The precision of this function is non-deterministic. This means it varies by platform, version, and can even differ within the same execution from one invocation to the next.
Source§impl<const N: usize, A: Alignment> Vector<N, i8, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, i8, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> i8
pub fn element_sum(self) -> i8
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> i8
pub fn element_product(self) -> i8
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> i8
pub fn max_element(self) -> i8
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> i8
pub fn min_element(self) -> i8
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if any component is $T::MIN.
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
0if the component is zero1if the component is positive-1if the component is negative
Sourcepub fn dot(self, rhs: Self) -> i8
pub fn dot(self, rhs: Self) -> i8
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> i8
pub fn length_squared(self) -> i8
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn distance_squared(self, other: Self) -> i8
pub fn distance_squared(self, other: Self) -> i8
Computes the squared Euclidean distance between self and other.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if overflow or division by zero
occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if overflow or division by zero
occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Computes self / rhs, saturating at the numeric bounds instead of
overflowing.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Computes self / rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Computes self % rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Source§impl<const N: usize, A: Alignment> Vector<N, i16, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, i16, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> i16
pub fn element_sum(self) -> i16
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> i16
pub fn element_product(self) -> i16
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> i16
pub fn max_element(self) -> i16
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> i16
pub fn min_element(self) -> i16
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if any component is $T::MIN.
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
0if the component is zero1if the component is positive-1if the component is negative
Sourcepub fn dot(self, rhs: Self) -> i16
pub fn dot(self, rhs: Self) -> i16
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> i16
pub fn length_squared(self) -> i16
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn distance_squared(self, other: Self) -> i16
pub fn distance_squared(self, other: Self) -> i16
Computes the squared Euclidean distance between self and other.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if overflow or division by zero
occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if overflow or division by zero
occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Computes self / rhs, saturating at the numeric bounds instead of
overflowing.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Computes self / rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Computes self % rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Source§impl<const N: usize, A: Alignment> Vector<N, i32, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, i32, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> i32
pub fn element_sum(self) -> i32
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> i32
pub fn element_product(self) -> i32
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> i32
pub fn max_element(self) -> i32
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> i32
pub fn min_element(self) -> i32
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if any component is $T::MIN.
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
0if the component is zero1if the component is positive-1if the component is negative
Sourcepub fn dot(self, rhs: Self) -> i32
pub fn dot(self, rhs: Self) -> i32
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> i32
pub fn length_squared(self) -> i32
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn distance_squared(self, other: Self) -> i32
pub fn distance_squared(self, other: Self) -> i32
Computes the squared Euclidean distance between self and other.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if overflow or division by zero
occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if overflow or division by zero
occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Computes self / rhs, saturating at the numeric bounds instead of
overflowing.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Computes self / rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Computes self % rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Source§impl<const N: usize, A: Alignment> Vector<N, i64, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, i64, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> i64
pub fn element_sum(self) -> i64
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> i64
pub fn element_product(self) -> i64
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> i64
pub fn max_element(self) -> i64
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> i64
pub fn min_element(self) -> i64
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if any component is $T::MIN.
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
0if the component is zero1if the component is positive-1if the component is negative
Sourcepub fn dot(self, rhs: Self) -> i64
pub fn dot(self, rhs: Self) -> i64
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> i64
pub fn length_squared(self) -> i64
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn distance_squared(self, other: Self) -> i64
pub fn distance_squared(self, other: Self) -> i64
Computes the squared Euclidean distance between self and other.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if overflow or division by zero
occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if overflow or division by zero
occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Computes self / rhs, saturating at the numeric bounds instead of
overflowing.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Computes self / rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Computes self % rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Source§impl<const N: usize, A: Alignment> Vector<N, i128, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, i128, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> i128
pub fn element_sum(self) -> i128
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> i128
pub fn element_product(self) -> i128
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> i128
pub fn max_element(self) -> i128
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> i128
pub fn min_element(self) -> i128
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if any component is $T::MIN.
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
0if the component is zero1if the component is positive-1if the component is negative
Sourcepub fn dot(self, rhs: Self) -> i128
pub fn dot(self, rhs: Self) -> i128
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> i128
pub fn length_squared(self) -> i128
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn distance_squared(self, other: Self) -> i128
pub fn distance_squared(self, other: Self) -> i128
Computes the squared Euclidean distance between self and other.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if overflow or division by zero
occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if overflow or division by zero
occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Computes self / rhs, saturating at the numeric bounds instead of
overflowing.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Computes self / rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Computes self % rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Source§impl<const N: usize, A: Alignment> Vector<N, isize, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, isize, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> isize
pub fn element_sum(self) -> isize
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> isize
pub fn element_product(self) -> isize
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> isize
pub fn max_element(self) -> isize
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> isize
pub fn min_element(self) -> isize
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns the absolute values of the vector’s components.
Equivalent to (self.x.abs(), self.y.abs(), ...).
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if any component is $T::MIN.
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns the signum of the vector’s components.
Equivalent to (self.x.signum(), self.y.signum(), ...).
For each component:
0if the component is zero1if the component is positive-1if the component is negative
Sourcepub fn dot(self, rhs: Self) -> isize
pub fn dot(self, rhs: Self) -> isize
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> isize
pub fn length_squared(self) -> isize
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn distance_squared(self, other: Self) -> isize
pub fn distance_squared(self, other: Self) -> isize
Computes the squared Euclidean distance between self and other.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if overflow or division by zero
occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if overflow or division by zero
occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Computes self / rhs, saturating at the numeric bounds instead of
overflowing.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Computes self / rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Computes self % rhs, wrapping around at the boundary of the type.
§Panics
Panics if any component of rhs is 0.
Source§impl<const N: usize, A: Alignment> Vector<N, u8, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, u8, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> u8
pub fn element_sum(self) -> u8
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> u8
pub fn element_product(self) -> u8
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> u8
pub fn max_element(self) -> u8
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> u8
pub fn min_element(self) -> u8
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn dot(self, rhs: Self) -> u8
pub fn dot(self, rhs: Self) -> u8
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> u8
pub fn length_squared(self) -> u8
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if division by zero occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if division by zero occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Source§impl<const N: usize, A: Alignment> Vector<N, u16, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, u16, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> u16
pub fn element_sum(self) -> u16
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> u16
pub fn element_product(self) -> u16
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> u16
pub fn max_element(self) -> u16
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> u16
pub fn min_element(self) -> u16
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn dot(self, rhs: Self) -> u16
pub fn dot(self, rhs: Self) -> u16
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> u16
pub fn length_squared(self) -> u16
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if division by zero occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if division by zero occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Source§impl<const N: usize, A: Alignment> Vector<N, u32, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, u32, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> u32
pub fn element_sum(self) -> u32
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> u32
pub fn element_product(self) -> u32
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> u32
pub fn max_element(self) -> u32
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> u32
pub fn min_element(self) -> u32
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn dot(self, rhs: Self) -> u32
pub fn dot(self, rhs: Self) -> u32
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> u32
pub fn length_squared(self) -> u32
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if division by zero occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if division by zero occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Source§impl<const N: usize, A: Alignment> Vector<N, u64, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, u64, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> u64
pub fn element_sum(self) -> u64
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> u64
pub fn element_product(self) -> u64
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> u64
pub fn max_element(self) -> u64
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> u64
pub fn min_element(self) -> u64
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn dot(self, rhs: Self) -> u64
pub fn dot(self, rhs: Self) -> u64
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> u64
pub fn length_squared(self) -> u64
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if division by zero occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if division by zero occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Source§impl<const N: usize, A: Alignment> Vector<N, u128, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, u128, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> u128
pub fn element_sum(self) -> u128
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> u128
pub fn element_product(self) -> u128
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> u128
pub fn max_element(self) -> u128
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> u128
pub fn min_element(self) -> u128
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn dot(self, rhs: Self) -> u128
pub fn dot(self, rhs: Self) -> u128
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> u128
pub fn length_squared(self) -> u128
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if division by zero occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if division by zero occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Source§impl<const N: usize, A: Alignment> Vector<N, usize, A>where
Length<N>: SupportedLength,
impl<const N: usize, A: Alignment> Vector<N, usize, A>where
Length<N>: SupportedLength,
Sourcepub fn element_sum(self) -> usize
pub fn element_sum(self) -> usize
Computes the sum of the vector’s components.
Equivalent to self.x + self.y + ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any addition overflows. Addition is performed in order.
Sourcepub fn element_product(self) -> usize
pub fn element_product(self) -> usize
Computes the product of the vector’s components.
Equivalent to self.x * self.y * ....
§Panics
When assertions are enabled (see the crate documentation):
Panics if any multiplication overflows. Multiplication is performed in order.
Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the maximum between the components of self and other.
Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the minimum between the components of self and other.
Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Clamps the vector’s components between the components of min and
max.
Equivalent to
(self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).
§Panics
Panics if min > max.
Sourcepub fn max_element(self) -> usize
pub fn max_element(self) -> usize
Returns the maximum between the vector’s components.
Equivalent to self.x.max(self.y).max(self.z)....
Sourcepub fn min_element(self) -> usize
pub fn min_element(self) -> usize
Returns the minimum between the vector’s components.
Equivalent to self.x.min(self.y).min(self.z)....
Sourcepub fn dot(self, rhs: Self) -> usize
pub fn dot(self, rhs: Self) -> usize
Computes the dot product of self and rhs.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn length_squared(self) -> usize
pub fn length_squared(self) -> usize
Computes the squared length/magnitude of the vector.
§Panics
When assertions are enabled (see the crate documentation) or overflow checks are enabled:
Panics if an overflow occurs.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occured.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occured.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occured.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if division by zero occured.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if division by zero occurred.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Computes self - rhs, wrapping around at the boundary of the type.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Source§impl<const N: usize, T, A: Alignment> Vector<N, T, A>
impl<const N: usize, T, A: Alignment> Vector<N, T, A>
Sourcepub const INFINITY: Self
pub const INFINITY: Self
All T::INFINITY.
Source§impl<const N: usize, T, A: Alignment> Vector<N, T, A>
impl<const N: usize, T, A: Alignment> Vector<N, T, A>
Sourcepub const NEG_INFINITY: Self
pub const NEG_INFINITY: Self
All T::NEG_INFINITY.
Source§impl<T, A: Alignment> Vector<2, T, A>where
T: Scalar,
impl<T, A: Alignment> Vector<2, T, A>where
T: Scalar,
Sourcepub fn with_x(self, value: T) -> Self
pub fn with_x(self, value: T) -> Self
Returns the vector with the x component set to the given value.
Sourcepub fn with_y(self, value: T) -> Self
pub fn with_y(self, value: T) -> Self
Returns the vector with the y component set to the given value.
Source§impl<T, A: Alignment> Vector<3, T, A>where
T: Scalar,
impl<T, A: Alignment> Vector<3, T, A>where
T: Scalar,
Sourcepub fn with_x(self, value: T) -> Self
pub fn with_x(self, value: T) -> Self
Returns the vector with the x component set to the given value.
Sourcepub fn with_y(self, value: T) -> Self
pub fn with_y(self, value: T) -> Self
Returns the vector with the y component set to the given value.
Sourcepub fn with_z(self, value: T) -> Self
pub fn with_z(self, value: T) -> Self
Returns the vector with the z component set to the given value.
Sourcepub fn with_xy(self, value: Vector<2, T, A>) -> Self
pub fn with_xy(self, value: Vector<2, T, A>) -> Self
Returns the vector with the x and y components set to the given values.
Sourcepub fn with_xz(self, value: Vector<2, T, A>) -> Self
pub fn with_xz(self, value: Vector<2, T, A>) -> Self
Returns the vector with the x and z components set to the given values.
Sourcepub fn with_yx(self, value: Vector<2, T, A>) -> Self
pub fn with_yx(self, value: Vector<2, T, A>) -> Self
Returns the vector with the y and x components set to the given values.
Sourcepub fn with_yz(self, value: Vector<2, T, A>) -> Self
pub fn with_yz(self, value: Vector<2, T, A>) -> Self
Returns the vector with the y and z components set to the given values.
Sourcepub fn with_zx(self, value: Vector<2, T, A>) -> Self
pub fn with_zx(self, value: Vector<2, T, A>) -> Self
Returns the vector with the z and x components set to the given values.
Sourcepub fn with_zy(self, value: Vector<2, T, A>) -> Self
pub fn with_zy(self, value: Vector<2, T, A>) -> Self
Returns the vector with the z and y components set to the given values.
Sourcepub fn with_xyz(self, value: Vector<3, T, A>) -> Self
pub fn with_xyz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, y and z components set to the given values.
Sourcepub fn with_xzy(self, value: Vector<3, T, A>) -> Self
pub fn with_xzy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, z and y components set to the given values.
Sourcepub fn with_yxz(self, value: Vector<3, T, A>) -> Self
pub fn with_yxz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, x and z components set to the given values.
Sourcepub fn with_yzx(self, value: Vector<3, T, A>) -> Self
pub fn with_yzx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, z and x components set to the given values.
Source§impl<T, A: Alignment> Vector<4, T, A>where
T: Scalar,
impl<T, A: Alignment> Vector<4, T, A>where
T: Scalar,
Sourcepub fn with_x(self, value: T) -> Self
pub fn with_x(self, value: T) -> Self
Returns the vector with the x component set to the given value.
Sourcepub fn with_y(self, value: T) -> Self
pub fn with_y(self, value: T) -> Self
Returns the vector with the y component set to the given value.
Sourcepub fn with_z(self, value: T) -> Self
pub fn with_z(self, value: T) -> Self
Returns the vector with the z component set to the given value.
Sourcepub fn with_w(self, value: T) -> Self
pub fn with_w(self, value: T) -> Self
Returns the vector with the w component set to the given value.
Sourcepub fn with_xy(self, value: Vector<2, T, A>) -> Self
pub fn with_xy(self, value: Vector<2, T, A>) -> Self
Returns the vector with the x and y components set to the given values.
Sourcepub fn with_xz(self, value: Vector<2, T, A>) -> Self
pub fn with_xz(self, value: Vector<2, T, A>) -> Self
Returns the vector with the x and z components set to the given values.
Sourcepub fn with_xw(self, value: Vector<2, T, A>) -> Self
pub fn with_xw(self, value: Vector<2, T, A>) -> Self
Returns the vector with the x and w components set to the given values.
Sourcepub fn with_yx(self, value: Vector<2, T, A>) -> Self
pub fn with_yx(self, value: Vector<2, T, A>) -> Self
Returns the vector with the y and x components set to the given values.
Sourcepub fn with_yz(self, value: Vector<2, T, A>) -> Self
pub fn with_yz(self, value: Vector<2, T, A>) -> Self
Returns the vector with the y and z components set to the given values.
Sourcepub fn with_yw(self, value: Vector<2, T, A>) -> Self
pub fn with_yw(self, value: Vector<2, T, A>) -> Self
Returns the vector with the y and w components set to the given values.
Sourcepub fn with_zx(self, value: Vector<2, T, A>) -> Self
pub fn with_zx(self, value: Vector<2, T, A>) -> Self
Returns the vector with the z and x components set to the given values.
Sourcepub fn with_zy(self, value: Vector<2, T, A>) -> Self
pub fn with_zy(self, value: Vector<2, T, A>) -> Self
Returns the vector with the z and y components set to the given values.
Sourcepub fn with_zw(self, value: Vector<2, T, A>) -> Self
pub fn with_zw(self, value: Vector<2, T, A>) -> Self
Returns the vector with the z and w components set to the given values.
Sourcepub fn with_wx(self, value: Vector<2, T, A>) -> Self
pub fn with_wx(self, value: Vector<2, T, A>) -> Self
Returns the vector with the w and x components set to the given values.
Sourcepub fn with_wy(self, value: Vector<2, T, A>) -> Self
pub fn with_wy(self, value: Vector<2, T, A>) -> Self
Returns the vector with the w and y components set to the given values.
Sourcepub fn with_wz(self, value: Vector<2, T, A>) -> Self
pub fn with_wz(self, value: Vector<2, T, A>) -> Self
Returns the vector with the w and z components set to the given values.
Sourcepub fn with_xyz(self, value: Vector<3, T, A>) -> Self
pub fn with_xyz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, y and z components set to the given values.
Sourcepub fn with_xyw(self, value: Vector<3, T, A>) -> Self
pub fn with_xyw(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, y and w components set to the given values.
Sourcepub fn with_xzy(self, value: Vector<3, T, A>) -> Self
pub fn with_xzy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, z and y components set to the given values.
Sourcepub fn with_xzw(self, value: Vector<3, T, A>) -> Self
pub fn with_xzw(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, z and w components set to the given values.
Sourcepub fn with_xwy(self, value: Vector<3, T, A>) -> Self
pub fn with_xwy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, w and y components set to the given values.
Sourcepub fn with_xwz(self, value: Vector<3, T, A>) -> Self
pub fn with_xwz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the x, w and z components set to the given values.
Sourcepub fn with_yxz(self, value: Vector<3, T, A>) -> Self
pub fn with_yxz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, x and z components set to the given values.
Sourcepub fn with_yxw(self, value: Vector<3, T, A>) -> Self
pub fn with_yxw(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, x and w components set to the given values.
Sourcepub fn with_yzx(self, value: Vector<3, T, A>) -> Self
pub fn with_yzx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, z and x components set to the given values.
Sourcepub fn with_yzw(self, value: Vector<3, T, A>) -> Self
pub fn with_yzw(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, z and w components set to the given values.
Sourcepub fn with_ywx(self, value: Vector<3, T, A>) -> Self
pub fn with_ywx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, w and x components set to the given values.
Sourcepub fn with_ywz(self, value: Vector<3, T, A>) -> Self
pub fn with_ywz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the y, w and z components set to the given values.
Sourcepub fn with_zxy(self, value: Vector<3, T, A>) -> Self
pub fn with_zxy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the z, x and y components set to the given values.
Sourcepub fn with_zxw(self, value: Vector<3, T, A>) -> Self
pub fn with_zxw(self, value: Vector<3, T, A>) -> Self
Returns the vector with the z, x and w components set to the given values.
Sourcepub fn with_zyx(self, value: Vector<3, T, A>) -> Self
pub fn with_zyx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the z, y and x components set to the given values.
Sourcepub fn with_zyw(self, value: Vector<3, T, A>) -> Self
pub fn with_zyw(self, value: Vector<3, T, A>) -> Self
Returns the vector with the z, y and w components set to the given values.
Sourcepub fn with_zwx(self, value: Vector<3, T, A>) -> Self
pub fn with_zwx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the z, w and x components set to the given values.
Sourcepub fn with_zwy(self, value: Vector<3, T, A>) -> Self
pub fn with_zwy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the z, w and y components set to the given values.
Sourcepub fn with_wxy(self, value: Vector<3, T, A>) -> Self
pub fn with_wxy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the w, x and y components set to the given values.
Sourcepub fn with_wxz(self, value: Vector<3, T, A>) -> Self
pub fn with_wxz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the w, x and z components set to the given values.
Sourcepub fn with_wyx(self, value: Vector<3, T, A>) -> Self
pub fn with_wyx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the w, y and x components set to the given values.
Sourcepub fn with_wyz(self, value: Vector<3, T, A>) -> Self
pub fn with_wyz(self, value: Vector<3, T, A>) -> Self
Returns the vector with the w, y and z components set to the given values.
Sourcepub fn with_wzx(self, value: Vector<3, T, A>) -> Self
pub fn with_wzx(self, value: Vector<3, T, A>) -> Self
Returns the vector with the w, z and x components set to the given values.
Sourcepub fn with_wzy(self, value: Vector<3, T, A>) -> Self
pub fn with_wzy(self, value: Vector<3, T, A>) -> Self
Returns the vector with the w, z and y components set to the given values.
Sourcepub fn with_xyzw(self, value: Vector<4, T, A>) -> Self
pub fn with_xyzw(self, value: Vector<4, T, A>) -> Self
Returns the vector with the x, y, z and w components set to the given values.
Sourcepub fn with_xywz(self, value: Vector<4, T, A>) -> Self
pub fn with_xywz(self, value: Vector<4, T, A>) -> Self
Returns the vector with the x, y, w and z components set to the given values.
Sourcepub fn with_xzyw(self, value: Vector<4, T, A>) -> Self
pub fn with_xzyw(self, value: Vector<4, T, A>) -> Self
Returns the vector with the x, z, y and w components set to the given values.
Sourcepub fn with_xzwy(self, value: Vector<4, T, A>) -> Self
pub fn with_xzwy(self, value: Vector<4, T, A>) -> Self
Returns the vector with the x, z, w and y components set to the given values.
Sourcepub fn with_xwyz(self, value: Vector<4, T, A>) -> Self
pub fn with_xwyz(self, value: Vector<4, T, A>) -> Self
Returns the vector with the x, w, y and z components set to the given values.
Sourcepub fn with_xwzy(self, value: Vector<4, T, A>) -> Self
pub fn with_xwzy(self, value: Vector<4, T, A>) -> Self
Returns the vector with the x, w, z and y components set to the given values.
Sourcepub fn with_yxzw(self, value: Vector<4, T, A>) -> Self
pub fn with_yxzw(self, value: Vector<4, T, A>) -> Self
Returns the vector with the y, x, z and w components set to the given values.
Sourcepub fn with_yxwz(self, value: Vector<4, T, A>) -> Self
pub fn with_yxwz(self, value: Vector<4, T, A>) -> Self
Returns the vector with the y, x, w and z components set to the given values.
Sourcepub fn with_yzxw(self, value: Vector<4, T, A>) -> Self
pub fn with_yzxw(self, value: Vector<4, T, A>) -> Self
Returns the vector with the y, z, x and w components set to the given values.
Sourcepub fn with_yzwx(self, value: Vector<4, T, A>) -> Self
pub fn with_yzwx(self, value: Vector<4, T, A>) -> Self
Returns the vector with the y, z, w and x components set to the given values.
Sourcepub fn with_ywxz(self, value: Vector<4, T, A>) -> Self
pub fn with_ywxz(self, value: Vector<4, T, A>) -> Self
Returns the vector with the y, w, x and z components set to the given values.
Sourcepub fn with_ywzx(self, value: Vector<4, T, A>) -> Self
pub fn with_ywzx(self, value: Vector<4, T, A>) -> Self
Returns the vector with the y, w, z and x components set to the given values.
Sourcepub fn with_zxyw(self, value: Vector<4, T, A>) -> Self
pub fn with_zxyw(self, value: Vector<4, T, A>) -> Self
Returns the vector with the z, x, y and w components set to the given values.
Sourcepub fn with_zxwy(self, value: Vector<4, T, A>) -> Self
pub fn with_zxwy(self, value: Vector<4, T, A>) -> Self
Returns the vector with the z, x, w and y components set to the given values.
Sourcepub fn with_zyxw(self, value: Vector<4, T, A>) -> Self
pub fn with_zyxw(self, value: Vector<4, T, A>) -> Self
Returns the vector with the z, y, x and w components set to the given values.
Sourcepub fn with_zywx(self, value: Vector<4, T, A>) -> Self
pub fn with_zywx(self, value: Vector<4, T, A>) -> Self
Returns the vector with the z, y, w and x components set to the given values.
Sourcepub fn with_zwxy(self, value: Vector<4, T, A>) -> Self
pub fn with_zwxy(self, value: Vector<4, T, A>) -> Self
Returns the vector with the z, w, x and y components set to the given values.
Sourcepub fn with_zwyx(self, value: Vector<4, T, A>) -> Self
pub fn with_zwyx(self, value: Vector<4, T, A>) -> Self
Returns the vector with the z, w, y and x components set to the given values.
Sourcepub fn with_wxyz(self, value: Vector<4, T, A>) -> Self
pub fn with_wxyz(self, value: Vector<4, T, A>) -> Self
Returns the vector with the w, x, y and z components set to the given values.
Sourcepub fn with_wxzy(self, value: Vector<4, T, A>) -> Self
pub fn with_wxzy(self, value: Vector<4, T, A>) -> Self
Returns the vector with the w, x, z and y components set to the given values.
Sourcepub fn with_wyxz(self, value: Vector<4, T, A>) -> Self
pub fn with_wyxz(self, value: Vector<4, T, A>) -> Self
Returns the vector with the w, y, x and z components set to the given values.
Sourcepub fn with_wyzx(self, value: Vector<4, T, A>) -> Self
pub fn with_wyzx(self, value: Vector<4, T, A>) -> Self
Returns the vector with the w, y, z and x components set to the given values.
Trait Implementations§
Source§impl<const N: usize, T, A: Alignment> AddAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> AddAssign<T> for Vector<N, T, A>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl<const N: usize, T, A: Alignment> AddAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> AddAssign for Vector<N, T, A>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl<const N: usize, T, A: Alignment> BitAndAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> BitAndAssign<T> for Vector<N, T, A>
Source§fn bitand_assign(&mut self, rhs: T)
fn bitand_assign(&mut self, rhs: T)
&= operation. Read moreSource§impl<const N: usize, T, A: Alignment> BitAndAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> BitAndAssign for Vector<N, T, A>
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl<const N: usize, T, A: Alignment> BitOrAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> BitOrAssign<T> for Vector<N, T, A>
Source§fn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
|= operation. Read moreSource§impl<const N: usize, T, A: Alignment> BitOrAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> BitOrAssign for Vector<N, T, A>
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl<const N: usize, T, A: Alignment> BitXorAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> BitXorAssign<T> for Vector<N, T, A>
Source§fn bitxor_assign(&mut self, rhs: T)
fn bitxor_assign(&mut self, rhs: T)
^= operation. Read moreSource§impl<const N: usize, T, A: Alignment> BitXorAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> BitXorAssign for Vector<N, T, A>
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreSource§impl<const N: usize, T, A: Alignment> DivAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> DivAssign<T> for Vector<N, T, A>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<const N: usize, T, A: Alignment> DivAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> DivAssign for Vector<N, T, A>
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl<T, A: Alignment> From<(T, T, T, T)> for Vector<4, T, A>where
T: Scalar,
impl<T, A: Alignment> From<(T, T, T, T)> for Vector<4, T, A>where
T: Scalar,
Source§fn from(value: (T, T, T, T)) -> Self
fn from(value: (T, T, T, T)) -> Self
Source§impl<T, A: Alignment> From<(Vector<2, T, A>, Vector<2, T, A>)> for Vector<4, T, A>where
T: Scalar,
impl<T, A: Alignment> From<(Vector<2, T, A>, Vector<2, T, A>)> for Vector<4, T, A>where
T: Scalar,
Source§impl<const N: usize, T, A: Alignment> MulAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> MulAssign<T> for Vector<N, T, A>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl<const N: usize, T, A: Alignment> MulAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> MulAssign for Vector<N, T, A>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl<const N: usize, T, A: Alignment> RemAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> RemAssign<T> for Vector<N, T, A>
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%= operation. Read moreSource§impl<const N: usize, T, A: Alignment> RemAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> RemAssign for Vector<N, T, A>
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
%= operation. Read moreSource§impl<const N: usize, T, A: Alignment> ShlAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> ShlAssign<T> for Vector<N, T, A>
Source§fn shl_assign(&mut self, rhs: T)
fn shl_assign(&mut self, rhs: T)
<<= operation. Read moreSource§impl<const N: usize, T, A: Alignment> ShlAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> ShlAssign for Vector<N, T, A>
Source§fn shl_assign(&mut self, rhs: Self)
fn shl_assign(&mut self, rhs: Self)
<<= operation. Read moreSource§impl<const N: usize, T, A: Alignment> ShrAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> ShrAssign<T> for Vector<N, T, A>
Source§fn shr_assign(&mut self, rhs: T)
fn shr_assign(&mut self, rhs: T)
>>= operation. Read moreSource§impl<const N: usize, T, A: Alignment> ShrAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> ShrAssign for Vector<N, T, A>
Source§fn shr_assign(&mut self, rhs: Self)
fn shr_assign(&mut self, rhs: Self)
>>= operation. Read moreSource§impl<const N: usize, T, A: Alignment> SubAssign<T> for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> SubAssign<T> for Vector<N, T, A>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read moreSource§impl<const N: usize, T, A: Alignment> SubAssign for Vector<N, T, A>
impl<const N: usize, T, A: Alignment> SubAssign for Vector<N, T, A>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more