Struct Vec4

Source
#[repr(C)]
pub struct Vec4<T> { pub x: T, pub y: T, pub z: T, pub w: T, }
Expand description

Vec4 vector.

Fields§

§x: T§y: T§z: T§w: T

Implementations§

Source§

impl<T> Vec4<T>

Source

pub const fn new(x: T, y: T, z: T, w: T) -> Vec4<T>

Constructs a new vector from components.

Source

pub const fn dup(u: T) -> Vec4<T>
where T: Copy,

Constructs a new vector by broadcasting to all its components.

Source§

impl<T: Zero> Vec4<T>

Source

pub const ZERO: Vec4<T>

Vec4 of all zero.

Source

pub const fn zero() -> Vec4<T>

Returns the origin for the vector space.

Source§

impl<T: One> Vec4<T>

Source

pub const ONE: Vec4<T>

Vec4 of all one.

Source§

impl<T: Zero + One> Vec4<T>

Source

pub const X: Vec4<T>

Unit vector in the x direction.

Source

pub const Y: Vec4<T>

Unit vector in the y direction.

Source

pub const Z: Vec4<T>

Unit vector in the z direction.

Source

pub const W: Vec4<T>

Unit vector in the w direction.

Source§

impl<T> Vec4<T>

Source

pub fn set_x(self, x: T) -> Vec4<T>

Sets the x component.

Source

pub fn set_y(self, y: T) -> Vec4<T>

Sets the y component.

Source

pub fn set_z(self, z: T) -> Vec4<T>

Sets the z component.

Source

pub fn set_w(self, w: T) -> Vec4<T>

Sets the w component.

Source

pub fn xy(self) -> Vec2<T>

Drops the z and w coordinates.

Source

pub fn xyz(self) -> Vec3<T>

Drops the w component.

Source§

impl<T: Copy> Vec4<T>

Source

pub fn get<C>(self, _: C) -> T
where Self: ComponentImpl<T, C>,

Gets a component generically.

Source

pub fn shuffle<X, Y, Z, W>(self, x: X, y: Y, z: Z, w: W) -> Vec4<T>
where Self: ComponentImpl<T, X> + ComponentImpl<T, Y> + ComponentImpl<T, Z> + ComponentImpl<T, W>,

Shuffles the components.

Source§

impl<T> Vec4<T>

Source

pub fn cast<U>(self) -> Vec4<U>
where T: CastTo<U>,

Casts to a vector of different type with the same dimensions.

Source

pub fn map<U, F>(self, f: F) -> Vec4<U>
where F: FnMut(T) -> U,

Maps a callable over the components.

Source

pub fn zip<U, F>(self, rhs: Vec4<T>, f: F) -> Vec4<U>
where F: FnMut(T, T) -> U,

Zips two vectors together.

Source

pub fn reduce<F>(self, f: F) -> T
where F: Fn(T, T) -> T,

Reduces the vector.

Source

pub fn fold<A, F>(self, acc: A, f: F) -> A
where F: Fn(A, T) -> A,

Folds the vector.

Source§

impl<T> Vec4<T>

Source

pub fn as_bytes(&self) -> &[u8]

Source§

impl<T: Scalar> Vec4<T>

Operations on vectors of scalars.

Source

pub fn sqr(self) -> Vec4<T>

Squares the components.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: -3, y: 4 };
assert_eq!(Vec2(9, 16), this.sqr());

let this = Vec3 { x: 2, y: 3, z: -6 };
assert_eq!(Vec3(4, 9, 36), this.sqr());
Source

pub fn len_sqr(self) -> T

Calculates the squared length of the vector.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: -3, y: 4 };
assert_eq!(25, this.len_sqr());

let this = Vec3 { x: 2, y: -3, z: 6 };
assert_eq!(49, this.len_sqr());
Source

pub fn len(self) -> T
where T: Float,

Calculates the length of the vector.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: -3.0, y: 4.0 };
assert_eq!(5.0, this.len());

let this = Vec3 { x: -2.0, y: 3.0, z: -6.0 };
assert_eq!(7.0, this.len());
Source

pub fn len_hat(self) -> T

Calculates the manhattan length of the vector.

thisxy
use cvmath::{Vec2, Vec3};

let this = Vec2 { x: 3, y: 4 };
assert_eq!(7, this.len_hat());

let this = Vec3 { x: 2, y: -3, z: -6 };
assert_eq!(11, this.len_hat());
Source

pub fn distance_sqr(self, to: Vec4<T>) -> T

Calculates the squared euclidean distance to another vector.

use cvmath::Vec2;

let this = Vec2 { x: 1, y: 1 };
let to = Vec2 { x: 2, y: 2 };
assert_eq!(2, this.distance_sqr(to));
Source

pub fn distance(self, to: Vec4<T>) -> T
where T: Float,

Calculates the euclidean distance to another vector.

use cvmath::Vec2;

let this = Vec2 { x: 10.0, y: 10.0 };
let to = Vec2 { x: 13.0, y: 14.0 };
assert_eq!(5.0, this.distance(to));
Source

pub fn distance_hat(self, to: Vec4<T>) -> T

Calculates the manhattan distance to another vector.

thistoxy
use cvmath::{Vec2, Vec3};

let this = Vec2 { x: 1.0, y: 5.0 };
let to = Vec2 { x: 5.0, y: 2.0 };
assert_eq!(7.0, this.distance_hat(to));

let this = Vec3 { x: 1.0, y: 5.0, z: -1.0 };
let to = Vec3 { x: 2.0, y: 3.0, z: 1.0 };
assert_eq!(5.0, this.distance_hat(to));
Source

pub fn normalize(self) -> Vec4<T>
where T: Float,

Normalizes the vector.

After normalizing the vector has the length 1.0 except the zero vector remains zero.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: 3.0, y: -4.0 };
assert_eq!(Vec2(0.6, -0.8), this.normalize());

let this = Vec3 { x: 0.0, y: 0.0, z: 0.0 };
assert_eq!(this, this.normalize());
Source

pub fn normalize_len(self) -> (Vec4<T>, T)
where T: Float,

Calculates the normalized vector and its length.

After normalizing the vector has the length 1.0 except the zero vector remains zero.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: 3.0, y: -4.0 };
assert_eq!((Vec2(0.6, -0.8), 5.0), this.normalize_len());

let this = Vec3 { x: 0.0, y: 0.0, z: 0.0 };
assert_eq!((this, 0.0), this.normalize_len());
Source

pub fn resize(self, len: T) -> Vec4<T>
where T: Float,

Resizes the vector to the given length.

The zero vector remains zero.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: -3.0, y: -4.0 };
assert_eq!(Vec2(-1.5, -2.0), this.resize(2.5));

let this = Vec3 { x: 0.0, y: 0.0, z: 0.0 };
assert_eq!(Vec3(0.0, 0.0, 0.0), this.resize(2.0));
Source

pub fn project_scalar(self, v: Vec4<T>) -> T
where T: Float,

Calculates the length of self projected onto v.

selfv
use cvmath::{Vec2, Vec3};

let this = Vec2 { x: 1.0, y: 2.0 };
let v = Vec2 { x: 3.0, y: 4.0 };
assert_eq!(2.2, this.project_scalar(v));

let this = Vec3 { x: 1.0, y: 4.0, z: 0.0 };
let v = Vec3 { x: 4.0, y: 2.0, z: 4.0 };
assert_eq!(2.0, this.project_scalar(v));
Source

pub fn project(self, v: Vec4<T>) -> Vec4<T>
where T: Float,

Projection of self onto v.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: -5.0, y: -2.5 };
let v = Vec2 { x: 3.0, y: 4.0 };
assert_eq!(Vec2(-3.0, -4.0), this.project(v));

let this = Vec3 { x: -5.0, y: -2.5, z: 0.0 };
let v = Vec3 { x: 3.0, y: 4.0, z: 0.0 };
assert_eq!(Vec3(-3.0, -4.0, 0.0), this.project(v));
Source

pub fn project_sat(self, v: Vec4<T>) -> Vec4<T>

Projection of self onto v clamped to v.

use cvmath::Vec2;

let this = Vec2 { x: -5.0, y: -2.5 };
let v = Vec2 { x: 3.0, y: 4.0 };
assert_eq!(Vec2(0.0, 0.0), this.project_sat(v));
Source

pub fn reflect(self, v: Vec4<T>) -> Vec4<T>
where T: Float,

Reflects self around v.

vselfpresult-self+p
use cvmath::Vec2;

let this = Vec2 { x: 1.0, y: 3.0 };
let v = Vec2 { x: 4.0, y: 4.0 };
assert_eq!(Vec2(3.0, 1.0), this.reflect(v));
Source

pub fn hdiv(self) -> Vec3<T>

Homogeneous divide.

Source

pub fn dot(self, rhs: Vec4<T>) -> T

Calculates the dot product.

use cvmath::Vec3;

let lhs = Vec3 { x: 1, y: 2, z: 3 };
let rhs = Vec3 { x: 4, y: -5, z: 6 };
assert_eq!(12, Vec3::dot(lhs, rhs));
Source

pub fn cos_angle(self, rhs: Vec4<T>) -> T
where T: Float,

Calculates the cosine of the angle between two vectors.

use cvmath::Vec2;

let lhs = Vec2 { x: 1.0, y: 1.0 };
let rhs = Vec2 { x: 1.0, y: 0.0 };
let sqrt_2_div_2 = 1.0 / 2_f32.sqrt(); // √2 ÷ 2
assert_eq!(sqrt_2_div_2, lhs.cos_angle(rhs));
Source

pub fn angle(self, rhs: Vec4<T>) -> Rad<T>
where T: Float,

Calculates the angle between two vectors.

use cvmath::{Deg, Vec2};

let lhs = Vec2 { x: 1.0, y: 1.0 };
let rhs = Vec2 { x: 1.0, y: 0.0 };
assert_eq!(Deg(45_f32), lhs.angle(rhs).to_deg());
Source

pub fn hadd(self) -> T

Horizontal adds all components.

use cvmath::{Vec2, Vec3};

let this = Vec2 { x: -2, y: 7 };
assert_eq!(5, this.hadd());

let this = Vec3 { x: 3, y: 4, z: 5 };
assert_eq!(12, this.hadd());
Source

pub fn abs(self) -> Vec4<T>

Component-wise absolute value.

use cvmath::Vec2;

let this = Vec2 { x: -3, y: 5 };
assert_eq!(Vec2(3, 5), this.abs());
Source

pub fn min(self, rhs: Vec4<T>) -> Vec4<T>

Component-wise minimum value.

use cvmath::Vec2;

let lhs = Vec2 { x: -3, y: 5 };
let rhs = Vec2 { x: 0, y: 2 };
assert_eq!(Vec2(-3, 2), lhs.min(rhs));
Source

pub fn vmin(self) -> T

Horizontal minimum value.

Source

pub fn max(self, rhs: Vec4<T>) -> Vec4<T>

Component-wise maximum value.

use cvmath::Vec2;

let lhs = Vec2 { x: -3, y: 5 };
let rhs = Vec2 { x: 0, y: 2 };
assert_eq!(Vec2(0, 5), lhs.max(rhs));
Source

pub fn vmax(self) -> T

Horizontal maximum value.

Source

pub fn mul_add(self, vec: Vec4<T>, scale: T) -> Vec4<T>

Adds the scaled vector.

Equivalent to self + (vec * scale) with less rounding errors.

Source

pub fn lerp(self, rhs: Vec4<T>, t: T) -> Vec4<T>

Linear interpolation between the vectors.

selfrhst = 0.2t = 0.5
Source

pub fn slerp(self, rhs: Vec4<T>, t: T) -> Vec4<T>
where T: Float,

Spherical interpolation between the vectors with constant velocity.

The result is linear interpolation of the angles between the vectors and their lengths.

This is fairly expensive to calculate requiring trigonometric functions. If constant velocity isn’t required, see the less expensive nlerp.

t = 0.25t = 0.50t = 0.75lerpslerpselfrhs
Source

pub fn nlerp(self, rhs: Vec4<T>, t: T) -> Vec4<T>
where T: Float,

Cheap spherical interpolation between the vectors without constant velocity.

t = 0.25t = 0.50t = 0.75lerpnlerpselfrhs
Source

pub fn exp_decay(self, rhs: Vec4<T>, decay: T, dt: T) -> Vec4<T>
where T: Float,

Exponential decay smoothing.

Also known as lerp smoothing. Useful decay values range from approx 1.0 to 25.0, slow to fast.

use cvmath::Vec2;

struct Entity {
	pos: Vec2<f32>,
	target: Vec2<f32>,
}
impl Entity {
	fn update(&mut self, dt: f32) {
		// Smoothly move towards the target.
		self.pos = self.pos.exp_decay(self.target, 5.0, dt);
	}
}
Source§

impl<T: Float> Vec4<T>

Source

pub fn floor(self) -> Vec4<T>

Component-wise floor.

Source

pub fn ceil(self) -> Vec4<T>

Component-wise ceil.

Source

pub fn round(self) -> Vec4<T>

Component-wise round.

Source

pub fn fract(self) -> Vec4<T>

Component-wise fract.

Source§

impl<T> Vec4<T>

Source

pub fn is_finite(self) -> Bool4
where T: Float,

Creates a mask for finite components.

Source

pub fn is_infinite(self) -> Bool4
where T: Float,

Creates a mask for infinite components.

Source

pub fn eq(self, rhs: Vec4<T>) -> Bool4
where T: PartialEq,

Creates a mask for equal components.

Source

pub fn ne(self, rhs: Vec4<T>) -> Bool4
where T: PartialEq,

Creates a mask for inequal components.

Source

pub fn lt(self, rhs: Vec4<T>) -> Bool4
where T: PartialOrd,

Creates a mask for left-hand side components are less than the right-hand side.

Source

pub fn le(self, rhs: Vec4<T>) -> Bool4
where T: PartialOrd,

Creates a mask for left-hand side components are less than or equal the right-hand side.

Source

pub fn gt(self, rhs: Vec4<T>) -> Bool4
where T: PartialOrd,

Creates a mask for left-hand side components are greater than the right-hand side.

Source

pub fn ge(self, rhs: Vec4<T>) -> Bool4
where T: PartialOrd,

Creates a mask for left-hand side components are greater than or equal the right-hand side.

Source§

impl<T> Vec4<T>

Source

pub fn is_close(self, rhs: Vec4<T>) -> Bool4
where T: Float,

Creates a mask for approximately equal components.

Source

pub fn all_close(self, rhs: Vec4<T>) -> bool
where T: Float,

Returns true if the values are approximately equal.

Source§

impl Vec4<bool>

Source

pub const fn any(self) -> bool

Returns true if any of the components are true.

Source

pub const fn all(self) -> bool

Returns true if all the components are true.

Source

pub const fn none(self) -> bool

Returns true if none of the components are true.

Source

pub fn select<T>(self, lhs: Vec4<T>, rhs: Vec4<T>) -> Vec4<T>

Combines two vectors based on the bools, selecting components from the left-hand side if true and right-hand side if false.

Source§

impl Vec4<u16>

Source

pub const fn unpack16(v: u64) -> Vec4<u16>

Unpacks u64 into u16 u16 u16 u16.

use cvmath::Vec4;

assert_eq!(
	Vec4 { x: 0x0101, y: 0x5656, z: 0x9A9A, w: 0xFEFE },
	Vec4::unpack16(0xFEFE_9A9A_5656_0101)
);
Source

pub const fn pack(self) -> u64

Packs into u64.

use cvmath::Vec4;

let this: Vec4<u16> = Vec4 { x: 0x0101, y: 0x5656, z: 0x9A9A, w: 0xFEFE };
assert_eq!(0xFEFE_9A9A_5656_0101, this.pack());
Source§

impl Vec4<u8>

Source

pub const fn unpack8(v: u32) -> Vec4<u8>

Unpacks u32 into u8 u8 u8 u8.

use cvmath::Vec4;

assert_eq!(
	Vec4 { x: 0x01, y: 0x56, z: 0x9A, w: 0xFE },
	Vec4::unpack8(0xFE_9A_56_01)
);

Unpacks an RGBA color value into Vec4<f32> where x: red, y: green, z: blue and w: alpha.

use cvmath::Vec4;

// 0xAABBGGRR in little endian results in RR GG BB AA bytes in memory.
let rgba = 0xFF_C0_80_40;
let color = Vec4::unpack8(rgba).cast::<f32>() / 255_f32;
assert_eq!(Vec4 { x: 64.0/255.0, y: 128.0/255.0, z: 192.0/255.0, w: 1.0 }, color);
Source

pub const fn pack(self) -> u32

Packs into u32.

use cvmath::Vec4;

let this: Vec4<u8> = Vec4 { x: 0x01, y: 0x56, z: 0x9A, w: 0xFE };
assert_eq!(0xFE_9A_56_01, this.pack());

Packs Vec4<f32> color components into an RGBA color value.

use cvmath::Vec4;

let color = Vec4 { x: 64.0/255.0, y: 128.0/255.0, z: 192.0/255.0, w: 1.0 };
let rgba = (color * 255_f32).cast::<u8>().pack();
assert_eq!(0xFF_C0_80_40, rgba);

Trait Implementations§

Source§

impl<U, T: Add<U>> Add<(U, U, U, U)> for Vec4<T>

Source§

type Output = Vec4<<T as Add<U>>::Output>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: (U, U, U, U)) -> Vec4<T::Output>

Performs the + operation. Read more
Source§

impl<U, T: Add<U>> Add<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as Add<U>>::Output>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the + operation. Read more
Source§

impl<U, T: AddAssign<U>> AddAssign<(U, U, U, U)> for Vec4<T>

Source§

fn add_assign(&mut self, rhs: (U, U, U, U))

Performs the += operation. Read more
Source§

impl<U, T: AddAssign<U>> AddAssign<Vec4<U>> for Vec4<T>

Source§

fn add_assign(&mut self, rhs: Vec4<U>)

Performs the += operation. Read more
Source§

impl<T> AsMut<[T]> for Vec4<T>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsMut<[T; 4]> for Vec4<T>

Source§

fn as_mut(&mut self) -> &mut [T; 4]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<[T]> for Vec4<T>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> AsRef<[T; 4]> for Vec4<T>

Source§

fn as_ref(&self) -> &[T; 4]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Binary> Binary for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<U, T: BitAnd<U>> BitAnd<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as BitAnd<U>>::Output>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the & operation. Read more
Source§

impl<U, T: BitOr<U>> BitOr<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as BitOr<U>>::Output>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the | operation. Read more
Source§

impl<U, T: BitXor<U>> BitXor<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as BitXor<U>>::Output>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the ^ operation. Read more
Source§

impl<T: Clone> Clone for Vec4<T>

Source§

fn clone(&self) -> Vec4<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Vec4<T>

Source§

fn default() -> Vec4<T>

Returns the “default value” for a type. Read more
Source§

impl<T: Display> Display for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<U, T: Div<U>> Div<(U, U, U, U)> for Vec4<T>

Source§

type Output = Vec4<<T as Div<U>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: (U, U, U, U)) -> Vec4<T::Output>

Performs the / operation. Read more
Source§

impl<U: Scalar, T: Div<U>> Div<U> for Vec4<T>

Source§

type Output = Vec4<<T as Div<U>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: U) -> Vec4<T::Output>

Performs the / operation. Read more
Source§

impl<U, T: Div<U>> Div<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as Div<U>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the / operation. Read more
Source§

impl<U, T: DivAssign<U>> DivAssign<(U, U, U, U)> for Vec4<T>

Source§

fn div_assign(&mut self, rhs: (U, U, U, U))

Performs the /= operation. Read more
Source§

impl<U: Scalar, T: DivAssign<U>> DivAssign<U> for Vec4<T>

Source§

fn div_assign(&mut self, rhs: U)

Performs the /= operation. Read more
Source§

impl<U, T: DivAssign<U>> DivAssign<Vec4<U>> for Vec4<T>

Source§

fn div_assign(&mut self, rhs: Vec4<U>)

Performs the /= operation. Read more
Source§

impl<T> From<[T; 4]> for Vec4<T>

Source§

fn from(val: [T; 4]) -> Vec4<T>

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T, T)> for Vec4<T>

Source§

fn from(val: (T, T, T, T)) -> Vec4<T>

Converts to this type from the input type.
Source§

impl<T: Scalar> From<T> for Vec4<T>

Source§

fn from(val: T) -> Vec4<T>

Converts to this type from the input type.
Source§

impl<T: FromStr> FromStr for Vec4<T>

Source§

type Err = ParseVecError<<T as FromStr>::Err>

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Vec4<T>, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<T: Hash> Hash for Vec4<T>

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<T> Index<usize> for Vec4<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Into<[T; 4]> for Vec4<T>

Source§

fn into(self) -> [T; 4]

Converts this type into the (usually inferred) input type.
Source§

impl<T> Into<(T, T, T, T)> for Vec4<T>

Source§

fn into(self) -> (T, T, T, T)

Converts this type into the (usually inferred) input type.
Source§

impl<T: LowerExp> LowerExp for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: LowerHex> LowerHex for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<U, T: Mul<U>> Mul<(U, U, U, U)> for Vec4<T>

Source§

type Output = Vec4<<T as Mul<U>>::Output>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: (U, U, U, U)) -> Vec4<T::Output>

Performs the * operation. Read more
Source§

impl<U: Scalar, T: Mul<U>> Mul<U> for Vec4<T>

Source§

type Output = Vec4<<T as Mul<U>>::Output>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: U) -> Vec4<T::Output>

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Vec4<T>> for Mat4<T>

Source§

type Output = Vec4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec4<T>) -> Vec4<T>

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Vec4<T>> for Transform3<T>

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec4<T>) -> Vec3<T>

Performs the * operation. Read more
Source§

impl<U, T: Mul<U>> Mul<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as Mul<U>>::Output>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the * operation. Read more
Source§

impl<U, T: MulAssign<U>> MulAssign<(U, U, U, U)> for Vec4<T>

Source§

fn mul_assign(&mut self, rhs: (U, U, U, U))

Performs the *= operation. Read more
Source§

impl<U: Scalar, T: MulAssign<U>> MulAssign<U> for Vec4<T>

Source§

fn mul_assign(&mut self, rhs: U)

Performs the *= operation. Read more
Source§

impl<U, T: MulAssign<U>> MulAssign<Vec4<U>> for Vec4<T>

Source§

fn mul_assign(&mut self, rhs: Vec4<U>)

Performs the *= operation. Read more
Source§

impl<T: Neg> Neg for Vec4<T>

Source§

type Output = Vec4<<T as Neg>::Output>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Vec4<T::Output>

Performs the unary - operation. Read more
Source§

impl<T: Not> Not for Vec4<T>

Source§

type Output = Vec4<<T as Not>::Output>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Vec4<T::Output>

Performs the unary ! operation. Read more
Source§

impl<T: Octal> Octal for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Ord> Ord for Vec4<T>

Source§

fn cmp(&self, other: &Vec4<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

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

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for Vec4<T>

Source§

fn eq(&self, other: &Vec4<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for Vec4<T>

Source§

fn partial_cmp(&self, other: &Vec4<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<U, T: Rem<U>> Rem<(U, U, U, U)> for Vec4<T>

Source§

type Output = Vec4<<T as Rem<U>>::Output>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: (U, U, U, U)) -> Vec4<T::Output>

Performs the % operation. Read more
Source§

impl<U: Scalar, T: Rem<U>> Rem<U> for Vec4<T>

Source§

type Output = Vec4<<T as Rem<U>>::Output>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: U) -> Vec4<T::Output>

Performs the % operation. Read more
Source§

impl<U, T: Rem<U>> Rem<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as Rem<U>>::Output>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the % operation. Read more
Source§

impl<U, T: RemAssign<U>> RemAssign<(U, U, U, U)> for Vec4<T>

Source§

fn rem_assign(&mut self, rhs: (U, U, U, U))

Performs the %= operation. Read more
Source§

impl<U: Scalar, T: RemAssign<U>> RemAssign<U> for Vec4<T>

Source§

fn rem_assign(&mut self, rhs: U)

Performs the %= operation. Read more
Source§

impl<U, T: RemAssign<U>> RemAssign<Vec4<U>> for Vec4<T>

Source§

fn rem_assign(&mut self, rhs: Vec4<U>)

Performs the %= operation. Read more
Source§

impl<U, T: Sub<U>> Sub<(U, U, U, U)> for Vec4<T>

Source§

type Output = Vec4<<T as Sub<U>>::Output>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: (U, U, U, U)) -> Vec4<T::Output>

Performs the - operation. Read more
Source§

impl<U, T: Sub<U>> Sub<Vec4<U>> for Vec4<T>

Source§

type Output = Vec4<<T as Sub<U>>::Output>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Vec4<U>) -> Vec4<T::Output>

Performs the - operation. Read more
Source§

impl<U, T: SubAssign<U>> SubAssign<(U, U, U, U)> for Vec4<T>

Source§

fn sub_assign(&mut self, rhs: (U, U, U, U))

Performs the -= operation. Read more
Source§

impl<U, T: SubAssign<U>> SubAssign<Vec4<U>> for Vec4<T>

Source§

fn sub_assign(&mut self, rhs: Vec4<U>)

Performs the -= operation. Read more
Source§

impl<T: UpperExp> UpperExp for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: UpperHex> UpperHex for Vec4<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Copy> Copy for Vec4<T>

Source§

impl<T: Eq> Eq for Vec4<T>

Source§

impl<T> StructuralPartialEq for Vec4<T>

Auto Trait Implementations§

§

impl<T> Freeze for Vec4<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Vec4<T>
where T: RefUnwindSafe,

§

impl<T> Send for Vec4<T>
where T: Send,

§

impl<T> Sync for Vec4<T>
where T: Sync,

§

impl<T> Unpin for Vec4<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vec4<T>
where T: UnwindSafe,

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