pub trait VecN: Sized {
type Scalar: Scalar;
const N: usize;
const ZERO: Self;
Show 24 methods
// Required methods
fn dim(&self, dim: usize) -> Self::Scalar;
fn dim_mut(&mut self, dim: usize) -> &mut Self::Scalar;
// Provided methods
fn set_dim(&mut self, dim: usize, val: Self::Scalar) { ... }
fn add_assign(&mut self, other: Self) { ... }
fn add(self, other: Self) -> Self { ... }
fn sub_assign(&mut self, other: Self) { ... }
fn sub(self, other: Self) -> Self { ... }
fn mul_assign(&mut self, by: Self::Scalar) { ... }
fn mul(self, by: Self::Scalar) -> Self { ... }
fn div_assign(&mut self, by: Self::Scalar) { ... }
fn div(self, by: Self::Scalar) -> Self { ... }
fn mul2_assign(&mut self, other: Self) { ... }
fn mul2(self, other: Self) -> Self { ... }
fn div2_assign(&mut self, other: Self) { ... }
fn div2(self, other: Self) -> Self { ... }
fn neg_assign(&mut self)
where Self::Scalar: Neg<Output = Self::Scalar> + Debug { ... }
fn neg(self) -> Self
where Self::Scalar: Neg<Output = Self::Scalar> + Debug { ... }
fn squared_mag(&self) -> Self::Scalar { ... }
fn squared_dist(self, other: Self) -> Self::Scalar { ... }
fn min_dim(&self) -> Self::Scalar { ... }
fn max_dim(&self) -> Self::Scalar { ... }
fn dot(self, other: Self) -> Self::Scalar { ... }
fn lerp_assign(&mut self, other: Self, t: Self::Scalar) { ... }
fn lerp(self, other: Self, t: Self::Scalar) -> Self { ... }
}Expand description
Trait for basic vector math operations
Required Associated Constants§
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Add to the vector in place
Sourcefn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Subtract from the vector in place
Sourcefn mul_assign(&mut self, by: Self::Scalar)
fn mul_assign(&mut self, by: Self::Scalar)
Multiply the vector in place
Sourcefn div_assign(&mut self, by: Self::Scalar)
fn div_assign(&mut self, by: Self::Scalar)
Divide the vector in place
Sourcefn mul2_assign(&mut self, other: Self)
fn mul2_assign(&mut self, other: Self)
Element-wise multiply the vector by another in place
Sourcefn div2_assign(&mut self, other: Self)
fn div2_assign(&mut self, other: Self)
Element-wise divide the vector by another in place
Sourcefn neg_assign(&mut self)
fn neg_assign(&mut self)
Negate the vector in place
Sourcefn squared_mag(&self) -> Self::Scalar
fn squared_mag(&self) -> Self::Scalar
Get the squared magnitude of the vector
Sourcefn squared_dist(self, other: Self) -> Self::Scalar
fn squared_dist(self, other: Self) -> Self::Scalar
Get the squared distance between this vector and another
Sourcefn lerp_assign(&mut self, other: Self, t: Self::Scalar)
fn lerp_assign(&mut self, other: Self, t: Self::Scalar)
Linearly interpolate the vector with another in place
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.