Skip to main content

Vector

Struct Vector 

Source
pub struct Vector<const N: usize, T, A: Alignment>(/* private fields */)
where
    Length<N>: SupportedLength,
    T: Scalar;
Expand description

An N-dimensional vector of type T.

A controls SIMD alignment and is either Unaligned or Aligned. See Alignment for more details.

§Type aliases

§Fields

  • x: T (the first element of the vector, exists for lengths 2, 3, 4)

  • y: T (the second element of the vector, exists for lengths 2, 3, 4)

  • z: T (the third element of the vector, exists for lengths 3, 4)

  • w: T (the fourth element of the vector, exists for length 4)

Note that these fields are only exposed by implementing Deref and DerefMut.

§Memory layout

Vector<N, T, A> contains N consecutive values of T followed by optional padding.

Vector<N, T, Unaligned> has the alignment of T and has no padding. Vector<N, T, Aligned> may have higher alignment than T. Vec2A<T> and Vec4A<T> have no padding. Vec3A<T> may have one padding element.

Padding is fully initialized and accepts all bit patterns. Unless T accepts all bit patterns, it is not sound to assume padding contains valid values of T.

Implementations§

Source§

impl<const N: usize, A: Alignment> Vector<N, bool, A>

Source

pub const FALSE: Self

A vector with all elements set to false.

Source

pub const TRUE: Self

A vector with all elements set to true.

Source

pub fn all(self) -> bool

Returns true if all elements of self are true.

§Examples
let a = Vec3::new(true, true, false).all();
assert_eq!(a, false);

let a = Vec3::new(true, true, true).all();
assert_eq!(a, true);
Source

pub fn any(self) -> bool

Returns true if any element of self is true.

§Examples
let a = Vec3::new(true, true, false).any();
assert_eq!(a, true);

let a = Vec3::new(false, false, false).any();
assert_eq!(a, false);
Source

pub fn select<T: Scalar>( self, if_true: Vector<N, T, A>, if_false: Vector<N, T, A>, ) -> Vector<N, T, A>

Selects between the elements of if_true and if_false based on the boolean elements of self.

§Examples
let a = Vec4::new(true, false, false, true);
let b = Vec4::new(1, 2, 3, 4);
let c = Vec4::new(-1, -2, -3, -4);
let d = a.select(b, c);
assert_eq!(d, Vec4::new(1, -2, -3, 4));
Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub const NAN: Self

A vector with all elements set to NaN (Not a Number).

Source

pub const INFINITY: Self

A vector with all elements set to INFINITY.

Source

pub const NEG_INFINITY: Self

A vector with all elements set to NEG_INFINITY.

Source

pub fn is_nan(self) -> bool

Returns true if any element is NaN.

§Examples
let nan = Vec3::new(1.0, 2.0, f32::NAN);
let f = Vec3::new(1.0, 2.0, 3.0);

assert!(nan.is_nan());
assert!(!f.is_nan());
Source

pub fn nan_mask(self) -> Mask<N, T, A>

Returns a vector mask where each element is true if the corresponding element of self is NaN.

Equivalent to (self.x.is_nan(), self.y.is_nan(), ...).

§Examples
let vector = Vec3::new(1.0, 2.0, f32::NAN);
let mask = vector.nan_mask();

assert_eq!(mask, Mask3::new(false, false, true));
Source

pub fn is_finite(self) -> bool

Returns true if all elements are neither infinite nor NaN.

§Examples
let f = Vec3::new(1.0, 2.0, 3.0);
let inf = Vec3::new(1.0, f32::INFINITY, 3.0);
let neg_inf = Vec3::new(1.0, f32::NEG_INFINITY, 3.0);
let nan = Vec3::new(1.0, f32::NEG_INFINITY, 3.0);

assert!(f.is_finite());
assert!(!inf.is_finite());
assert!(!neg_inf.is_finite());
assert!(!nan.is_finite());
Source

pub fn finite_mask(self) -> Mask<N, T, A>

Returns a vector mask where each element is true if the corresponding element of self is neither infinite nor NaN.

Equivalent to (self.x.is_finite(), self.y.is_finite(), ...).

§Examples
let vector = Vec3::new(1.0, f32::INFINITY, f32::NAN);
let mask = vector.finite_mask();

assert_eq!(mask, Mask3::new(true, false, false));
Source

pub fn sign_positive_mask(self) -> Mask<N, T, A>

Returns a vector mask where each element is true if the corresponding element of self has a positive sign, including +0.0, NaNs with positive sign bit and positive infinity.

Equivalent to (self.x.is_sign_positive(), self.y.is_sign_positive(), ...).

§Examples
let vector = Vec4::new(1.0, -2.0, -3.0, f32::INFINITY);
let mask = vector.sign_positive_mask();

assert_eq!(mask, Mask4::new(true, false, false, true));
Source

pub fn sign_negative_mask(self) -> Mask<N, T, A>

Returns a vector mask where each element is true if the corresponding element of self has a negative sign, including -0.0, NaNs with negative sign bit and negative infinity.

Equivalent to (self.x.is_sign_negative(), self.y.is_sign_negative(), ...).

§Examples
let vector = Vec4::new(1.0, -2.0, 3.0, f32::NEG_INFINITY);
let mask = vector.sign_negative_mask();

assert_eq!(mask, Mask4::new(false, true, false, true));
Source

pub fn recip(self) -> Self

Returns the element-wise reciprocal (inverse) of a vector, 1 / self.

§Examples
let vector = Vec3::new(2.0, 3.0, 4.0);
let recip = vector.recip();
let div = Vec3::ONE / vector;

assert_eq!(recip, div);
Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

This is not consistent with IEEE semantics in regards to NaN propagation and handling of -0.0.

§Panics

When debug assertions are enabled:

Panics if any element is NaN.

§Examples
let a = Vec4::new(1.0, 5.0, 3.0, 0.0);
let b = Vec4::new(3.0, 2.0, 7.0, -1.0);
let max = a.max(b);

assert_eq!(max, Vec4::new(3.0, 5.0, 7.0, 0.0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

This is not consistent with IEEE semantics in regards to NaN propagation and handling of -0.0.

§Panics

When debug assertions are enabled:

Panics if any element is NaN.

§Examples
let a = Vec4::new(1.0, 5.0, 3.0, 0.0);
let b = Vec4::new(3.0, 2.0, 7.0, -1.0);
let min = a.min(b);

assert_eq!(min, Vec4::new(1.0, 2.0, 3.0, -1.0));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

This is not consistent with IEEE semantics in regards to NaN propagation and handling of -0.0.

§Panics

When debug assertions are enabled:

Panics if any element is NaN, or if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::new(1.0, 2.0, 3.0, 0.0);
let min = Vec4::new(0.0, 5.0, 1.0, -2.0);
let max = Vec4::new(3.0, 6.0, 2.0, -1.0);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1.0, 5.0, 2.0, -1.0));
Source

pub fn max_element(self) -> T

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

This is not consistent with IEEE semantics in regards to NaN propagation and handling of -0.0.

§Panics

When debug assertions are enabled:

Panics if any element is NaN.

§Examples
let vector = Vec3::new(-1.0, 7.0, 3.0);

assert_eq!(vector.max_element(), 7.0);
Source

pub fn min_element(self) -> T

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

This is not consistent with IEEE semantics in regards to NaN propagation and handling of -0.0.

§Panics

When debug assertions are enabled:

Panics if any element is NaN.

§Examples
let vector = Vec3::new(7.0, -1.0, 3.0);

assert_eq!(vector.min_element(), -1.0);
Source

pub fn abs(self) -> Self

Returns the absolute values of elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Examples
let vector = Vec3::new(7.0, -1.0, -3.0);

assert_eq!(vector.abs(), Vec3::new(7.0, 1.0, 3.0));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 1.0 if the element is positive, +0.0 or INFINITY
  • -1.0 if the element is negative, -0.0 or NEG_INFINITY
  • NaN if the element is NaN
§Examples
let vector = Vec4::new(7.0, -1.0, -3.0, f32::NAN);

assert_eq!(vector.signum().x, 1.0);
assert_eq!(vector.signum().y, -1.0);
assert_eq!(vector.signum().z, -1.0);
assert!(vector.signum().w.is_nan());
Source

pub fn copysign(self, sign: Self) -> Self

Returns a vector with the element magnitudes of self and the element signs of sign.

Equivalent to (self.x.copysign(sign.x), self.y.copysign(sign.y), ...).

§Examples
let vector = Vec3::new(7.0, -1.0, -3.0);
let sign = Vec3::new(-5.0, -2.0, 1.0);
let copysign = vector.copysign(sign);

assert_eq!(copysign, Vec3::new(-7.0, -1.0, 3.0));
Source

pub fn floor(self) -> Self

Returns the largest integers less than or equal to the elements of self.

This always returns the precise result.

§Examples
let vector = Vec3::new(3.7, 3.0, -3.7);

assert_eq!(vector.floor(), Vec3::new(3.0, 3.0, -4.0));
Source

pub fn ceil(self) -> Self

Returns the smallest integers greater than or equal to the elements of self.

This always returns the precise result.

§Examples
let vector = Vec3::new(3.01, 4.0, -4.99);

assert_eq!(vector.ceil(), Vec3::new(4.0, 4.0, -4.0));
Source

pub fn round(self) -> Self

Returns the nearest integers to the elements of self.

This always returns the precise result. If a value is half-way between two integers, round away from 0.0.

§Examples
let vector = Vec3::new(3.3, -3.3, 3.5);

assert_eq!(vector.round(), Vec3::new(3.0, -3.0, 4.0));
Source

pub fn trunc(self) -> Self

Returns the integer part of the elements of self. This means that non-integer numbers are always truncated towards zero.

This always returns the precise result.

§Examples
let vector = Vec3::new(3.7, 3.0, -3.7);

assert_eq!(vector.trunc(), Vec3::new(3.0, 3.0, -3.0));
Source

pub fn fract(self) -> Self

Returns the fractional part of self. Equivalent to self - self.trunc().

This always returns the precise result.

§Examples
let vector = Vec2::new(3.25, -3.25);

assert_eq!(vector.fract(), Vec2::new(0.25, -0.25));
Source

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.

Source

pub fn div_euclid(self, rhs: Self) -> Self

Calculates Euclidean division for the elements of self.

Equivalent to (self.x.div_euclid(rhs.x), self.y.div_euclid(rhs.y), ...).

See f32::div_euclid.

§Precision

The result of this operation is guaranteed to be the rounded infinite-precision result.

Source

pub fn rem_euclid(self, rhs: Self) -> Self

Calculates Euclidean remainder for the elements of self.

Equivalent to (self.x.rem_euclid(rhs.x), self.y.rem_euclid(rhs.y), ...).

See f32::rem_euclid.

§Precision

The result of this operation is guaranteed to be the rounded infinite-precision result.

Source

pub fn powf(self, n: T) -> Self

Computes x^n for the elements of self.

§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

pub fn sqrt(self) -> Self

Returns the square root of the elements of self.

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.

§Examples
let vector = Vec3::<f32>::new(4.0, 16.0, -4.0);

assert_eq!(vector.sqrt().x, 2.0);
assert_eq!(vector.sqrt().y, 4.0);
assert!(vector.sqrt().z.is_nan());
Source

pub fn exp(self) -> Self

Computes the exponential function e^x for the elements of self.

§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

pub fn exp2(self) -> Self

Computes 2^x for the elements of self.

§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

pub fn ln(self) -> Self

Computes the natural logarithm for the elements of self.

§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

pub fn log2(self) -> Self

Computes the base 2 logarithm for the elements of self.

§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.

§Examples
let vector = Vec3::new(2.0, 4.0, 8.0);

assert_eq!(vector.log2(), Vec3::new(1.0, 2.0, 3.0));
Source

pub fn sin(self) -> Self

Computes the sine of the elements of self.

§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

pub fn cos(self) -> Self

Computes the cosine of the elements of self.

§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

pub fn tan(self) -> Self

Computes the tangent of the elements of self.

§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

pub fn asin(self) -> Self

Computes the arcsine of the elements of self.

§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

pub fn acos(self) -> Self

Computes the arccosine of the elements of self.

§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

pub fn atan(self) -> Self

Computes the arctangent of the elements of self.

§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

pub fn sin_cos(self) -> (Self, Self)

Simultaneously computes the sine and cosine of the elements of self.

Equivalent to (self.sin(), self.cos()), but may be more performant. This 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.

Source

pub fn lerp(self, other: Self, t: T) -> 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.

Source

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. This may return a slightly different value.

Source

pub fn move_towards(self, target: Self, max_delta: T) -> 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.

let vector = Vec3::new(2.0, 0.0, 0.0);
let target = Vec3::new(5.0, 0.0, 0.0);
let max_delta = 1.0;
let move_towards = vector.move_towards(target, max_delta);

assert_eq!(move_towards, Vec3::new(3.0, 0.0, 0.0));
Source

pub fn slerp(self, other: Self, t: T) -> Self

Computes the spherical linear interpolation between self and other based on the value t.

When t is 0, the result is self. When t is 1, the result is other. When t is outside of the range 0..=1, the result is spherically linearly extrapolated.

The vectors do not need to be unit vectors but they do need to be non-zero.

§Panics

When debug assertions are enabled:

Panics if self or other are zero vectors.

Source

pub fn rotate_towards(self, target: Self, max_angle: T) -> Self

Rotates self towards target by at most max_angle (in radians).

When max_angle is 0, the result is self. When max_angle is equal to or greater than self.angle_between(target), the result is target. When max_angle is negative, this rotates towards -target.

The vectors do not need to be unit vectors but target does need to be non-zero.

§Panics

When debug assertions are enabled:

Panics if target is a zero vector.

Source

pub fn length(self) -> T

Returns the length/magnitude of self.

§Examples
let vector = Vec3::new(2.0, 3.0, 1.0);

assert_eq!(vector.length(), 14.0_f32.sqrt());
Source

pub fn distance(self, other: Self) -> T

Computes the Euclidean distance between self and other.

§Examples
let a = Vec3::new(1.0, 2.0, 3.0);
let b = Vec3::new(4.0, 5.0, 6.0);

assert_eq!(a.distance(b), (a - b).length());
Source

pub fn normalize(self) -> Self

Returns a vector with the direction of self and length 1.0.

§Panics

When debug assertions are enabled:

Panics if self is a zero vector, or if the result is non finite or zero.

§Examples
let vector = Vec3::new(1.0, 2.0, 3.0);

assert_eq!(vector.normalize(), vector / vector.length());
Source

pub fn try_normalize(self) -> Option<Self>

Returns normalize, or None if self is zero or if the result is non finite or zero.

§Examples
let non_zero = Vec3::new(1.0, 2.0, 3.0);
let zero = Vec3::new(0.0, 0.0, 0.0);

assert_eq!(non_zero.try_normalize(), Some(non_zero.normalize()));
assert_eq!(zero.try_normalize(), None);
Source

pub fn normalize_or(self, fallback: Self) -> Self

Returns normalize, or fallback if self is zero or if the result is non finite or zero.

§Examples
let non_zero = Vec3::new(1.0, 2.0, 3.0);
let zero = Vec3::new(0.0, 0.0, 0.0);
let fallback = Vec3::new(9.0, 10.0, 21.0);

assert_eq!(non_zero.normalize_or(fallback), non_zero.normalize());
assert_eq!(zero.normalize_or(fallback), fallback);
Source

pub fn normalize_or_zero(self) -> Self

Returns normalize, or a zero vector if self is zero or if the result is non finite.

§Examples
let non_zero = Vec3::new(1.0, 2.0, 3.0);
let zero = Vec3::new(0.0, 0.0, 0.0);

assert_eq!(non_zero.normalize_or_zero(), non_zero.normalize());
assert_eq!(zero.normalize_or_zero(), zero);
Source

pub fn normalize_and_length(self) -> (Self, T)

Simultaneously computes normalize and length.

If self is a zero vector, the result is length 0 and an unspecified vector. Consider manually checking for length == 0.0.

§Examples
let vector = Vec3::new(1.0, 2.0, 3.0);
let (normalize, length) = vector.normalize_and_length();

assert_eq!(normalize, vector.normalize());
assert_eq!(length, vector.length());
Source

pub fn is_normalized(self) -> bool

Returns whether the vector has the length 1.0 or not.

This uses a precision threshold of approximately 1e-4.

§Examples
let unit = Vec3::splat((1.0_f32 / 3.0).sqrt());
let non_unit = Vec3::splat(2.0);

assert!(unit.is_normalized());
assert!(!non_unit.is_normalized());
Source

pub fn with_max_length(self, max: T) -> Self

Returns self with a length of no more than max.

§Panics

When debug assertions are enabled:

Panics if max is negative or self cannot be normalized.

§Examples
let a = Vec3::new(2.0, 0.0, 0.0);
let b = Vec3::new(6.0, 0.0, 0.0);
let max = 4.0;

assert_eq!(a.with_max_length(max), Vec3::new(2.0, 0.0, 0.0));
assert_eq!(b.with_max_length(max), Vec3::new(4.0, 0.0, 0.0));
Source

pub fn with_min_length(self, min: T) -> Self

Returns self with a length of no less than min.

If min is negative, this returns self.

§Panics

When debug assertions are enabled:

Panics if self cannot be normalized.

§Examples
let a = Vec3::new(2.0, 0.0, 0.0);
let b = Vec3::new(6.0, 0.0, 0.0);
let min = 4.0;

assert_eq!(a.with_min_length(min), Vec3::new(4.0, 0.0, 0.0));
assert_eq!(b.with_min_length(min), Vec3::new(6.0, 0.0, 0.0));
Source

pub fn clamp_length(self, min: T, max: T) -> Self

Returns self with a length of no less than min and no more than max.

If min is negative it is ignored.

§Panics

When debug assertions are enabled:

Panics if min > max, max is negative or self cannot be normalized.

§Examples
let a = Vec3::new(2.0, 0.0, 0.0);
let b = Vec3::new(6.0, 0.0, 0.0);
let c = Vec3::new(10.0, 0.0, 0.0);
let min = 4.0;
let max = 8.0;

assert_eq!(a.clamp_length(min, max), Vec3::new(4.0, 0.0, 0.0));
assert_eq!(b.clamp_length(min, max), Vec3::new(6.0, 0.0, 0.0));
assert_eq!(c.clamp_length(min, max), Vec3::new(8.0, 0.0, 0.0));
Source

pub fn angle_between(self, other: Self) -> T

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.

§Panics

When debug assertions are enabled:

Panics if self or other are zero vectors.

§Examples
let x = Vec3::new(2.0, 0.0, 0.0);
let y = Vec3::new(0.0, 3.0, 0.0);
let angle = x.angle_between(y);

assert!((angle - 90.0_f32.to_radians()).abs() < 1e-5);
Source

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 debug assertions are enabled:

Panics if other is a zero vector.

Source

pub fn project_onto_normalized(self, other: Self) -> Self

Returns the vector projection of self onto other.

other must be normalized.

§Panics

When debug assertions are enabled:

Panics if other is not normalized.

Source

pub fn reject_from(self, other: Self) -> Self

Returns the vector rejection of self from other.

Equivalent to self - self.project_onto(other).

other must not be a zero vector.

§Panics

When debug assertions are enabled:

Panics if other is a zero vector.

Source

pub fn reject_from_normalized(self, other: Self) -> Self

Returns the vector rejection of self from other.

Equivalent to self - self.project_onto(other).

other must be normalized.

§Panics

When debug assertions are enabled:

Panics if other is not normalized.

Source

pub fn reflect(self, normal: Self) -> Self

Returns the reflection of self through normal.

normal must be normalized.

§Panics

When debug assertions are enabled:

Panics if normal is not normalized.

Source

pub fn refract(self, normal: Self, eta: T) -> 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 debug assertions are enabled:

Panics if self or normal are not normalized.

Source

pub fn any_orthogonal_vector(self) -> Self

Returns some vector that is orthogonal to self.

The result is not necessarily normalized. For that use any_orthonormal_vector instead.

For 2D vectors this is equivalent to perp.

Source

pub fn any_orthonormal_vector(self) -> Self

Returns some unit vector that is orthogonal to self.

self must normalized.

For 2D vectors this is equivalent to perp.

§Panics

When debug assertions are enabled:

Panics if self is not normalized.

Source

pub fn abs_diff_eq(self, other: Self, max_abs_diff: T) -> bool

Returns true if the absolute difference of all elements between self and other is less than or equal to max_abs_diff.

This can be used to compare two vectors that should be equal, but may have a slight difference due to operations having rounding errors.

Source

pub const fn to_bits(self) -> Vector<N, <T as PrimitiveFloat>::Bits, A>

Raw transmutation to unsigned integer vector.

Note that this function is distinct from as conversions, which attempt to preserve the numeric value, and not the bitwise value.

Source

pub const fn from_bits(value: Vector<N, <T as PrimitiveFloat>::Bits, A>) -> Self

Raw transmutation from unsigned integer vector.

Note that this function is distinct from as conversions, which attempt to preserve the numeric value, and not the bitwise value.

Source§

impl<T, A: Alignment> Vector<2, T, A>
where T: PrimitiveFloat,

Source

pub fn angle_to(self, other: Self) -> T

Returns the angle (in radians) that rotates self to other in the range -π..=+π.

The vectors do not need to be unit vectors but they do need to be non-zero.

Equivalent to other.angle_from(self).

§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.

§Panics

When debug assertions are enabled:

Panics if self or other are zero vectors.

§Examples
let x = Vec2::new(2.0, 0.0);
let y = Vec2::new(0.0, 3.0);

assert!(x.angle_to(y) > 0.0);
assert!(y.angle_to(x) < 0.0);
Source

pub fn angle_from(self, other: Self) -> T

Returns the angle (in radians) that rotates other to self in the range -π..=+π.

The vectors do not need to be unit vectors but they do need to be non-zero.

Equivalent to other.angle_to(self).

§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.

§Panics

When debug assertions are enabled:

Panics if self or other are zero vectors.

§Examples
let x = Vec2::new(2.0, 0.0);
let y = Vec2::new(0.0, 3.0);

assert!(x.angle_from(y) < 0.0);
assert!(y.angle_from(x) > 0.0);
Source

pub fn rotate(self, angle: T) -> Self

Rotates self by angle (in radians).

This rotates +X to +Y.

§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<T, A: Alignment> Vector<3, T, A>
where T: PrimitiveFloat,

Source

pub fn from_homogeneous(homogeneous: Vector<4, T, A>) -> Self

Creates a 3D vector from homogeneous coordinates by performing perspective divide.

Equivalent to homogeneous.xyz / homogeneous.w.

Source

pub fn rotate_x(self, angle: T) -> Self

Rotates self around the x axis by angle (in radians).

This rotates +Y to +Z.

§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

pub fn rotate_y(self, angle: T) -> Self

Rotates self around the y axis by angle (in radians).

This rotates +Z to +X.

§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

pub fn rotate_z(self, angle: T) -> Self

Rotates self around the z axis by angle (in radians).

This rotates +X to +Y.

§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

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 debug assertions are enabled:

Panics if self is not normalized.

Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub fn checked_add(self, rhs: Self) -> Option<Self>

Computes self + rhs, returning None if overflow occured.

Source

pub fn checked_sub(self, rhs: Self) -> Option<Self>

Computes self - rhs, returning None if overflow occured.

Source

pub fn checked_mul(self, rhs: Self) -> Option<Self>

Computes self * rhs, returning None if overflow occured.

Source

pub fn checked_div(self, rhs: Self) -> Option<Self>

Computes self / rhs, returning None if overflow or division by zero occured.

Source

pub fn checked_rem(self, rhs: Self) -> Option<Self>

Computes self % rhs, returning None if overflow or division by zero occurred.

Source

pub fn saturating_add(self, rhs: Self) -> Self

Computes self + rhs, saturating at the numeric bounds instead of overflowing.

Source

pub fn saturating_sub(self, rhs: Self) -> Self

Computes self - rhs, saturating at the numeric bounds instead of overflowing.

Source

pub fn saturating_mul(self, rhs: Self) -> Self

Computes self * rhs, saturating at the numeric bounds instead of overflowing.

Source

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.

Source

pub fn wrapping_add(self, rhs: Self) -> Self

Computes self + rhs, wrapping around at the boundary of the type.

Source

pub fn wrapping_sub(self, rhs: Self) -> Self

Computes self - rhs, wrapping around at the boundary of the type.

Source

pub fn wrapping_mul(self, rhs: Self) -> Self

Computes self * rhs, wrapping around at the boundary of the type.

Source

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.

Source

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, i8, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> i8

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> i8

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, i16, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> i16

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> i16

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, i32, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> i32

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> i32

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, i64, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> i64

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> i64

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, i128, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> i128

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> i128

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, isize, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> isize

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> isize

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, u8, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> u8

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> u8

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, u16, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> u16

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> u16

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, u32, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> u32

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> u32

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, u64, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> u64

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> u64

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, u128, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> u128

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> u128

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, A: Alignment> Vector<N, usize, A>

Source

pub const MIN: Self

A vector with all elements set to MIN.

Source

pub const MAX: Self

A vector with all elements set to MAX.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum elements between self and other.

Equivalent to (self.x.max(other.x), self.y.max(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let max = a.max(b);

assert_eq!(max, Vec4::new(3, 5, 7, 0));
Source

pub fn min(self, other: Self) -> Self

Returns the minimum elements between self and other.

Equivalent to (self.x.min(other.x), self.y.min(other.y), ...).

§Examples
let a = Vec4::<i32>::new(1, 5, 3, 0);
let b = Vec4::<i32>::new(3, 2, 7, -1);
let min = a.min(b);

assert_eq!(min, Vec4::new(1, 2, 3, -1));
Source

pub fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of self between the elements of min and max.

Equivalent to (self.x.clamp(min.x, max.x), self.y.clamp(min.y, max.y), ...).

§Panics

When debug assertions are enabled:

Panics if any element of min is greater than the corresponding element of max.

§Examples
let vector = Vec4::<i32>::new(1, 2, 3, 0);
let min = Vec4::new(0, 5, 1, -2);
let max = Vec4::new(3, 6, 2, -1);
let clamp = vector.clamp(min, max);

assert_eq!(clamp, Vec4::new(1, 5, 2, -1));
Source

pub fn max_element(self) -> usize

Returns the maximum between the elements of self.

Equivalent to self.x.max(self.y).max(self.z)....

§Examples
let vector = Vec3::<i32>::new(-1, 7, 3);
assert_eq!(vector.max_element(), 7);
Source

pub fn min_element(self) -> usize

Returns the minimum between the elements of self.

Equivalent to self.x.min(self.y).min(self.z)....

§Examples
let vector = Vec3::<i32>::new(7, -1, 3);
assert_eq!(vector.min_element(), -1);
Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub fn positive_mask(self) -> Mask<N, T, A>

Returns a vector mask where each element is true if the corresponding element of self is positive, and false if it is zero or negative.

Equivalent to (self.x.is_positive(), self.y.is_positive(), ...).

§Examples
let vector = Vec4::new(1, -2, -3, 4);
let mask = vector.positive_mask();

assert_eq!(mask, Mask4::new(true, false, false, true));
Source

pub fn negative_mask(self) -> Mask<N, T, A>

Returns a vector mask where each element is true if the corresponding element of self is negative, and false if it is zero or positive.

Equivalent to (self.x.is_negative(), self.y.is_negative(), ...).

§Examples
let vector = Vec4::new(1, -2, -3, 4);
let mask = vector.negative_mask();

assert_eq!(mask, Mask4::new(false, true, true, false));
Source

pub const fn cast_unsigned( self, ) -> Vector<N, <T as PrimitiveSigned>::Unsigned, A>

Returns the bit patterns of self reinterpreted as unsigned integers of the same size.

This produces the same result as as conversions, but ensures that the bit-width remains the same.

Source§

impl<const N: usize, A: Alignment> Vector<N, i8, A>

Source

pub fn abs(self) -> Self

Returns the absolute values of the elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Panics

When debug assertions or overflow checks are enabled:

Panics if any component is MIN.

§Examples
let vector = Vec3::<i32>::new(7, -1, -3);
assert_eq!(vector.abs(), Vec3::new(7, 1, 3));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 0 if the element is zero
  • 1 if the element is positive
  • -1 if the element is negative
§Examples
let vector = Vec4::<i32>::new(7, -1, -3, 0);
assert_eq!(vector.signum(), Vec4::new(1, -1, -1, 0));
Source§

impl<const N: usize, A: Alignment> Vector<N, i16, A>

Source

pub fn abs(self) -> Self

Returns the absolute values of the elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Panics

When debug assertions or overflow checks are enabled:

Panics if any component is MIN.

§Examples
let vector = Vec3::<i32>::new(7, -1, -3);
assert_eq!(vector.abs(), Vec3::new(7, 1, 3));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 0 if the element is zero
  • 1 if the element is positive
  • -1 if the element is negative
§Examples
let vector = Vec4::<i32>::new(7, -1, -3, 0);
assert_eq!(vector.signum(), Vec4::new(1, -1, -1, 0));
Source§

impl<const N: usize, A: Alignment> Vector<N, i32, A>

Source

pub fn abs(self) -> Self

Returns the absolute values of the elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Panics

When debug assertions or overflow checks are enabled:

Panics if any component is MIN.

§Examples
let vector = Vec3::<i32>::new(7, -1, -3);
assert_eq!(vector.abs(), Vec3::new(7, 1, 3));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 0 if the element is zero
  • 1 if the element is positive
  • -1 if the element is negative
§Examples
let vector = Vec4::<i32>::new(7, -1, -3, 0);
assert_eq!(vector.signum(), Vec4::new(1, -1, -1, 0));
Source§

impl<const N: usize, A: Alignment> Vector<N, i64, A>

Source

pub fn abs(self) -> Self

Returns the absolute values of the elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Panics

When debug assertions or overflow checks are enabled:

Panics if any component is MIN.

§Examples
let vector = Vec3::<i32>::new(7, -1, -3);
assert_eq!(vector.abs(), Vec3::new(7, 1, 3));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 0 if the element is zero
  • 1 if the element is positive
  • -1 if the element is negative
§Examples
let vector = Vec4::<i32>::new(7, -1, -3, 0);
assert_eq!(vector.signum(), Vec4::new(1, -1, -1, 0));
Source§

impl<const N: usize, A: Alignment> Vector<N, i128, A>

Source

pub fn abs(self) -> Self

Returns the absolute values of the elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Panics

When debug assertions or overflow checks are enabled:

Panics if any component is MIN.

§Examples
let vector = Vec3::<i32>::new(7, -1, -3);
assert_eq!(vector.abs(), Vec3::new(7, 1, 3));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 0 if the element is zero
  • 1 if the element is positive
  • -1 if the element is negative
§Examples
let vector = Vec4::<i32>::new(7, -1, -3, 0);
assert_eq!(vector.signum(), Vec4::new(1, -1, -1, 0));
Source§

impl<const N: usize, A: Alignment> Vector<N, isize, A>

Source

pub fn abs(self) -> Self

Returns the absolute values of the elements of self.

Equivalent to (self.x.abs(), self.y.abs(), ...).

§Panics

When debug assertions or overflow checks are enabled:

Panics if any component is MIN.

§Examples
let vector = Vec3::<i32>::new(7, -1, -3);
assert_eq!(vector.abs(), Vec3::new(7, 1, 3));
Source

pub fn signum(self) -> Self

Returns the signum of the elements of self.

Equivalent to (self.x.signum(), self.y.signum(), ...).

For each element:

  • 0 if the element is zero
  • 1 if the element is positive
  • -1 if the element is negative
§Examples
let vector = Vec4::<i32>::new(7, -1, -3, 0);
assert_eq!(vector.signum(), Vec4::new(1, -1, -1, 0));
Source§

impl<T, A: Alignment> Vector<2, T, A>
where T: Scalar,

Source

pub fn xx(self) -> Vector<2, T, A>

Returns (self.x, self.x).

Source

pub fn yx(self) -> Vector<2, T, A>

Returns (self.y, self.x).

Source

pub fn yy(self) -> Vector<2, T, A>

Returns (self.y, self.y).

Source

pub fn xxx(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.x).

Source

pub fn xxy(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.y).

Source

pub fn xyx(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.x).

Source

pub fn xyy(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.y).

Source

pub fn yxx(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.x).

Source

pub fn yxy(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.y).

Source

pub fn yyx(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.x).

Source

pub fn yyy(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.y).

Source

pub fn xxxx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.x).

Source

pub fn xxxy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.y).

Source

pub fn xxyx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.x).

Source

pub fn xxyy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.y).

Source

pub fn xyxx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.x).

Source

pub fn xyxy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.y).

Source

pub fn xyyx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.x).

Source

pub fn xyyy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.y).

Source

pub fn yxxx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.x).

Source

pub fn yxxy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.y).

Source

pub fn yxyx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.x).

Source

pub fn yxyy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.y).

Source

pub fn yyxx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.x).

Source

pub fn yyxy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.y).

Source

pub fn yyyx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.x).

Source

pub fn yyyy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.y).

Source

pub fn with_x(self, value: T) -> Self

Returns self with the element x replaced by value.

Source

pub fn with_y(self, value: T) -> Self

Returns self with the element y replaced by value.

Source

pub fn with_yx(self, value: Vector<2, T, A>) -> Self

Returns self with the elements y and x replaced by value.x and value.y.

Source

pub fn xy(self) -> Vector<2, T, A>

Returns (self.x, self.y).

Source

pub fn with_xy(self, value: Vector<2, T, A>) -> Self

Returns self with the elements x and y replaced by value.x and value.y.

Source§

impl<T, A: Alignment> Vector<3, T, A>
where T: Scalar,

Source

pub fn xx(self) -> Vector<2, T, A>

Returns (self.x, self.x).

Source

pub fn xz(self) -> Vector<2, T, A>

Returns (self.x, self.z).

Source

pub fn yx(self) -> Vector<2, T, A>

Returns (self.y, self.x).

Source

pub fn yy(self) -> Vector<2, T, A>

Returns (self.y, self.y).

Source

pub fn yz(self) -> Vector<2, T, A>

Returns (self.y, self.z).

Source

pub fn zx(self) -> Vector<2, T, A>

Returns (self.z, self.x).

Source

pub fn zy(self) -> Vector<2, T, A>

Returns (self.z, self.y).

Source

pub fn zz(self) -> Vector<2, T, A>

Returns (self.z, self.z).

Source

pub fn xxx(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.x).

Source

pub fn xxy(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.y).

Source

pub fn xxz(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.z).

Source

pub fn xyx(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.x).

Source

pub fn xyy(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.y).

Source

pub fn xzx(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.x).

Source

pub fn xzy(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.y).

Source

pub fn xzz(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.z).

Source

pub fn yxx(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.x).

Source

pub fn yxy(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.y).

Source

pub fn yxz(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.z).

Source

pub fn yyx(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.x).

Source

pub fn yyy(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.y).

Source

pub fn yyz(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.z).

Source

pub fn yzx(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.x).

Source

pub fn yzy(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.y).

Source

pub fn yzz(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.z).

Source

pub fn zxx(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.x).

Source

pub fn zxy(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.y).

Source

pub fn zxz(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.z).

Source

pub fn zyx(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.x).

Source

pub fn zyy(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.y).

Source

pub fn zyz(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.z).

Source

pub fn zzx(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.x).

Source

pub fn zzy(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.y).

Source

pub fn zzz(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.z).

Source

pub fn xxxx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.x).

Source

pub fn xxxy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.y).

Source

pub fn xxxz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.z).

Source

pub fn xxyx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.x).

Source

pub fn xxyy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.y).

Source

pub fn xxyz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.z).

Source

pub fn xxzx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.x).

Source

pub fn xxzy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.y).

Source

pub fn xxzz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.z).

Source

pub fn xyxx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.x).

Source

pub fn xyxy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.y).

Source

pub fn xyxz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.z).

Source

pub fn xyyx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.x).

Source

pub fn xyyy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.y).

Source

pub fn xyyz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.z).

Source

pub fn xyzx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.x).

Source

pub fn xyzy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.y).

Source

pub fn xyzz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.z).

Source

pub fn xzxx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.x).

Source

pub fn xzxy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.y).

Source

pub fn xzxz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.z).

Source

pub fn xzyx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.x).

Source

pub fn xzyy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.y).

Source

pub fn xzyz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.z).

Source

pub fn xzzx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.x).

Source

pub fn xzzy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.y).

Source

pub fn xzzz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.z).

Source

pub fn yxxx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.x).

Source

pub fn yxxy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.y).

Source

pub fn yxxz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.z).

Source

pub fn yxyx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.x).

Source

pub fn yxyy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.y).

Source

pub fn yxyz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.z).

Source

pub fn yxzx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.x).

Source

pub fn yxzy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.y).

Source

pub fn yxzz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.z).

Source

pub fn yyxx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.x).

Source

pub fn yyxy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.y).

Source

pub fn yyxz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.z).

Source

pub fn yyyx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.x).

Source

pub fn yyyy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.y).

Source

pub fn yyyz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.z).

Source

pub fn yyzx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.x).

Source

pub fn yyzy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.y).

Source

pub fn yyzz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.z).

Source

pub fn yzxx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.x).

Source

pub fn yzxy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.y).

Source

pub fn yzxz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.z).

Source

pub fn yzyx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.x).

Source

pub fn yzyy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.y).

Source

pub fn yzyz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.z).

Source

pub fn yzzx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.x).

Source

pub fn yzzy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.y).

Source

pub fn yzzz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.z).

Source

pub fn zxxx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.x).

Source

pub fn zxxy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.y).

Source

pub fn zxxz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.z).

Source

pub fn zxyx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.x).

Source

pub fn zxyy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.y).

Source

pub fn zxyz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.z).

Source

pub fn zxzx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.x).

Source

pub fn zxzy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.y).

Source

pub fn zxzz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.z).

Source

pub fn zyxx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.x).

Source

pub fn zyxy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.y).

Source

pub fn zyxz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.z).

Source

pub fn zyyx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.x).

Source

pub fn zyyy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.y).

Source

pub fn zyyz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.z).

Source

pub fn zyzx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.x).

Source

pub fn zyzy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.y).

Source

pub fn zyzz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.z).

Source

pub fn zzxx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.x).

Source

pub fn zzxy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.y).

Source

pub fn zzxz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.z).

Source

pub fn zzyx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.x).

Source

pub fn zzyy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.y).

Source

pub fn zzyz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.z).

Source

pub fn zzzx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.x).

Source

pub fn zzzy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.y).

Source

pub fn zzzz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.z).

Source

pub fn with_x(self, value: T) -> Self

Returns self with the element x replaced by value.

Source

pub fn with_y(self, value: T) -> Self

Returns self with the element y replaced by value.

Source

pub fn with_z(self, value: T) -> Self

Returns self with the element z replaced by value.

Source

pub fn with_xy(self, value: Vector<2, T, A>) -> Self

Returns self with the elements x and y replaced by value.x and value.y.

Source

pub fn with_xz(self, value: Vector<2, T, A>) -> Self

Returns self with the elements x and z replaced by value.x and value.y.

Source

pub fn with_yx(self, value: Vector<2, T, A>) -> Self

Returns self with the elements y and x replaced by value.x and value.y.

Source

pub fn with_yz(self, value: Vector<2, T, A>) -> Self

Returns self with the elements y and z replaced by value.x and value.y.

Source

pub fn with_zx(self, value: Vector<2, T, A>) -> Self

Returns self with the elements z and x replaced by value.x and value.y.

Source

pub fn with_zy(self, value: Vector<2, T, A>) -> Self

Returns self with the elements z and y replaced by value.x and value.y.

Source

pub fn with_xzy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, z and y replaced by value.x, value.y and value.z.

Source

pub fn with_yxz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, x and z replaced by value.x, value.y and value.z.

Source

pub fn with_yzx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, z and x replaced by value.x, value.y and value.z.

Source

pub fn with_zxy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, x and y replaced by value.x, value.y and value.z.

Source

pub fn with_zyx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, y and x replaced by value.x, value.y and value.z.

Source

pub fn xy(self) -> Vector<2, T, A>

Returns (self.x, self.y).

Source

pub fn xyz(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.z).

Source

pub fn with_xyz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, y and z replaced by value.x, value.y and value.z.

Source§

impl<T, A: Alignment> Vector<4, T, A>
where T: Scalar,

Source

pub fn xx(self) -> Vector<2, T, A>

Returns (self.x, self.x).

Source

pub fn xz(self) -> Vector<2, T, A>

Returns (self.x, self.z).

Source

pub fn xw(self) -> Vector<2, T, A>

Returns (self.x, self.w).

Source

pub fn yx(self) -> Vector<2, T, A>

Returns (self.y, self.x).

Source

pub fn yy(self) -> Vector<2, T, A>

Returns (self.y, self.y).

Source

pub fn yz(self) -> Vector<2, T, A>

Returns (self.y, self.z).

Source

pub fn yw(self) -> Vector<2, T, A>

Returns (self.y, self.w).

Source

pub fn zx(self) -> Vector<2, T, A>

Returns (self.z, self.x).

Source

pub fn zy(self) -> Vector<2, T, A>

Returns (self.z, self.y).

Source

pub fn zz(self) -> Vector<2, T, A>

Returns (self.z, self.z).

Source

pub fn zw(self) -> Vector<2, T, A>

Returns (self.z, self.w).

Source

pub fn wx(self) -> Vector<2, T, A>

Returns (self.w, self.x).

Source

pub fn wy(self) -> Vector<2, T, A>

Returns (self.w, self.y).

Source

pub fn wz(self) -> Vector<2, T, A>

Returns (self.w, self.z).

Source

pub fn ww(self) -> Vector<2, T, A>

Returns (self.w, self.w).

Source

pub fn xxx(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.x).

Source

pub fn xxy(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.y).

Source

pub fn xxz(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.z).

Source

pub fn xxw(self) -> Vector<3, T, A>

Returns (self.x, self.x, self.w).

Source

pub fn xyx(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.x).

Source

pub fn xyy(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.y).

Source

pub fn xyw(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.w).

Source

pub fn xzx(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.x).

Source

pub fn xzy(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.y).

Source

pub fn xzz(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.z).

Source

pub fn xzw(self) -> Vector<3, T, A>

Returns (self.x, self.z, self.w).

Source

pub fn xwx(self) -> Vector<3, T, A>

Returns (self.x, self.w, self.x).

Source

pub fn xwy(self) -> Vector<3, T, A>

Returns (self.x, self.w, self.y).

Source

pub fn xwz(self) -> Vector<3, T, A>

Returns (self.x, self.w, self.z).

Source

pub fn xww(self) -> Vector<3, T, A>

Returns (self.x, self.w, self.w).

Source

pub fn yxx(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.x).

Source

pub fn yxy(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.y).

Source

pub fn yxz(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.z).

Source

pub fn yxw(self) -> Vector<3, T, A>

Returns (self.y, self.x, self.w).

Source

pub fn yyx(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.x).

Source

pub fn yyy(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.y).

Source

pub fn yyz(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.z).

Source

pub fn yyw(self) -> Vector<3, T, A>

Returns (self.y, self.y, self.w).

Source

pub fn yzx(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.x).

Source

pub fn yzy(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.y).

Source

pub fn yzz(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.z).

Source

pub fn yzw(self) -> Vector<3, T, A>

Returns (self.y, self.z, self.w).

Source

pub fn ywx(self) -> Vector<3, T, A>

Returns (self.y, self.w, self.x).

Source

pub fn ywy(self) -> Vector<3, T, A>

Returns (self.y, self.w, self.y).

Source

pub fn ywz(self) -> Vector<3, T, A>

Returns (self.y, self.w, self.z).

Source

pub fn yww(self) -> Vector<3, T, A>

Returns (self.y, self.w, self.w).

Source

pub fn zxx(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.x).

Source

pub fn zxy(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.y).

Source

pub fn zxz(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.z).

Source

pub fn zxw(self) -> Vector<3, T, A>

Returns (self.z, self.x, self.w).

Source

pub fn zyx(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.x).

Source

pub fn zyy(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.y).

Source

pub fn zyz(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.z).

Source

pub fn zyw(self) -> Vector<3, T, A>

Returns (self.z, self.y, self.w).

Source

pub fn zzx(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.x).

Source

pub fn zzy(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.y).

Source

pub fn zzz(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.z).

Source

pub fn zzw(self) -> Vector<3, T, A>

Returns (self.z, self.z, self.w).

Source

pub fn zwx(self) -> Vector<3, T, A>

Returns (self.z, self.w, self.x).

Source

pub fn zwy(self) -> Vector<3, T, A>

Returns (self.z, self.w, self.y).

Source

pub fn zwz(self) -> Vector<3, T, A>

Returns (self.z, self.w, self.z).

Source

pub fn zww(self) -> Vector<3, T, A>

Returns (self.z, self.w, self.w).

Source

pub fn wxx(self) -> Vector<3, T, A>

Returns (self.w, self.x, self.x).

Source

pub fn wxy(self) -> Vector<3, T, A>

Returns (self.w, self.x, self.y).

Source

pub fn wxz(self) -> Vector<3, T, A>

Returns (self.w, self.x, self.z).

Source

pub fn wxw(self) -> Vector<3, T, A>

Returns (self.w, self.x, self.w).

Source

pub fn wyx(self) -> Vector<3, T, A>

Returns (self.w, self.y, self.x).

Source

pub fn wyy(self) -> Vector<3, T, A>

Returns (self.w, self.y, self.y).

Source

pub fn wyz(self) -> Vector<3, T, A>

Returns (self.w, self.y, self.z).

Source

pub fn wyw(self) -> Vector<3, T, A>

Returns (self.w, self.y, self.w).

Source

pub fn wzx(self) -> Vector<3, T, A>

Returns (self.w, self.z, self.x).

Source

pub fn wzy(self) -> Vector<3, T, A>

Returns (self.w, self.z, self.y).

Source

pub fn wzz(self) -> Vector<3, T, A>

Returns (self.w, self.z, self.z).

Source

pub fn wzw(self) -> Vector<3, T, A>

Returns (self.w, self.z, self.w).

Source

pub fn wwx(self) -> Vector<3, T, A>

Returns (self.w, self.w, self.x).

Source

pub fn wwy(self) -> Vector<3, T, A>

Returns (self.w, self.w, self.y).

Source

pub fn wwz(self) -> Vector<3, T, A>

Returns (self.w, self.w, self.z).

Source

pub fn www(self) -> Vector<3, T, A>

Returns (self.w, self.w, self.w).

Source

pub fn xxxx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.x).

Source

pub fn xxxy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.y).

Source

pub fn xxxz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.z).

Source

pub fn xxxw(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.x, self.w).

Source

pub fn xxyx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.x).

Source

pub fn xxyy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.y).

Source

pub fn xxyz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.z).

Source

pub fn xxyw(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.y, self.w).

Source

pub fn xxzx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.x).

Source

pub fn xxzy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.y).

Source

pub fn xxzz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.z).

Source

pub fn xxzw(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.z, self.w).

Source

pub fn xxwx(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.w, self.x).

Source

pub fn xxwy(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.w, self.y).

Source

pub fn xxwz(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.w, self.z).

Source

pub fn xxww(self) -> Vector<4, T, A>

Returns (self.x, self.x, self.w, self.w).

Source

pub fn xyxx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.x).

Source

pub fn xyxy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.y).

Source

pub fn xyxz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.z).

Source

pub fn xyxw(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.x, self.w).

Source

pub fn xyyx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.x).

Source

pub fn xyyy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.y).

Source

pub fn xyyz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.z).

Source

pub fn xyyw(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.y, self.w).

Source

pub fn xyzx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.x).

Source

pub fn xyzy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.y).

Source

pub fn xyzz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.z).

Source

pub fn xywx(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.w, self.x).

Source

pub fn xywy(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.w, self.y).

Source

pub fn xywz(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.w, self.z).

Source

pub fn xyww(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.w, self.w).

Source

pub fn xzxx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.x).

Source

pub fn xzxy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.y).

Source

pub fn xzxz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.z).

Source

pub fn xzxw(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.x, self.w).

Source

pub fn xzyx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.x).

Source

pub fn xzyy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.y).

Source

pub fn xzyz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.z).

Source

pub fn xzyw(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.y, self.w).

Source

pub fn xzzx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.x).

Source

pub fn xzzy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.y).

Source

pub fn xzzz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.z).

Source

pub fn xzzw(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.z, self.w).

Source

pub fn xzwx(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.w, self.x).

Source

pub fn xzwy(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.w, self.y).

Source

pub fn xzwz(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.w, self.z).

Source

pub fn xzww(self) -> Vector<4, T, A>

Returns (self.x, self.z, self.w, self.w).

Source

pub fn xwxx(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.x, self.x).

Source

pub fn xwxy(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.x, self.y).

Source

pub fn xwxz(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.x, self.z).

Source

pub fn xwxw(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.x, self.w).

Source

pub fn xwyx(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.y, self.x).

Source

pub fn xwyy(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.y, self.y).

Source

pub fn xwyz(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.y, self.z).

Source

pub fn xwyw(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.y, self.w).

Source

pub fn xwzx(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.z, self.x).

Source

pub fn xwzy(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.z, self.y).

Source

pub fn xwzz(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.z, self.z).

Source

pub fn xwzw(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.z, self.w).

Source

pub fn xwwx(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.w, self.x).

Source

pub fn xwwy(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.w, self.y).

Source

pub fn xwwz(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.w, self.z).

Source

pub fn xwww(self) -> Vector<4, T, A>

Returns (self.x, self.w, self.w, self.w).

Source

pub fn yxxx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.x).

Source

pub fn yxxy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.y).

Source

pub fn yxxz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.z).

Source

pub fn yxxw(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.x, self.w).

Source

pub fn yxyx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.x).

Source

pub fn yxyy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.y).

Source

pub fn yxyz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.z).

Source

pub fn yxyw(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.y, self.w).

Source

pub fn yxzx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.x).

Source

pub fn yxzy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.y).

Source

pub fn yxzz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.z).

Source

pub fn yxzw(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.z, self.w).

Source

pub fn yxwx(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.w, self.x).

Source

pub fn yxwy(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.w, self.y).

Source

pub fn yxwz(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.w, self.z).

Source

pub fn yxww(self) -> Vector<4, T, A>

Returns (self.y, self.x, self.w, self.w).

Source

pub fn yyxx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.x).

Source

pub fn yyxy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.y).

Source

pub fn yyxz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.z).

Source

pub fn yyxw(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.x, self.w).

Source

pub fn yyyx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.x).

Source

pub fn yyyy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.y).

Source

pub fn yyyz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.z).

Source

pub fn yyyw(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.y, self.w).

Source

pub fn yyzx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.x).

Source

pub fn yyzy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.y).

Source

pub fn yyzz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.z).

Source

pub fn yyzw(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.z, self.w).

Source

pub fn yywx(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.w, self.x).

Source

pub fn yywy(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.w, self.y).

Source

pub fn yywz(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.w, self.z).

Source

pub fn yyww(self) -> Vector<4, T, A>

Returns (self.y, self.y, self.w, self.w).

Source

pub fn yzxx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.x).

Source

pub fn yzxy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.y).

Source

pub fn yzxz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.z).

Source

pub fn yzxw(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.x, self.w).

Source

pub fn yzyx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.x).

Source

pub fn yzyy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.y).

Source

pub fn yzyz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.z).

Source

pub fn yzyw(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.y, self.w).

Source

pub fn yzzx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.x).

Source

pub fn yzzy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.y).

Source

pub fn yzzz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.z).

Source

pub fn yzzw(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.z, self.w).

Source

pub fn yzwx(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.w, self.x).

Source

pub fn yzwy(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.w, self.y).

Source

pub fn yzwz(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.w, self.z).

Source

pub fn yzww(self) -> Vector<4, T, A>

Returns (self.y, self.z, self.w, self.w).

Source

pub fn ywxx(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.x, self.x).

Source

pub fn ywxy(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.x, self.y).

Source

pub fn ywxz(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.x, self.z).

Source

pub fn ywxw(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.x, self.w).

Source

pub fn ywyx(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.y, self.x).

Source

pub fn ywyy(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.y, self.y).

Source

pub fn ywyz(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.y, self.z).

Source

pub fn ywyw(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.y, self.w).

Source

pub fn ywzx(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.z, self.x).

Source

pub fn ywzy(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.z, self.y).

Source

pub fn ywzz(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.z, self.z).

Source

pub fn ywzw(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.z, self.w).

Source

pub fn ywwx(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.w, self.x).

Source

pub fn ywwy(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.w, self.y).

Source

pub fn ywwz(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.w, self.z).

Source

pub fn ywww(self) -> Vector<4, T, A>

Returns (self.y, self.w, self.w, self.w).

Source

pub fn zxxx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.x).

Source

pub fn zxxy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.y).

Source

pub fn zxxz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.z).

Source

pub fn zxxw(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.x, self.w).

Source

pub fn zxyx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.x).

Source

pub fn zxyy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.y).

Source

pub fn zxyz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.z).

Source

pub fn zxyw(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.y, self.w).

Source

pub fn zxzx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.x).

Source

pub fn zxzy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.y).

Source

pub fn zxzz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.z).

Source

pub fn zxzw(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.z, self.w).

Source

pub fn zxwx(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.w, self.x).

Source

pub fn zxwy(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.w, self.y).

Source

pub fn zxwz(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.w, self.z).

Source

pub fn zxww(self) -> Vector<4, T, A>

Returns (self.z, self.x, self.w, self.w).

Source

pub fn zyxx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.x).

Source

pub fn zyxy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.y).

Source

pub fn zyxz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.z).

Source

pub fn zyxw(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.x, self.w).

Source

pub fn zyyx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.x).

Source

pub fn zyyy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.y).

Source

pub fn zyyz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.z).

Source

pub fn zyyw(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.y, self.w).

Source

pub fn zyzx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.x).

Source

pub fn zyzy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.y).

Source

pub fn zyzz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.z).

Source

pub fn zyzw(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.z, self.w).

Source

pub fn zywx(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.w, self.x).

Source

pub fn zywy(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.w, self.y).

Source

pub fn zywz(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.w, self.z).

Source

pub fn zyww(self) -> Vector<4, T, A>

Returns (self.z, self.y, self.w, self.w).

Source

pub fn zzxx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.x).

Source

pub fn zzxy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.y).

Source

pub fn zzxz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.z).

Source

pub fn zzxw(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.x, self.w).

Source

pub fn zzyx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.x).

Source

pub fn zzyy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.y).

Source

pub fn zzyz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.z).

Source

pub fn zzyw(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.y, self.w).

Source

pub fn zzzx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.x).

Source

pub fn zzzy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.y).

Source

pub fn zzzz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.z).

Source

pub fn zzzw(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.z, self.w).

Source

pub fn zzwx(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.w, self.x).

Source

pub fn zzwy(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.w, self.y).

Source

pub fn zzwz(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.w, self.z).

Source

pub fn zzww(self) -> Vector<4, T, A>

Returns (self.z, self.z, self.w, self.w).

Source

pub fn zwxx(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.x, self.x).

Source

pub fn zwxy(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.x, self.y).

Source

pub fn zwxz(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.x, self.z).

Source

pub fn zwxw(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.x, self.w).

Source

pub fn zwyx(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.y, self.x).

Source

pub fn zwyy(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.y, self.y).

Source

pub fn zwyz(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.y, self.z).

Source

pub fn zwyw(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.y, self.w).

Source

pub fn zwzx(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.z, self.x).

Source

pub fn zwzy(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.z, self.y).

Source

pub fn zwzz(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.z, self.z).

Source

pub fn zwzw(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.z, self.w).

Source

pub fn zwwx(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.w, self.x).

Source

pub fn zwwy(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.w, self.y).

Source

pub fn zwwz(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.w, self.z).

Source

pub fn zwww(self) -> Vector<4, T, A>

Returns (self.z, self.w, self.w, self.w).

Source

pub fn wxxx(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.x, self.x).

Source

pub fn wxxy(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.x, self.y).

Source

pub fn wxxz(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.x, self.z).

Source

pub fn wxxw(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.x, self.w).

Source

pub fn wxyx(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.y, self.x).

Source

pub fn wxyy(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.y, self.y).

Source

pub fn wxyz(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.y, self.z).

Source

pub fn wxyw(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.y, self.w).

Source

pub fn wxzx(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.z, self.x).

Source

pub fn wxzy(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.z, self.y).

Source

pub fn wxzz(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.z, self.z).

Source

pub fn wxzw(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.z, self.w).

Source

pub fn wxwx(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.w, self.x).

Source

pub fn wxwy(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.w, self.y).

Source

pub fn wxwz(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.w, self.z).

Source

pub fn wxww(self) -> Vector<4, T, A>

Returns (self.w, self.x, self.w, self.w).

Source

pub fn wyxx(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.x, self.x).

Source

pub fn wyxy(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.x, self.y).

Source

pub fn wyxz(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.x, self.z).

Source

pub fn wyxw(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.x, self.w).

Source

pub fn wyyx(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.y, self.x).

Source

pub fn wyyy(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.y, self.y).

Source

pub fn wyyz(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.y, self.z).

Source

pub fn wyyw(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.y, self.w).

Source

pub fn wyzx(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.z, self.x).

Source

pub fn wyzy(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.z, self.y).

Source

pub fn wyzz(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.z, self.z).

Source

pub fn wyzw(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.z, self.w).

Source

pub fn wywx(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.w, self.x).

Source

pub fn wywy(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.w, self.y).

Source

pub fn wywz(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.w, self.z).

Source

pub fn wyww(self) -> Vector<4, T, A>

Returns (self.w, self.y, self.w, self.w).

Source

pub fn wzxx(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.x, self.x).

Source

pub fn wzxy(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.x, self.y).

Source

pub fn wzxz(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.x, self.z).

Source

pub fn wzxw(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.x, self.w).

Source

pub fn wzyx(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.y, self.x).

Source

pub fn wzyy(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.y, self.y).

Source

pub fn wzyz(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.y, self.z).

Source

pub fn wzyw(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.y, self.w).

Source

pub fn wzzx(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.z, self.x).

Source

pub fn wzzy(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.z, self.y).

Source

pub fn wzzz(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.z, self.z).

Source

pub fn wzzw(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.z, self.w).

Source

pub fn wzwx(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.w, self.x).

Source

pub fn wzwy(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.w, self.y).

Source

pub fn wzwz(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.w, self.z).

Source

pub fn wzww(self) -> Vector<4, T, A>

Returns (self.w, self.z, self.w, self.w).

Source

pub fn wwxx(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.x, self.x).

Source

pub fn wwxy(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.x, self.y).

Source

pub fn wwxz(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.x, self.z).

Source

pub fn wwxw(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.x, self.w).

Source

pub fn wwyx(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.y, self.x).

Source

pub fn wwyy(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.y, self.y).

Source

pub fn wwyz(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.y, self.z).

Source

pub fn wwyw(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.y, self.w).

Source

pub fn wwzx(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.z, self.x).

Source

pub fn wwzy(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.z, self.y).

Source

pub fn wwzz(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.z, self.z).

Source

pub fn wwzw(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.z, self.w).

Source

pub fn wwwx(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.w, self.x).

Source

pub fn wwwy(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.w, self.y).

Source

pub fn wwwz(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.w, self.z).

Source

pub fn wwww(self) -> Vector<4, T, A>

Returns (self.w, self.w, self.w, self.w).

Source

pub fn with_x(self, value: T) -> Self

Returns self with the element x replaced by value.

Source

pub fn with_y(self, value: T) -> Self

Returns self with the element y replaced by value.

Source

pub fn with_z(self, value: T) -> Self

Returns self with the element z replaced by value.

Source

pub fn with_w(self, value: T) -> Self

Returns self with the element w replaced by value.

Source

pub fn with_xy(self, value: Vector<2, T, A>) -> Self

Returns self with the elements x and y replaced by value.x and value.y.

Source

pub fn with_xz(self, value: Vector<2, T, A>) -> Self

Returns self with the elements x and z replaced by value.x and value.y.

Source

pub fn with_xw(self, value: Vector<2, T, A>) -> Self

Returns self with the elements x and w replaced by value.x and value.y.

Source

pub fn with_yx(self, value: Vector<2, T, A>) -> Self

Returns self with the elements y and x replaced by value.x and value.y.

Source

pub fn with_yz(self, value: Vector<2, T, A>) -> Self

Returns self with the elements y and z replaced by value.x and value.y.

Source

pub fn with_yw(self, value: Vector<2, T, A>) -> Self

Returns self with the elements y and w replaced by value.x and value.y.

Source

pub fn with_zx(self, value: Vector<2, T, A>) -> Self

Returns self with the elements z and x replaced by value.x and value.y.

Source

pub fn with_zy(self, value: Vector<2, T, A>) -> Self

Returns self with the elements z and y replaced by value.x and value.y.

Source

pub fn with_zw(self, value: Vector<2, T, A>) -> Self

Returns self with the elements z and w replaced by value.x and value.y.

Source

pub fn with_wx(self, value: Vector<2, T, A>) -> Self

Returns self with the elements w and x replaced by value.x and value.y.

Source

pub fn with_wy(self, value: Vector<2, T, A>) -> Self

Returns self with the elements w and y replaced by value.x and value.y.

Source

pub fn with_wz(self, value: Vector<2, T, A>) -> Self

Returns self with the elements w and z replaced by value.x and value.y.

Source

pub fn with_xyz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, y and z replaced by value.x, value.y and value.z.

Source

pub fn with_xyw(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, y and w replaced by value.x, value.y and value.z.

Source

pub fn with_xzy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, z and y replaced by value.x, value.y and value.z.

Source

pub fn with_xzw(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, z and w replaced by value.x, value.y and value.z.

Source

pub fn with_xwy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, w and y replaced by value.x, value.y and value.z.

Source

pub fn with_xwz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements x, w and z replaced by value.x, value.y and value.z.

Source

pub fn with_yxz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, x and z replaced by value.x, value.y and value.z.

Source

pub fn with_yxw(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, x and w replaced by value.x, value.y and value.z.

Source

pub fn with_yzx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, z and x replaced by value.x, value.y and value.z.

Source

pub fn with_yzw(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, z and w replaced by value.x, value.y and value.z.

Source

pub fn with_ywx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, w and x replaced by value.x, value.y and value.z.

Source

pub fn with_ywz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements y, w and z replaced by value.x, value.y and value.z.

Source

pub fn with_zxy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, x and y replaced by value.x, value.y and value.z.

Source

pub fn with_zxw(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, x and w replaced by value.x, value.y and value.z.

Source

pub fn with_zyx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, y and x replaced by value.x, value.y and value.z.

Source

pub fn with_zyw(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, y and w replaced by value.x, value.y and value.z.

Source

pub fn with_zwx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, w and x replaced by value.x, value.y and value.z.

Source

pub fn with_zwy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements z, w and y replaced by value.x, value.y and value.z.

Source

pub fn with_wxy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements w, x and y replaced by value.x, value.y and value.z.

Source

pub fn with_wxz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements w, x and z replaced by value.x, value.y and value.z.

Source

pub fn with_wyx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements w, y and x replaced by value.x, value.y and value.z.

Source

pub fn with_wyz(self, value: Vector<3, T, A>) -> Self

Returns self with the elements w, y and z replaced by value.x, value.y and value.z.

Source

pub fn with_wzx(self, value: Vector<3, T, A>) -> Self

Returns self with the elements w, z and x replaced by value.x, value.y and value.z.

Source

pub fn with_wzy(self, value: Vector<3, T, A>) -> Self

Returns self with the elements w, z and y replaced by value.x, value.y and value.z.

Source

pub fn with_xywz(self, value: Vector<4, T, A>) -> Self

Returns self with the elements x, y, w and z replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_xzyw(self, value: Vector<4, T, A>) -> Self

Returns self with the elements x, z, y and w replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_xzwy(self, value: Vector<4, T, A>) -> Self

Returns self with the elements x, z, w and y replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_xwyz(self, value: Vector<4, T, A>) -> Self

Returns self with the elements x, w, y and z replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_xwzy(self, value: Vector<4, T, A>) -> Self

Returns self with the elements x, w, z and y replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_yxzw(self, value: Vector<4, T, A>) -> Self

Returns self with the elements y, x, z and w replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_yxwz(self, value: Vector<4, T, A>) -> Self

Returns self with the elements y, x, w and z replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_yzxw(self, value: Vector<4, T, A>) -> Self

Returns self with the elements y, z, x and w replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_yzwx(self, value: Vector<4, T, A>) -> Self

Returns self with the elements y, z, w and x replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_ywxz(self, value: Vector<4, T, A>) -> Self

Returns self with the elements y, w, x and z replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_ywzx(self, value: Vector<4, T, A>) -> Self

Returns self with the elements y, w, z and x replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_zxyw(self, value: Vector<4, T, A>) -> Self

Returns self with the elements z, x, y and w replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_zxwy(self, value: Vector<4, T, A>) -> Self

Returns self with the elements z, x, w and y replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_zyxw(self, value: Vector<4, T, A>) -> Self

Returns self with the elements z, y, x and w replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_zywx(self, value: Vector<4, T, A>) -> Self

Returns self with the elements z, y, w and x replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_zwxy(self, value: Vector<4, T, A>) -> Self

Returns self with the elements z, w, x and y replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_zwyx(self, value: Vector<4, T, A>) -> Self

Returns self with the elements z, w, y and x replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_wxyz(self, value: Vector<4, T, A>) -> Self

Returns self with the elements w, x, y and z replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_wxzy(self, value: Vector<4, T, A>) -> Self

Returns self with the elements w, x, z and y replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_wyxz(self, value: Vector<4, T, A>) -> Self

Returns self with the elements w, y, x and z replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_wyzx(self, value: Vector<4, T, A>) -> Self

Returns self with the elements w, y, z and x replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_wzxy(self, value: Vector<4, T, A>) -> Self

Returns self with the elements w, z, x and y replaced by value.x, value.y, value.z and value.w.

Source

pub fn with_wzyx(self, value: Vector<4, T, A>) -> Self

Returns self with the elements w, z, y and x replaced by value.x, value.y, value.z and value.w.

Source

pub fn xy(self) -> Vector<2, T, A>

Returns (self.x, self.y).

Source

pub fn xyz(self) -> Vector<3, T, A>

Returns (self.x, self.y, self.z).

Source

pub fn xyzw(self) -> Vector<4, T, A>

Returns (self.x, self.y, self.z, self.w).

Source

pub fn with_xyzw(self, value: Vector<4, T, A>) -> Self

Returns self with the elements x, y, z and w replaced by value.x, value.y, value.z and value.w.

Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub const fn cast_signed(self) -> Vector<N, <T as PrimitiveUnsigned>::Signed, A>

Returns the bit patterns of self reinterpreted as signed integers of the same size.

This produces the same result as as conversions, but ensures that the bit-width remains the same.

Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub const ZERO: Self

A vector with all elements set to 0.

Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + One,

Source

pub const ONE: Self

A vector with all elements set to 1.

Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub const NEG_ONE: Self

A vector with all elements set to -1.

Source§

impl<const N: usize, T, A: Alignment> Vector<N, T, A>

Source

pub const fn from_array(array: [T; N]) -> Self

Creates a vector from an array.

Source

pub const fn splat(value: T) -> Self

Creates a vector with all elements set to value.

§Examples
let vector = Vec3::splat(5);
assert_eq!(vector, Vec3::new(5, 5, 5));
Source

pub fn from_fn<F>(f: F) -> Self
where F: FnMut(usize) -> T,

Creates a vector by calling function f for each element index.

Equivalent to (f(0), f(1), f(2), ...).

§Examples
let indices = Vec3::from_fn(|i| i);
assert_eq!(indices, Vec3::new(0, 1, 2));

let vector = Vec3::from_fn(|i| i % 2);
assert_eq!(vector, Vec3::new(0, 1, 0));
Source

pub const fn to_alignment<A2: Alignment>(self) -> Vector<N, T, A2>

Conversion between Aligned and Unaligned storage.

See align and unalign for scenarios where the output alignment is known.

See Alignment for more details.

§Examples
let unaligned = Vec3::new(1, 2, 3);
let aligned = unaligned.to_alignment::<Aligned>();
assert_eq!(aligned, Vec3A::new(1, 2, 3));

let aligned = Vec3A::new(1, 2, 3);
let unaligned = aligned.to_alignment::<Unaligned>();
assert_eq!(unaligned, Vec3::new(1, 2, 3));
Source

pub const fn align(self) -> Vector<N, T, Aligned>

Conversion to Aligned storage.

See Alignment for more information.

§Examples
let unaligned = Vec3::new(1, 2, 3);
let aligned = unaligned.align();
assert_eq!(aligned, Vec3A::new(1, 2, 3));
Source

pub const fn unalign(self) -> Vector<N, T, Unaligned>

Conversion to Unaligned storage.

See Alignment for more information.

§Examples
let aligned = Vec3A::new(1, 2, 3);
let unaligned = aligned.unalign();
assert_eq!(unaligned, Vec3::new(1, 2, 3));
Source

pub const fn to_array(self) -> [T; N]

Converts the vector to an array.

Source

pub const fn as_array(&self) -> &[T; N]

Returns a reference to the vector’s elements.

Source

pub const fn as_mut_array(&mut self) -> &mut [T; N]

Returns a mutable reference to the vector’s elements.

Source

pub fn iter(self) -> IntoIter<T, N>

Returns an iterator over the vector’s elements.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns an iterator over mutable references to the vector’s elements.

Source

pub fn map<U, F>(self, f: F) -> Vector<N, U, A>
where U: Scalar, F: Fn(T) -> U,

Returns a vector of the same length as self, with function f applied to each element in order.

Equivalent to (f(self.x), f(self.y), f(self.z), ..).

§Examples
let a = Vec3::new(1, 2, 3);
let b = a.map(|x| x + 1);
assert_eq!(b, Vec3::new(2, 3, 4));

let a = Vec3::<i32>::new(1, -2, -3);
let b = a.map(|x| x.is_negative());
assert_eq!(b, Vec3::new(false, true, true));
Source

pub fn reverse(self) -> Self

Returns a vector with the elements of self in reverse order.

§Examples
let vector = Vec3::new(1, 2, 3).reverse();
assert_eq!(vector, Vec3::new(3, 2, 1));
Source

pub fn element_sum(self) -> T
where T: Add<Output = T>,

Computes the sum of the elements of self.

Equivalent to self.x + self.y + ....

§Panics

When debug assertions or overflow checks are enabled:

For integers this panics if any addition overflows (order unspecified).

§Consistency

For primitive types this operation is cross platform deterministic.

Source

pub fn element_product(self) -> T
where T: Mul<Output = T>,

Computes the product of the elements of self.

Equivalent to self.x * self.y * ....

§Panics

When debug assertions or overflow checks are enabled:

For integers this panics if any multiplication overflows (order unspecified).

§Consistency

For primitive types this operation is cross platform deterministic.

Source

pub fn eq_mask(self, other: Self) -> Mask<N, T, A>
where T: PartialEq,

Returns a vector mask where each element is true if the corresponding elements of self and other are equal.

Equivalent to (self.x == other.x, self.y == other.y, ...).

§Examples
let vector = Vec3::new(1, 2, 3);
let mask = vector.eq_mask(Vec3::new(0, 2, 5));
assert_eq!(mask, Mask3::new(false, true, false));
Source

pub fn ne_mask(self, other: Self) -> Mask<N, T, A>
where T: PartialEq,

Returns a vector mask where each element is true if the corresponding elements of self and other are not equal.

Equivalent to (self.x != other.x, self.y != other.y, ...).

§Examples
let vector = Vec3::new(1, 2, 3);
let mask = vector.ne_mask(Vec3::new(0, 2, 5));
assert_eq!(mask, Mask3::new(true, false, true));
Source

pub fn lt_mask(self, other: Self) -> Mask<N, T, A>
where T: PartialOrd,

Returns a vector mask where each element is true if the corresponding element of self is less than the corresponding element of other.

Equivalent to (self.x < other.x, self.y < other.y, ...).

§Examples
let vector = Vec3::new(1, 2, 3);
let mask = vector.lt_mask(Vec3::new(0, 2, 5));
assert_eq!(mask, Mask3::new(false, false, true));
Source

pub fn gt_mask(self, other: Self) -> Mask<N, T, A>
where T: PartialOrd,

Returns a vector mask where each element is true if the corresponding element of self is greater than the corresponding element of other.

Equivalent to (self.x > other.x, self.y > other.y, ...).

§Examples
let vector = Vec3::new(1, 2, 3);
let mask = vector.gt_mask(Vec3::new(0, 2, 5));
assert_eq!(mask, Mask3::new(true, false, false));
Source

pub fn le_mask(self, other: Self) -> Mask<N, T, A>
where T: PartialOrd,

Returns a vector mask where each element is true if the corresponding element of self is less than or equal to the corresponding element of other.

Equivalent to (self.x <= other.x, self.y <= other.y, ...).

§Examples
let vector = Vec3::new(1, 2, 3);
let mask = vector.le_mask(Vec3::new(0, 2, 5));
assert_eq!(mask, Mask3::new(false, true, true));
Source

pub fn ge_mask(self, other: Self) -> Mask<N, T, A>
where T: PartialOrd,

Returns a vector mask where each element is true if the corresponding element of self is greater than or equal to the corresponding element of other.

Equivalent to (self.x >= other.x, self.y >= other.y, ...).

§Examples
let vector = Vec3::new(1, 2, 3);
let mask = vector.ge_mask(Vec3::new(0, 2, 5));
assert_eq!(mask, Mask3::new(true, true, false));
Source

pub fn dot(self, rhs: Self) -> T
where T: Add<Output = T> + Mul<Output = T>,

Computes the dot product of self and rhs.

§Panics

When debug assertions or overflow checks are enabled:

For integers this panics if an overflow occurs.

§Examples
let x = Vec3::new(2, 0, 0);
let y = Vec3::new(0, 3, 0);

assert_eq!(x.dot(y), 0);
assert_eq!(x.dot(x), 4);
assert_eq!(y.dot(y), 9);
Source

pub fn length_squared(self) -> T
where T: Add<Output = T> + Mul<Output = T>,

Computes the squared length/magnitude of self.

§Panics

When debug assertions or overflow checks are enabled:

For integers this panics if an overflow occurs.

§Examples
let vector = Vec2::new(1, 2);
assert_eq!(vector.length_squared(), 5);
Source

pub fn distance_squared(self, other: Self) -> T
where T: Neg<Output = T> + Add<Output = T> + Sub<Output = T> + Mul<Output = T>,

Computes the squared Euclidean distance between self and other.

§Panics

When debug assertions or overflow checks are enabled:

For integers this panics if an overflow occurs.

§Examples
let x = Vec3::<i32>::new(2, 0, 0);
let y = Vec3::<i32>::new(0, 3, 0);

assert_eq!(x.distance_squared(y), 13);
assert_eq!(x.distance_squared(x), 0);
assert_eq!(y.distance_squared(y), 0);
Source

pub const fn as_array_ref(&self) -> &[T; N]

👎Deprecated since 0.17.1:

renamed to as_array

Returns a reference to the vector’s elements.

This function has been renamed to as_array.

Source

pub const fn as_array_mut(&mut self) -> &mut [T; N]

👎Deprecated since 0.17.1:

renamed to as_mut_array

Returns a mutable reference to the vector’s elements.

This function has been renamed to as_mut_array.

Source§

impl<T, A: Alignment> Vector<2, T, A>
where T: Scalar + Zero + One,

Source

pub const X: Self

(1, 0).

Source

pub const Y: Self

(0, 1).

Source§

impl<T, A: Alignment> Vector<2, T, A>
where T: Scalar + Zero + NegOne,

Source

pub const NEG_X: Self

(-1, 0).

Source

pub const NEG_Y: Self

(0, -1).

Source§

impl<T, A: Alignment> Vector<2, T, A>
where T: Scalar,

Source

pub const fn new(x: T, y: T) -> Self

Creates a 2-dimensional vector.

Source

pub fn extend(self, value: T) -> Vector<3, T, A>

Returns a 3-dimensional vector containing the elements of self then the scalar value.

Equivalent to (self, value).

Source

pub fn perp(self) -> Self
where T: Neg<Output = T>,

Returns self rotated by 90 degrees.

This rotates +X to +Y.

§Examples
let x = Vec2::new(1, 0);
let y = Vec2::new(0, 1);

assert_eq!(x.perp(), y);
assert_eq!(y.perp(), -x);
assert_eq!((-x).perp(), -y);
assert_eq!((-y).perp(), x);
Source

pub fn wedge(self, rhs: Self) -> T
where T: Neg<Output = T> + Add<Output = T> + Sub<Output = T> + Mul<Output = T>,

Computes the wedge product of self and rhs.

Also reffered to as the 2D cross product, the determinant and the signed area.

§Examples
let x = Vec2::new(1, 0);
let y = Vec2::new(0, 1);

assert_eq!(x.wedge(y), 1);
assert_eq!(y.wedge(x), -1);
Source§

impl<T, A: Alignment> Vector<3, T, A>
where T: Scalar + Zero + One,

Source

pub const X: Self

(1, 0, 0).

Source

pub const Y: Self

(0, 1, 0).

Source

pub const Z: Self

(0, 0, 1).

Source§

impl<T, A: Alignment> Vector<3, T, A>
where T: Scalar + Zero + NegOne,

Source

pub const NEG_X: Self

(-1, 0, 0).

Source

pub const NEG_Y: Self

(0, -1, 0).

Source

pub const NEG_Z: Self

(0, 0, -1).

Source§

impl<T, A: Alignment> Vector<3, T, A>
where T: Scalar,

Source

pub const fn new(x: T, y: T, z: T) -> Self

Creates a 3-dimensional vector.

Source

pub fn extend(self, value: T) -> Vector<4, T, A>

Returns a 4-dimensional vector containing the elements of self then the scalar value.

Equivalent to (self, value).

Source

pub fn truncate(self) -> Vector<2, T, A>

Returns a 2-dimensional vector containing the first 2 elements of self, discarding the last element.

Equivalent to self.xy.

Source

pub fn to_homogeneous(self) -> Vector<4, T, A>
where T: One,

Converts self to homogeneous coordinates.

Equivalent to self.extend(1).

Source

pub fn cross(self, rhs: Self) -> Self
where T: Neg<Output = T> + Add<Output = T> + Sub<Output = T> + Mul<Output = T>,

Computes the cross product of self and rhs.

§Examples
let x = Vec3::new(1, 0, 0);
let y = Vec3::new(0, 1, 0);

assert_eq!(x.cross(y), Vec3::new(0, 0, 1));
assert_eq!(y.cross(x), Vec3::new(0, 0, -1));
Source§

impl<T, A: Alignment> Vector<4, T, A>
where T: Scalar + Zero + One,

Source

pub const X: Self

(1, 0, 0, 0).

Source

pub const Y: Self

(0, 1, 0, 0).

Source

pub const Z: Self

(0, 0, 1, 0).

Source

pub const W: Self

(0, 0, 0, 1).

Source§

impl<T, A: Alignment> Vector<4, T, A>
where T: Scalar + Zero + NegOne,

Source

pub const NEG_X: Self

(-1, 0, 0, 0).

Source

pub const NEG_Y: Self

(0, -1, 0, 0).

Source

pub const NEG_Z: Self

(0, 0, -1, 0).

Source

pub const NEG_W: Self

(0, 0, 0, -1).

Source§

impl<T, A: Alignment> Vector<4, T, A>
where T: Scalar,

Source

pub const fn new(x: T, y: T, z: T, w: T) -> Self

Creates a 4-dimensional vector.

Source

pub fn truncate(self) -> Vector<3, T, A>

Returns a 3-dimensional vector containing the first 3 elements of self, discarding the last element.

Equivalent to self.xyz.

Trait Implementations§

Source§

impl<const N: usize, T, A: Alignment> Add for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 + 4, 2 + 5, 3 + 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + 4;
assert_eq!(b, Vec3::new(1 + 4, 2 + 4, 3 + 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + 4;
assert_eq!(b, Vec3::new(1 + 4, 2 + 4, 3 + 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the + operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 + 4, 2 + 5, 3 + 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the + operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 + 4, 2 + 5, 3 + 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + 4;
assert_eq!(b, Vec3::new(1 + 4, 2 + 4, 3 + 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + 4;
assert_eq!(b, Vec3::new(1 + 4, 2 + 4, 3 + 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> Add<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the + operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a + Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 + 4, 2 + 5, 3 + 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the + operator.
Source§

impl<const N: usize, T, A: Alignment> AddAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector += Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 + 4, 2 + 5, 3 + 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + vector.

Source§

impl<const N: usize, T, A: Alignment> AddAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add_assign(&mut self, rhs: &T)

Performs the += operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector += 4;
assert_eq!(vector, Vec3::new(1 + 4, 2 + 4, 3 + 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + vector.

Source§

impl<const N: usize, T, A: Alignment> AddAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the += operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector += Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 + 4, 2 + 5, 3 + 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + vector.

Source§

impl<const N: usize, T, A: Alignment> AddAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T>,

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector += 4;
assert_eq!(vector, Vec3::new(1 + 4, 2 + 4, 3 + 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector + vector.

Source§

impl<const N: usize, T, A: Alignment> BitAnd for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 & 4, 2 & 5, 3 & 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: &T) -> Self::Output

Performs the & operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & 4;
assert_eq!(b, Vec3::new(1 & 4, 2 & 4, 3 & 4));
§Consistency

This operation is fully consistent with vector & splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: &T) -> Self::Output

Performs the & operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & 4;
assert_eq!(b, Vec3::new(1 & 4, 2 & 4, 3 & 4));
§Consistency

This operation is fully consistent with vector & splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the & operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 & 4, 2 & 5, 3 & 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the & operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 & 4, 2 & 5, 3 & 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: T) -> Self::Output

Performs the & operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & 4;
assert_eq!(b, Vec3::new(1 & 4, 2 & 4, 3 & 4));
§Consistency

This operation is fully consistent with vector & splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: T) -> Self::Output

Performs the & operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & 4;
assert_eq!(b, Vec3::new(1 & 4, 2 & 4, 3 & 4));
§Consistency

This operation is fully consistent with vector & splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAnd<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the & operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a & Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 & 4, 2 & 5, 3 & 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the & operator.
Source§

impl<const N: usize, T, A: Alignment> BitAndAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector &= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 & 4, 2 & 5, 3 & 6));
§Consistency

This operation is fully consistent with vector & vector.

Source§

impl<const N: usize, T, A: Alignment> BitAndAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand_assign(&mut self, rhs: &T)

Performs the &= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector &= 4;
assert_eq!(vector, Vec3::new(1 & 4, 2 & 4, 3 & 4));
§Consistency

This operation is fully consistent with vector & vector.

Source§

impl<const N: usize, T, A: Alignment> BitAndAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the &= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector &= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 & 4, 2 & 5, 3 & 6));
§Consistency

This operation is fully consistent with vector & vector.

Source§

impl<const N: usize, T, A: Alignment> BitAndAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitAnd<Output = T>,

Source§

fn bitand_assign(&mut self, rhs: T)

Performs the &= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector &= 4;
assert_eq!(vector, Vec3::new(1 & 4, 2 & 4, 3 & 4));
§Consistency

This operation is fully consistent with vector & vector.

Source§

impl<const N: usize, T, A: Alignment> BitOr for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 | 4, 2 | 5, 3 | 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: &T) -> Self::Output

Performs the | operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | 4;
assert_eq!(b, Vec3::new(1 | 4, 2 | 4, 3 | 4));
§Consistency

This operation is fully consistent with vector | splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: &T) -> Self::Output

Performs the | operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | 4;
assert_eq!(b, Vec3::new(1 | 4, 2 | 4, 3 | 4));
§Consistency

This operation is fully consistent with vector | splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the | operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 | 4, 2 | 5, 3 | 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the | operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 | 4, 2 | 5, 3 | 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: T) -> Self::Output

Performs the | operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | 4;
assert_eq!(b, Vec3::new(1 | 4, 2 | 4, 3 | 4));
§Consistency

This operation is fully consistent with vector | splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: T) -> Self::Output

Performs the | operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | 4;
assert_eq!(b, Vec3::new(1 | 4, 2 | 4, 3 | 4));
§Consistency

This operation is fully consistent with vector | splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOr<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the | operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a | Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 | 4, 2 | 5, 3 | 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the | operator.
Source§

impl<const N: usize, T, A: Alignment> BitOrAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector |= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 | 4, 2 | 5, 3 | 6));
§Consistency

This operation is fully consistent with vector | vector.

Source§

impl<const N: usize, T, A: Alignment> BitOrAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor_assign(&mut self, rhs: &T)

Performs the |= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector |= 4;
assert_eq!(vector, Vec3::new(1 | 4, 2 | 4, 3 | 4));
§Consistency

This operation is fully consistent with vector | vector.

Source§

impl<const N: usize, T, A: Alignment> BitOrAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the |= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector |= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 | 4, 2 | 5, 3 | 6));
§Consistency

This operation is fully consistent with vector | vector.

Source§

impl<const N: usize, T, A: Alignment> BitOrAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitOr<Output = T>,

Source§

fn bitor_assign(&mut self, rhs: T)

Performs the |= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector |= 4;
assert_eq!(vector, Vec3::new(1 | 4, 2 | 4, 3 | 4));
§Consistency

This operation is fully consistent with vector | vector.

Source§

impl<const N: usize, T, A: Alignment> BitXor for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 5, 3 ^ 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: &T) -> Self::Output

Performs the ^ operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ 4;
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 4, 3 ^ 4));
§Consistency

This operation is fully consistent with vector ^ splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: &T) -> Self::Output

Performs the ^ operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ 4;
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 4, 3 ^ 4));
§Consistency

This operation is fully consistent with vector ^ splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the ^ operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 5, 3 ^ 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the ^ operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 5, 3 ^ 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: T) -> Self::Output

Performs the ^ operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ 4;
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 4, 3 ^ 4));
§Consistency

This operation is fully consistent with vector ^ splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: T) -> Self::Output

Performs the ^ operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ 4;
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 4, 3 ^ 4));
§Consistency

This operation is fully consistent with vector ^ splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXor<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the ^ operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a ^ Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 ^ 4, 2 ^ 5, 3 ^ 6));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the ^ operator.
Source§

impl<const N: usize, T, A: Alignment> BitXorAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector ^= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 ^ 4, 2 ^ 5, 3 ^ 6));
§Consistency

This operation is fully consistent with vector ^ vector.

Source§

impl<const N: usize, T, A: Alignment> BitXorAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor_assign(&mut self, rhs: &T)

Performs the ^= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector ^= 4;
assert_eq!(vector, Vec3::new(1 ^ 4, 2 ^ 4, 3 ^ 4));
§Consistency

This operation is fully consistent with vector ^ vector.

Source§

impl<const N: usize, T, A: Alignment> BitXorAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the ^= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector ^= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 ^ 4, 2 ^ 5, 3 ^ 6));
§Consistency

This operation is fully consistent with vector ^ vector.

Source§

impl<const N: usize, T, A: Alignment> BitXorAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + BitXor<Output = T>,

Source§

fn bitxor_assign(&mut self, rhs: T)

Performs the ^= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector ^= 4;
assert_eq!(vector, Vec3::new(1 ^ 4, 2 ^ 4, 3 ^ 4));
§Consistency

This operation is fully consistent with vector ^ vector.

Source§

impl<const N: usize, T, A: Alignment> Clone for Vector<N, T, A>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize, T, A: Alignment> Copy for Vector<N, T, A>

Source§

impl<const N: usize, T, A: Alignment> Debug for Vector<N, T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize, T, A: Alignment> Default for Vector<N, T, A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T, A: Alignment> Deref for Vector<2, T, A>
where T: Scalar,

Source§

type Target = Vec2Fields<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T, A: Alignment> Deref for Vector<3, T, A>
where T: Scalar,

Source§

type Target = Vec3Fields<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T, A: Alignment> Deref for Vector<4, T, A>
where T: Scalar,

Source§

type Target = Vec4Fields<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T, A: Alignment> DerefMut for Vector<2, T, A>
where T: Scalar,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T, A: Alignment> DerefMut for Vector<3, T, A>
where T: Scalar,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T, A: Alignment> DerefMut for Vector<4, T, A>
where T: Scalar,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<const N: usize, T, A: Alignment> Display for Vector<N, T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize, T, A: Alignment> Div for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation for each vector element.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / Vec3::new(2, 5, 3);
assert_eq!(b, Vec3::new(8 / 2, 10 / 5, 12 / 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / 2;
assert_eq!(b, Vec3::new(8 / 2, 10 / 2, 12 / 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / 2;
assert_eq!(b, Vec3::new(8 / 2, 10 / 2, 12 / 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the / operation for each vector element.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / Vec3::new(2, 5, 3);
assert_eq!(b, Vec3::new(8 / 2, 10 / 5, 12 / 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the / operation for each vector element.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / Vec3::new(2, 5, 3);
assert_eq!(b, Vec3::new(8 / 2, 10 / 5, 12 / 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / 2;
assert_eq!(b, Vec3::new(8 / 2, 10 / 2, 12 / 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / 2;
assert_eq!(b, Vec3::new(8 / 2, 10 / 2, 12 / 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> Div<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the / operation for each vector element.

§Examples
let a = Vec3::new(8, 10, 12);
let b = a / Vec3::new(2, 5, 3);
assert_eq!(b, Vec3::new(8 / 2, 10 / 5, 12 / 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the / operator.
Source§

impl<const N: usize, T, A: Alignment> DivAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation for each vector element.

§Examples
let mut vector = Vec3::new(8, 10, 12);
vector /= Vec3::new(2, 5, 3);
assert_eq!(vector, Vec3::new(8 / 2, 10 / 5, 12 / 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / vector.

Source§

impl<const N: usize, T, A: Alignment> DivAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div_assign(&mut self, rhs: &T)

Performs the /= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(8, 10, 12);
vector /= 2;
assert_eq!(vector, Vec3::new(8 / 2, 10 / 2, 12 / 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / vector.

Source§

impl<const N: usize, T, A: Alignment> DivAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the /= operation for each vector element.

§Examples
let mut vector = Vec3::new(8, 10, 12);
vector /= Vec3::new(2, 5, 3);
assert_eq!(vector, Vec3::new(8 / 2, 10 / 5, 12 / 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / vector.

Source§

impl<const N: usize, T, A: Alignment> DivAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Div<Output = T>,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(8, 10, 12);
vector /= 2;
assert_eq!(vector, Vec3::new(8 / 2, 10 / 2, 12 / 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector / vector.

Source§

impl<const N: usize, T, A: Alignment> Eq for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Eq,

Source§

impl<T, A: Alignment> From<(T, T)> for Vector<2, T, A>
where T: Scalar,

Source§

fn from(value: (T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(T, T, T)> for Vector<3, T, A>
where T: Scalar,

Source§

fn from(value: (T, T, T)) -> Self

Converts to this type from the input type.
Source§

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

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(T, T, Vector<2, T, A>)> for Vector<4, T, A>
where T: Scalar,

Source§

fn from(value: (T, T, Vector<2, T, A>)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(T, Vector<2, T, A>)> for Vector<3, T, A>
where T: Scalar,

Source§

fn from(value: (T, Vector<2, T, A>)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(T, Vector<2, T, A>, T)> for Vector<4, T, A>
where T: Scalar,

Source§

fn from(value: (T, Vector<2, T, A>, T)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(T, Vector<3, T, A>)> for Vector<4, T, A>
where T: Scalar,

Source§

fn from(value: (T, Vector<3, T, A>)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(Vector<2, T, A>, T)> for Vector<3, T, A>
where T: Scalar,

Source§

fn from(value: (Vector<2, T, A>, T)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(Vector<2, T, A>, T, T)> for Vector<4, T, A>
where T: Scalar,

Source§

fn from(value: (Vector<2, T, A>, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(Vector<2, T, A>, Vector<2, T, A>)> for Vector<4, T, A>
where T: Scalar,

Source§

fn from(value: (Vector<2, T, A>, Vector<2, T, A>)) -> Self

Converts to this type from the input type.
Source§

impl<T, A: Alignment> From<(Vector<3, T, A>, T)> for Vector<4, T, A>
where T: Scalar,

Source§

fn from(value: (Vector<3, T, A>, T)) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize, T, A: Alignment> Hash for Vector<N, T, A>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<const N: usize, T, A: Alignment> Index<usize> for Vector<N, T, A>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<const N: usize, T, A: Alignment> IndexMut<usize> for Vector<N, T, A>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<const N: usize, T, A: Alignment> IntoIterator for Vector<N, T, A>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = <[T; N] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<const N: usize, T, A: Alignment> IntoIterator for &Vector<N, T, A>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = <[T; N] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, const N: usize, T, A: Alignment> IntoIterator for &'a mut Vector<N, T, A>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = <&'a mut [T; N] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<const N: usize, T, A: Alignment> Mul for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 * 4, 2 * 5, 3 * 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<&Matrix<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T> + Mul<Output = T>,

Source§

fn mul(self, rhs: &Matrix<N, T, A>) -> Self::Output

Vector-matrix multiplication.

Because vectors are treated as row matrices, they always go on the left-hand side.

Equivalent to self.x * rhs.x_axis + self.y * rhs.y_axis + ....

§Consistency

For primitive types this operation is cross-platform deterministic and fully consistent with scalar addition and multiplication, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<&Matrix<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T> + Mul<Output = T>,

Source§

fn mul(self, rhs: &Matrix<N, T, A>) -> Self::Output

Vector-matrix multiplication.

Because vectors are treated as row matrices, they always go on the left-hand side.

Equivalent to self.x * rhs.x_axis + self.y * rhs.y_axis + ....

§Consistency

For primitive types this operation is cross-platform deterministic and fully consistent with scalar addition and multiplication, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * 4;
assert_eq!(b, Vec3::new(1 * 4, 2 * 4, 3 * 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * 4;
assert_eq!(b, Vec3::new(1 * 4, 2 * 4, 3 * 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the * operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 * 4, 2 * 5, 3 * 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the * operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 * 4, 2 * 5, 3 * 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<Matrix<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T> + Mul<Output = T>,

Source§

fn mul(self, rhs: Matrix<N, T, A>) -> Self::Output

Vector-matrix multiplication.

Because vectors are treated as row matrices, they always go on the left-hand side.

Equivalent to self.x * rhs.x_axis + self.y * rhs.y_axis + ....

§Consistency

For primitive types this operation is cross-platform deterministic and fully consistent with scalar addition and multiplication, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<Matrix<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T> + Mul<Output = T>,

Source§

fn mul(self, rhs: Matrix<N, T, A>) -> Self::Output

Vector-matrix multiplication.

Because vectors are treated as row matrices, they always go on the left-hand side.

Equivalent to self.x * rhs.x_axis + self.y * rhs.y_axis + ....

§Consistency

For primitive types this operation is cross-platform deterministic and fully consistent with scalar addition and multiplication, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<T, A: Alignment> Mul<Quaternion<T, A>> for Vector<3, T, A>
where T: Scalar + Neg<Output = T> + Add<Output = T> + Sub<Output = T> + Mul<Output = T>,

Source§

fn mul(self, rhs: Quaternion<T, A>) -> Self::Output

3D vector quaternion multiplication. Returns the rotated vector.

Source§

type Output = Vector<3, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * 4;
assert_eq!(b, Vec3::new(1 * 4, 2 * 4, 3 * 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * 4;
assert_eq!(b, Vec3::new(1 * 4, 2 * 4, 3 * 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> Mul<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the * operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a * Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 * 4, 2 * 5, 3 * 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the * operator.
Source§

impl<const N: usize, T, A: Alignment> MulAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector *= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 * 4, 2 * 5, 3 * 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * vector.

Source§

impl<const N: usize, T, A: Alignment> MulAssign<&Matrix<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T> + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: &Matrix<N, T, A>)

Vector-matrix multiplication.

Because vectors are treated as row matrices, they always go on the left-hand side.

Equivalent to self.x * rhs.x_axis + self.y * rhs.y_axis + ....

§Consistency

For primitive types this operation is cross-platform deterministic and fully consistent with scalar addition and multiplication, including floating-point precision and integer panics.

Source§

impl<const N: usize, T, A: Alignment> MulAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: &T)

Performs the *= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector *= 4;
assert_eq!(vector, Vec3::new(1 * 4, 2 * 4, 3 * 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * vector.

Source§

impl<const N: usize, T, A: Alignment> MulAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the *= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector *= Vec3::new(4, 5, 6);
assert_eq!(vector, Vec3::new(1 * 4, 2 * 5, 3 * 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * vector.

Source§

impl<const N: usize, T, A: Alignment> MulAssign<Matrix<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Add<Output = T> + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: Matrix<N, T, A>)

Vector-matrix multiplication.

Because vectors are treated as row matrices, they always go on the left-hand side.

Equivalent to self.x * rhs.x_axis + self.y * rhs.y_axis + ....

§Consistency

For primitive types this operation is cross-platform deterministic and fully consistent with scalar addition and multiplication, including floating-point precision and integer panics.

Source§

impl<T, A: Alignment> MulAssign<Quaternion<T, A>> for Vector<3, T, A>
where T: Scalar + Neg<Output = T> + Add<Output = T> + Sub<Output = T> + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: Quaternion<T, A>)

3D vector quaternion multiplication. Returns the rotated vector.

Source§

impl<const N: usize, T, A: Alignment> MulAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Mul<Output = T>,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector *= 4;
assert_eq!(vector, Vec3::new(1 * 4, 2 * 4, 3 * 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector * vector.

Source§

impl<const N: usize, T, A: Alignment> Neg for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Neg<Output = T>,

Source§

fn neg(self) -> Self::Output

Performs the unary - operation for each vector element.

§Examples
let vector = -Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(-1, -2, -3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Neg for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Neg<Output = T>,

Source§

fn neg(self) -> Self::Output

Performs the unary - operation for each vector element.

§Examples
let vector = -Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(-1, -2, -3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Not for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Not<Output = T>,

Source§

fn not(self) -> Self::Output

Performs the unary ! operation for each vector element.

§Examples
let vector = !Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(!1, !2, !3));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the ! operator.
Source§

impl<const N: usize, T, A: Alignment> Not for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Not<Output = T>,

Source§

fn not(self) -> Self::Output

Performs the unary ! operation for each vector element.

§Examples
let vector = !Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(!1, !2, !3));
Source§

type Output = Vector<N, T, A>

The resulting type after applying the ! operator.
Source§

impl<const N: usize, T, A: Alignment> PartialEq for Vector<N, T, A>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
Source§

fn ne(&self, other: &Self) -> bool

Inequality operator !=. Read more
Source§

impl<const N: usize, T, A: Alignment> RefUnwindSafe for Vector<N, T, A>

Source§

impl<const N: usize, T, A: Alignment> Rem for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation for each vector element.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % Vec3::new(2, 3, 4);
assert_eq!(b, Vec3::new(5 % 2, 7 % 3, 9 % 4));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: &T) -> Self::Output

Performs the % operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % 2;
assert_eq!(b, Vec3::new(5 % 2, 7 % 2, 9 % 2));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: &T) -> Self::Output

Performs the % operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % 2;
assert_eq!(b, Vec3::new(5 % 2, 7 % 2, 9 % 2));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the % operation for each vector element.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % Vec3::new(2, 3, 4);
assert_eq!(b, Vec3::new(5 % 2, 7 % 3, 9 % 4));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the % operation for each vector element.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % Vec3::new(2, 3, 4);
assert_eq!(b, Vec3::new(5 % 2, 7 % 3, 9 % 4));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % 2;
assert_eq!(b, Vec3::new(5 % 2, 7 % 2, 9 % 2));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % 2;
assert_eq!(b, Vec3::new(5 % 2, 7 % 2, 9 % 2));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> Rem<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the % operation for each vector element.

§Examples
let a = Vec3::new(5, 7, 9);
let b = a % Vec3::new(2, 3, 4);
assert_eq!(b, Vec3::new(5 % 2, 7 % 3, 9 % 4));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the % operator.
Source§

impl<const N: usize, T, A: Alignment> RemAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation for each vector element.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector %= Vec3::new(2, 3, 4);
assert_eq!(vector, Vec3::new(5 % 2, 7 % 3, 9 % 4));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % vector.

Source§

impl<const N: usize, T, A: Alignment> RemAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem_assign(&mut self, rhs: &T)

Performs the %= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector %= 2;
assert_eq!(vector, Vec3::new(5 % 2, 7 % 2, 9 % 2));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % vector.

Source§

impl<const N: usize, T, A: Alignment> RemAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the %= operation for each vector element.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector %= Vec3::new(2, 3, 4);
assert_eq!(vector, Vec3::new(5 % 2, 7 % 3, 9 % 4));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % vector.

Source§

impl<const N: usize, T, A: Alignment> RemAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Rem<Output = T>,

Source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector %= 2;
assert_eq!(vector, Vec3::new(5 % 2, 7 % 2, 9 % 2));
§Consistency

For integers this operation is fully consistent with the scalar operation, including panics.

For floats this operation may be inconsistent with the scalar operation, regarding precision and NaN propagation.

This operation is fully consistent with vector % vector.

Source§

impl<const N: usize, T, A: Alignment> Send for Vector<N, T, A>

Source§

impl<const N: usize, T, A: Alignment> Shl for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: Self) -> Self::Output

Performs the << operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(1 << 1, 2 << 2, 3 << 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: &T) -> Self::Output

Performs the << operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << 1;
assert_eq!(b, Vec3::new(1 << 1, 2 << 1, 3 << 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: &T) -> Self::Output

Performs the << operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << 1;
assert_eq!(b, Vec3::new(1 << 1, 2 << 1, 3 << 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the << operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(1 << 1, 2 << 2, 3 << 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the << operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(1 << 1, 2 << 2, 3 << 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: T) -> Self::Output

Performs the << operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << 1;
assert_eq!(b, Vec3::new(1 << 1, 2 << 1, 3 << 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: T) -> Self::Output

Performs the << operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << 1;
assert_eq!(b, Vec3::new(1 << 1, 2 << 1, 3 << 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> Shl<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the << operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a << Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(1 << 1, 2 << 2, 3 << 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the << operator.
Source§

impl<const N: usize, T, A: Alignment> ShlAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl_assign(&mut self, rhs: Self)

Performs the <<= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector <<= Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(1 << 1, 2 << 2, 3 << 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << vector.

Source§

impl<const N: usize, T, A: Alignment> ShlAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl_assign(&mut self, rhs: &T)

Performs the <<= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector <<= 1;
assert_eq!(vector, Vec3::new(1 << 1, 2 << 1, 3 << 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << vector.

Source§

impl<const N: usize, T, A: Alignment> ShlAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the <<= operation for each vector element.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector <<= Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(1 << 1, 2 << 2, 3 << 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << vector.

Source§

impl<const N: usize, T, A: Alignment> ShlAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shl<Output = T>,

Source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(1, 2, 3);
vector <<= 1;
assert_eq!(vector, Vec3::new(1 << 1, 2 << 1, 3 << 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector << vector.

Source§

impl<const N: usize, T, A: Alignment> Shr for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: Self) -> Self::Output

Performs the >> operation for each vector element.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 2, 32 >> 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: &T) -> Self::Output

Performs the >> operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> 1;
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 1, 32 >> 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: &T) -> Self::Output

Performs the >> operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> 1;
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 1, 32 >> 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the >> operation for each vector element.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 2, 32 >> 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the >> operation for each vector element.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 2, 32 >> 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: T) -> Self::Output

Performs the >> operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> 1;
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 1, 32 >> 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: T) -> Self::Output

Performs the >> operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> 1;
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 1, 32 >> 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> Shr<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the >> operation for each vector element.

§Examples
let a = Vec3::new(8, 16, 32);
let b = a >> Vec3::new(1, 2, 3);
assert_eq!(b, Vec3::new(8 >> 1, 16 >> 2, 32 >> 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the >> operator.
Source§

impl<const N: usize, T, A: Alignment> ShrAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr_assign(&mut self, rhs: Self)

Performs the >>= operation for each vector element.

§Examples
let mut vector = Vec3::new(8, 16, 32);
vector >>= Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(8 >> 1, 16 >> 2, 32 >> 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> vector.

Source§

impl<const N: usize, T, A: Alignment> ShrAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr_assign(&mut self, rhs: &T)

Performs the >>= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(8, 16, 32);
vector >>= 1;
assert_eq!(vector, Vec3::new(8 >> 1, 16 >> 1, 32 >> 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> vector.

Source§

impl<const N: usize, T, A: Alignment> ShrAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the >>= operation for each vector element.

§Examples
let mut vector = Vec3::new(8, 16, 32);
vector >>= Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(8 >> 1, 16 >> 2, 32 >> 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> vector.

Source§

impl<const N: usize, T, A: Alignment> ShrAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Shr<Output = T>,

Source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(8, 16, 32);
vector >>= 1;
assert_eq!(vector, Vec3::new(8 >> 1, 16 >> 1, 32 >> 1));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including integer panics.

This operation is fully consistent with vector >> vector.

Source§

impl<const N: usize, T, A: Alignment> Sub for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 - 4, 2 - 5, 3 - 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - 4;
assert_eq!(b, Vec3::new(1 - 4, 2 - 4, 3 - 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<&T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - 4;
assert_eq!(b, Vec3::new(1 - 4, 2 - 4, 3 - 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the - operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 - 4, 2 - 5, 3 - 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<&Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: &Vector<N, T, A>) -> Self::Output

Performs the - operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 - 4, 2 - 5, 3 - 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - 4;
assert_eq!(b, Vec3::new(1 - 4, 2 - 4, 3 - 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<T> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation for each vector element and the scalar rhs.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - 4;
assert_eq!(b, Vec3::new(1 - 4, 2 - 4, 3 - 4));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - splat(scalar).

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> Sub<Vector<N, T, A>> for &Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub(self, rhs: Vector<N, T, A>) -> Self::Output

Performs the - operation for each vector element.

§Examples
let a = Vec3::new(1, 2, 3);
let b = a - Vec3::new(4, 5, 6);
assert_eq!(b, Vec3::new(1 - 4, 2 - 5, 3 - 6));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

Source§

type Output = Vector<N, T, A>

The resulting type after applying the - operator.
Source§

impl<const N: usize, T, A: Alignment> SubAssign for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation for each vector element.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector -= Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(5 - 1, 7 - 2, 9 - 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - vector.

Source§

impl<const N: usize, T, A: Alignment> SubAssign<&T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub_assign(&mut self, rhs: &T)

Performs the -= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector -= 2;
assert_eq!(vector, Vec3::new(5 - 2, 7 - 2, 9 - 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - vector.

Source§

impl<const N: usize, T, A: Alignment> SubAssign<&Vector<N, T, A>> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub_assign(&mut self, rhs: &Vector<N, T, A>)

Performs the -= operation for each vector element.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector -= Vec3::new(1, 2, 3);
assert_eq!(vector, Vec3::new(5 - 1, 7 - 2, 9 - 3));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - vector.

Source§

impl<const N: usize, T, A: Alignment> SubAssign<T> for Vector<N, T, A>
where Length<N>: SupportedLength, T: Scalar + Sub<Output = T>,

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation for each vector element and the scalar rhs.

§Examples
let mut vector = Vec3::new(5, 7, 9);
vector -= 2;
assert_eq!(vector, Vec3::new(5 - 2, 7 - 2, 9 - 2));
§Consistency

For primitive types this operation is fully consistent with the scalar operation, including floating-point precision and integer panics.

This operation is fully consistent with vector - vector.

Source§

impl<const N: usize, T, A: Alignment> Sync for Vector<N, T, A>

Source§

impl<const N: usize, T, A: Alignment> Unpin for Vector<N, T, A>

Source§

impl<const N: usize, T, A: Alignment> UnwindSafe for Vector<N, T, A>

Auto Trait Implementations§

§

impl<const N: usize, T, A> Freeze for Vector<N, T, A>
where <A as Alignment>::Select<<Length<N> as SupportedLength>::Select<<T as VectorBackend<2, Aligned>>::Inner, <T as VectorBackend<3, Aligned>>::Inner, <T as VectorBackend<4, Aligned>>::Inner>, <Length<N> as SupportedLength>::Select<<T as VectorBackend<2, Unaligned>>::Inner, <T as VectorBackend<3, Unaligned>>::Inner, <T as VectorBackend<4, Unaligned>>::Inner>>: Freeze,

§

impl<const N: usize, T, A> UnsafeUnpin for Vector<N, T, A>
where <A as Alignment>::Select<<Length<N> as SupportedLength>::Select<<T as VectorBackend<2, Aligned>>::Inner, <T as VectorBackend<3, Aligned>>::Inner, <T as VectorBackend<4, Aligned>>::Inner>, <Length<N> as SupportedLength>::Select<<T as VectorBackend<2, Unaligned>>::Inner, <T as VectorBackend<3, Unaligned>>::Inner, <T as VectorBackend<4, Unaligned>>::Inner>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.