Struct Vec3

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

Vec3 vector.

Fields§

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

Implementations§

Source§

impl<T> Vec3<T>

Source

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

Constructs a new vector from components.

Source

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

Constructs a new vector by broadcasting to all its components.

Source§

impl<T: Zero> Vec3<T>

Source

pub const ZERO: Vec3<T>

Vec3 of all zero.

Source

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

Returns the origin for the vector space.

Source§

impl<T: One> Vec3<T>

Source

pub const ONE: Vec3<T>

Vec3 of all one.

Source§

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

Source

pub const X: Vec3<T>

Unit vector in the x direction.

Source

pub const Y: Vec3<T>

Unit vector in the y direction.

Source

pub const Z: Vec3<T>

Unit vector in the z direction.

Source§

impl<T> Vec3<T>

Source

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

Sets the x component.

Source

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

Sets the y component.

Source

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

Sets the z component.

Source

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

Extends the 3D vector with a w component.

Source

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

Drops the z component.

Source§

impl<T: Copy> Vec3<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>(self, x: X, y: Y, z: Z) -> Vec3<T>
where Self: ComponentImpl<T, X> + ComponentImpl<T, Y> + ComponentImpl<T, Z>,

Shuffles the components.

Source§

impl<T> Vec3<T>

Source

pub fn cast<U>(self) -> Vec3<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) -> Vec3<U>
where F: FnMut(T) -> U,

Maps a callable over the components.

Source

pub fn zip<U, F>(self, rhs: Vec3<T>, f: F) -> Vec3<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> Vec3<T>

Source

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

Source§

impl<T: Scalar> Vec3<T>

Operations on vectors of scalars.

Source

pub fn sqr(self) -> Vec3<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: Vec3<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: Vec3<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: Vec3<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) -> Vec3<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) -> (Vec3<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) -> Vec3<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: Vec3<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: Vec3<T>) -> Vec3<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: Vec3<T>) -> Vec3<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: Vec3<T>) -> Vec3<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 cross(self, rhs: Vec3<T>) -> Vec3<T>

Calculates the 3D cross product.

Effectively calculates the vector perpendicular to both inputs with direction according to the right-hand rule.

use cvmath::Vec3;

let lhs = Vec3 { x: 3, y: -3, z: 1 };
let rhs = Vec3 { x: 4, y: 9, z: 1 };
assert_eq!(Vec3(-12, 1, 39), lhs.cross(rhs));
Source

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

Homogeneous divide.

Source

pub fn dot(self, rhs: Vec3<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: Vec3<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: Vec3<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) -> Vec3<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: Vec3<T>) -> Vec3<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: Vec3<T>) -> Vec3<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: Vec3<T>, scale: T) -> Vec3<T>

Adds the scaled vector.

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

Source

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

Linear interpolation between the vectors.

selfrhst = 0.2t = 0.5
Source

pub fn slerp(self, rhs: Vec3<T>, t: T) -> Vec3<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: Vec3<T>, t: T) -> Vec3<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: Vec3<T>, decay: T, dt: T) -> Vec3<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> Vec3<T>

Source

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

Component-wise floor.

Source

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

Component-wise ceil.

Source

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

Component-wise round.

Source

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

Component-wise fract.

Source§

impl<T> Vec3<T>

Source

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

Creates a mask for finite components.

Source

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

Creates a mask for infinite components.

Source

pub fn eq(self, rhs: Vec3<T>) -> Bool3
where T: PartialEq,

Creates a mask for equal components.

Source

pub fn ne(self, rhs: Vec3<T>) -> Bool3
where T: PartialEq,

Creates a mask for inequal components.

Source

pub fn lt(self, rhs: Vec3<T>) -> Bool3
where T: PartialOrd,

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

Source

pub fn le(self, rhs: Vec3<T>) -> Bool3
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: Vec3<T>) -> Bool3
where T: PartialOrd,

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

Source

pub fn ge(self, rhs: Vec3<T>) -> Bool3
where T: PartialOrd,

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

Source§

impl<T> Vec3<T>

Source

pub fn is_close(self, rhs: Vec3<T>) -> Bool3
where T: Float,

Creates a mask for approximately equal components.

Source

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

Returns true if the values are approximately equal.

Source§

impl Vec3<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: Vec3<T>, rhs: Vec3<T>) -> Vec3<T>

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

Trait Implementations§

Source§

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

Source§

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

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

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

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

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

Performs the += operation. Read more
Source§

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

Source§

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

Performs the += operation. Read more
Source§

impl<T> AsMut<[T]> for Vec3<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; 3]> for Vec3<T>

Source§

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

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

impl<T> AsRef<[T]> for Vec3<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; 3]> for Vec3<T>

Source§

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

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

impl<T: Binary> Binary for Vec3<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<Vec3<U>> for Vec3<T>

Source§

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

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

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

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

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

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<T: Clone> Clone for Vec3<T>

Source§

fn clone(&self) -> Vec3<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 Vec3<T>

Source§

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

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

impl<T: Default> Default for Vec3<T>

Source§

fn default() -> Vec3<T>

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

impl<T: Display> Display for Vec3<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)> for Vec3<T>

Source§

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

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

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

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

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

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

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

Performs the /= operation. Read more
Source§

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

Source§

fn div_assign(&mut self, rhs: U)

Performs the /= operation. Read more
Source§

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

Source§

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

Performs the /= operation. Read more
Source§

impl<T> From<[T; 3]> for Vec3<T>

Source§

fn from(val: [T; 3]) -> Vec3<T>

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<T: FromStr> FromStr for Vec3<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<Vec3<T>, Self::Err>

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

impl<T: Hash> Hash for Vec3<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 Vec3<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; 3]> for Vec3<T>

Source§

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

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

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

Source§

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

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

impl<T: LowerExp> LowerExp for Vec3<T>

Source§

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

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

impl<T: LowerHex> LowerHex for Vec3<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)> for Vec3<T>

Source§

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

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

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

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Vec3<T>> for Mat3<T>

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Float> Mul<Vec3<T>> for Quaternion<T>

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Vec3<T>> for Transform2<T>

Source§

type Output = Vec2<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

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

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

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

Performs the *= operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, rhs: U)

Performs the *= operation. Read more
Source§

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

Source§

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

Performs the *= operation. Read more
Source§

impl<T: Neg> Neg for Vec3<T>

Source§

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

The resulting type after applying the - operator.
Source§

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

Performs the unary - operation. Read more
Source§

impl<T: Not> Not for Vec3<T>

Source§

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

The resulting type after applying the ! operator.
Source§

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

Performs the unary ! operation. Read more
Source§

impl<T: Octal> Octal for Vec3<T>

Source§

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

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

impl<T: Ord> Ord for Vec3<T>

Source§

fn cmp(&self, other: &Vec3<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 Vec3<T>

Source§

fn eq(&self, other: &Vec3<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 Vec3<T>

Source§

fn partial_cmp(&self, other: &Vec3<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)> for Vec3<T>

Source§

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

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

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

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

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

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

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

Performs the %= operation. Read more
Source§

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

Source§

fn rem_assign(&mut self, rhs: U)

Performs the %= operation. Read more
Source§

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

Source§

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

Performs the %= operation. Read more
Source§

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

Source§

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

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

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

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

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

Performs the -= operation. Read more
Source§

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

Source§

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

Performs the -= operation. Read more
Source§

impl<T: UpperExp> UpperExp for Vec3<T>

Source§

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

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

impl<T: UpperHex> UpperHex for Vec3<T>

Source§

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

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

impl<T: Copy> Copy for Vec3<T>

Source§

impl<T: Eq> Eq for Vec3<T>

Source§

impl<T> StructuralPartialEq for Vec3<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Vec3<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.