[−][src]Struct quick_maths::Vector
Vector over floats and a const-size. Often used through Vec2, Vec3, and Vec4 instead of the raw struct.
Implementations
impl<T: Float> Vector<4_usize, T>
[src]
pub fn conj(self) -> Self
[src]
pub fn is_unit(&self) -> bool
[src]
pub fn scale(&self, factor: T) -> Self
[src]
Encodes a scaling factor into the quaternion
pub fn rot(along: &Vec3<T>) -> Self
[src]
Returns a quaternion which is a rotation in the 3 dimensions given
pub fn quat_mul(self, o: Self) -> Self
[src]
impl<T: Float> Vector<3_usize, T>
[src]
impl<T: Copy, const N: usize> Vector<N, T>
[src]
pub fn of(v: T) -> Self
[src]
Creates a vector of the value v (every element = v).
pub fn apply_fn<F, S>(self, f: F) -> Vector<N, S> where
F: FnMut(T) -> S,
[src]
F: FnMut(T) -> S,
Applies this function to every vector value.
pub fn cast<S: From<T>>(self) -> Vector<N, S>
[src]
pub fn x(&self) -> T
[src]
X component of this vector, panics if out of range
pub fn y(&self) -> T
[src]
Y component of this vector, panics if out of range
pub fn z(&self) -> T
[src]
Z component of this vector, panics if out of range
pub fn w(&self) -> T
[src]
W componenent of this vector, panics if out of range
impl<T, const N: usize> Vector<N, T>
[src]
pub fn with<F>(f: F) -> Self where
F: FnMut(usize) -> T,
[src]
F: FnMut(usize) -> T,
pub fn iter(&self) -> impl Iterator<Item = &T>
[src]
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
[src]
impl<T: Copy, const N: usize> Vector<N, T>
[src]
pub fn extend<const M: usize>(&self, v: T) -> Vector<M, T>
[src]
Extend this vector to a larger vector. Must increase the size of the vector or keep it the same size.
impl<T: Float, const N: usize> Vector<N, T>
[src]
pub fn linspace(a: T, b: T) -> Self
[src]
pub fn dot(&self, o: &Self) -> T
[src]
Takes the dot product of two vectors
pub fn sqr_magn(&self) -> T
[src]
Computes the sqr_magnitude of the vector
pub fn magn(&self) -> T
[src]
Takes the magnitude of the vector
pub fn norm(&self) -> Self
[src]
Returns a unit vector in the same direction as self. Consider division instead of calling this method if you need efficiency.
pub fn cos_similarity(&self, o: &Self) -> T
[src]
pub fn reflect(&self, across: &Self) -> Self
[src]
pub fn refract(&self, norm: &Self, eta: T) -> Option<Self>
[src]
pub fn from_str_radix(
strs: [&str; N],
radix: u32
) -> Result<Self, T::FromStrRadixErr>
[src]
strs: [&str; N],
radix: u32
) -> Result<Self, T::FromStrRadixErr>
Computes a vector from a list of strings.
pub fn lerp(&self, v: &Self, alpha: T) -> Self
[src]
Linearly interpolates from self to v according to alpha, where 0 => self, and 1 => v.
pub fn max_component(&self) -> usize
[src]
Computes the max component of this vector
pub fn min_component(&self) -> usize
[src]
Computes the minimum component of this vector
pub fn clamp(&mut self, min: T, max: T)
[src]
Clamps self between min and max
pub fn dist(&self, o: &Self) -> T
[src]
pub fn reduce<const M: usize>(&self) -> Vector<M, T>
[src]
Shrink this vector to a lower dimension Must lower or keep the same size.
pub fn sift(&self, o: &Self) -> (Self, Self)
[src]
Takes the minimal and maximal elements from self and o and returns those vectors
pub fn project_onto(&self, onto: &Self) -> Self
[src]
pub fn col_vector(self) -> Matrix<N, 1, T>
[src]
pub fn row_vector(self) -> Matrix<1, N, T>
[src]
pub fn bisector(&self, o: &Self) -> Self
[src]
Computes the bisector of two vectors = (a,b) => |a|*b + |b|*a;
pub fn convolve<const M: usize>(&self, o: &Vector<M, T>) -> Self
[src]
Convolves self with other, returning a vector of the same size
pub fn scatter_fn<S: Copy, const M: usize>(
&self,
idx: &Vector<N, usize>,
base: S,
acc: impl Fn(S, T) -> S
) -> Vector<M, S>
[src]
&self,
idx: &Vector<N, usize>,
base: S,
acc: impl Fn(S, T) -> S
) -> Vector<M, S>
impl<const N: usize> Vector<N, bool>
[src]
impl<T> Vector<3_usize, T>
[src]
impl<T: Float> Vector<3_usize, T>
[src]
pub fn cross(&self, o: &Self) -> Self
[src]
Takes the cross product of self with other
pub fn sided(&self, o: &Self, normal: &Self) -> bool
[src]
Whether or not self is aligned on the right or left hand side of normal w.r.t o.
pub fn homogeneous(&self) -> Vec4<T>
[src]
Returns the homogeneous form of this vector.
pub fn homogenize(&self) -> Vec2<T>
[src]
impl<T> Vector<2_usize, T>
[src]
impl<T: Copy> Vector<2_usize, T>
[src]
impl<T: Float> Vector<2_usize, T>
[src]
pub fn rot(&self, theta: T) -> Self
[src]
Rotates this vector around the origin by theta (in radians)
pub fn signed_angle(&self, dst: &Self) -> T
[src]
pub fn perp(&self) -> Self
[src]
pub fn homogeneous(&self) -> Vec3<T>
[src]
impl<T> Vector<4_usize, T>
[src]
impl<T: Float> Vector<4_usize, T>
[src]
pub fn homogenize(&self) -> Vec3<T>
[src]
impl<T: Float, const N: usize> Vector<N, T>
[src]
pub fn cos(&self) -> Self
[src]
Element-wise cos .
pub fn sin(&self) -> Self
[src]
Element-wise sin .
pub fn tan(&self) -> Self
[src]
Element-wise tan .
pub fn acos(&self) -> Self
[src]
Element-wise acos .
pub fn asin(&self) -> Self
[src]
Element-wise asin .
pub fn atan(&self) -> Self
[src]
Element-wise atan .
pub fn acosh(&self) -> Self
[src]
Element-wise acosh .
pub fn asinh(&self) -> Self
[src]
Element-wise asinh .
pub fn atanh(&self) -> Self
[src]
Element-wise atanh .
pub fn sin_cos(&self) -> (Self, Self)
[src]
pub fn atan2(&self, v: T) -> Self
[src]
Element-wise atan2 .
pub fn hypot(&self, v: T) -> Self
[src]
Element-wise hypot .
pub fn ceil(&self) -> Self
[src]
Element-wise ceil .
pub fn floor(&self) -> Self
[src]
Element-wise floor .
pub fn round(&self) -> Self
[src]
Element-wise round .
pub fn fract(&self) -> Self
[src]
Element-wise fract .
pub fn trunc(&self) -> Self
[src]
Element-wise trunc .
pub fn abs(&self) -> Self
[src]
Element-wise abs .
pub fn signum(&self) -> Self
[src]
Element-wise signum .
pub fn abs_sub(&self, v: T) -> Self
[src]
Element-wise abs_sub .
pub fn is_sign_positive(&self) -> Vector<N, bool>
[src]
pub fn is_sign_negative(&self) -> Vector<N, bool>
[src]
pub fn recip(&self) -> Self
[src]
Element-wise recip .
pub fn log2(&self) -> Self
[src]
Element-wise log2 .
pub fn log10(&self) -> Self
[src]
Element-wise log10 .
pub fn ln(&self) -> Self
[src]
Element-wise ln .
pub fn ln_1p(&self) -> Self
[src]
Element-wise ln_1p .
pub fn exp(&self) -> Self
[src]
Element-wise exp .
pub fn exp2(&self) -> Self
[src]
Element-wise exp2 .
pub fn exp_m1(&self) -> Self
[src]
Element-wise exp_m1 .
pub fn sqrt(&self) -> Self
[src]
Element-wise sqrt .
pub fn cbrt(&self) -> Self
[src]
Element-wise cbrt .
pub fn powf(&self, v: T) -> Self
[src]
Element-wise powf .
pub fn powi(&self, v: i32) -> Self
[src]
pub fn log(&self, v: T) -> Self
[src]
Element-wise log .
pub fn max(&self, v: T) -> Self
[src]
Element-wise max .
pub fn min(&self, v: T) -> Self
[src]
Element-wise min .
pub fn to_degrees(&self) -> Self
[src]
Element-wise to_degrees .
pub fn to_radians(&self) -> Self
[src]
Element-wise to_radians .
impl<T, const N: usize> Vector<N, T>
[src]
pub fn dyn_tensor(self) -> DynTensor<1, T>
[src]
Trait Implementations
impl<T: Add + Copy, const N: usize> Add<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the +
operator.
fn add(self, o: T) -> Self::Output
[src]
impl<T: Add + Copy, const N: usize> Add<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the +
operator.
fn add(self, o: Self) -> Self::Output
[src]
impl<T: AddAssign + Copy, const N: usize> AddAssign<T> for Vector<N, T>
[src]
fn add_assign(&mut self, o: T)
[src]
impl<T: AddAssign + Copy, const N: usize> AddAssign<Vector<N, T>> for Vector<N, T>
[src]
fn add_assign(&mut self, o: Self)
[src]
impl<T, const N: usize> AsRef<[T]> for Vector<N, T>
[src]
impl<T: BitAnd + Copy, const N: usize> BitAnd<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the &
operator.
fn bitand(self, o: T) -> Self::Output
[src]
impl<T: BitAnd + Copy, const N: usize> BitAnd<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the &
operator.
fn bitand(self, o: Self) -> Self::Output
[src]
impl<T: BitAndAssign + Copy, const N: usize> BitAndAssign<T> for Vector<N, T>
[src]
fn bitand_assign(&mut self, o: T)
[src]
impl<T: BitAndAssign + Copy, const N: usize> BitAndAssign<Vector<N, T>> for Vector<N, T>
[src]
fn bitand_assign(&mut self, o: Self)
[src]
impl<T: BitOr + Copy, const N: usize> BitOr<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the |
operator.
fn bitor(self, o: T) -> Self::Output
[src]
impl<T: BitOr + Copy, const N: usize> BitOr<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the |
operator.
fn bitor(self, o: Self) -> Self::Output
[src]
impl<T: BitOrAssign + Copy, const N: usize> BitOrAssign<T> for Vector<N, T>
[src]
fn bitor_assign(&mut self, o: T)
[src]
impl<T: BitOrAssign + Copy, const N: usize> BitOrAssign<Vector<N, T>> for Vector<N, T>
[src]
fn bitor_assign(&mut self, o: Self)
[src]
impl<T: BitXor + Copy, const N: usize> BitXor<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the ^
operator.
fn bitxor(self, o: T) -> Self::Output
[src]
impl<T: BitXor + Copy, const N: usize> BitXor<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the ^
operator.
fn bitxor(self, o: Self) -> Self::Output
[src]
impl<T: BitXorAssign + Copy, const N: usize> BitXorAssign<T> for Vector<N, T>
[src]
fn bitxor_assign(&mut self, o: T)
[src]
impl<T: BitXorAssign + Copy, const N: usize> BitXorAssign<Vector<N, T>> for Vector<N, T>
[src]
fn bitxor_assign(&mut self, o: Self)
[src]
impl<T: Clone, const N: usize> Clone for Vector<N, T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
[src]
impl<const N: usize, T: Copy> Copy for Vector<N, T>
[src]
impl<const N: usize, T: Debug> Debug for Vector<N, T>
[src]
impl<T: Div + Copy, const N: usize> Div<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the /
operator.
fn div(self, o: T) -> Self::Output
[src]
impl<T: Div + Copy, const N: usize> Div<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the /
operator.
fn div(self, o: Self) -> Self::Output
[src]
impl<T: DivAssign + Copy, const N: usize> DivAssign<T> for Vector<N, T>
[src]
fn div_assign(&mut self, o: T)
[src]
impl<T: DivAssign + Copy, const N: usize> DivAssign<Vector<N, T>> for Vector<N, T>
[src]
fn div_assign(&mut self, o: Self)
[src]
impl<const N: usize, T: Eq> Eq for Vector<N, T>
[src]
impl<R: SliceIndex<[T]>, T, const N: usize> Index<R> for Vector<N, T>
[src]
type Output = R::Output
The returned type after indexing.
fn index(&self, r: R) -> &Self::Output
[src]
impl<R: SliceIndex<[T]>, T, const N: usize> IndexMut<R> for Vector<N, T>
[src]
impl<T: Mul + Copy, const N: usize> Mul<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the *
operator.
fn mul(self, o: T) -> Self::Output
[src]
impl<T: Mul + Copy, const N: usize> Mul<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the *
operator.
fn mul(self, o: Self) -> Self::Output
[src]
impl<T: MulAssign + Copy, const N: usize> MulAssign<T> for Vector<N, T>
[src]
fn mul_assign(&mut self, o: T)
[src]
impl<T: MulAssign + Copy, const N: usize> MulAssign<Vector<N, T>> for Vector<N, T>
[src]
fn mul_assign(&mut self, o: Self)
[src]
impl<T: Neg<Output = T> + Copy, const N: usize> Neg for Vector<N, T>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<T: Not<Output = T> + Copy, const N: usize> Not for Vector<N, T>
[src]
type Output = Self
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
impl<T: Float, const N: usize> One for Vector<N, T>
[src]
impl<const N: usize, T: Ord> Ord for Vector<N, T>
[src]
fn cmp(&self, other: &Vector<N, T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<const N: usize, T: PartialEq> PartialEq<Vector<N, T>> for Vector<N, T>
[src]
impl<const N: usize, T: PartialOrd> PartialOrd<Vector<N, T>> for Vector<N, T>
[src]
fn partial_cmp(&self, other: &Vector<N, T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Vector<N, T>) -> bool
[src]
fn le(&self, other: &Vector<N, T>) -> bool
[src]
fn gt(&self, other: &Vector<N, T>) -> bool
[src]
fn ge(&self, other: &Vector<N, T>) -> bool
[src]
impl<T: Rem + Copy, const N: usize> Rem<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the %
operator.
fn rem(self, o: T) -> Self::Output
[src]
impl<T: Rem + Copy, const N: usize> Rem<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the %
operator.
fn rem(self, o: Self) -> Self::Output
[src]
impl<T: RemAssign + Copy, const N: usize> RemAssign<T> for Vector<N, T>
[src]
fn rem_assign(&mut self, o: T)
[src]
impl<T: RemAssign + Copy, const N: usize> RemAssign<Vector<N, T>> for Vector<N, T>
[src]
fn rem_assign(&mut self, o: Self)
[src]
impl<const N: usize, T> StructuralEq for Vector<N, T>
[src]
impl<const N: usize, T> StructuralPartialEq for Vector<N, T>
[src]
impl<T: Sub + Copy, const N: usize> Sub<T> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the -
operator.
fn sub(self, o: T) -> Self::Output
[src]
impl<T: Sub + Copy, const N: usize> Sub<Vector<N, T>> for Vector<N, T>
[src]
type Output = Vector<N, T::Output>
The resulting type after applying the -
operator.
fn sub(self, o: Self) -> Self::Output
[src]
impl<T: SubAssign + Copy, const N: usize> SubAssign<T> for Vector<N, T>
[src]
fn sub_assign(&mut self, o: T)
[src]
impl<T: SubAssign + Copy, const N: usize> SubAssign<Vector<N, T>> for Vector<N, T>
[src]
fn sub_assign(&mut self, o: Self)
[src]
impl<T: Zero + Copy, const N: usize> Zero for Vector<N, T>
[src]
Auto Trait Implementations
impl<const N: usize, T> RefUnwindSafe for Vector<N, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<const N: usize, T> Send for Vector<N, T> where
T: Send,
T: Send,
impl<const N: usize, T> Sync for Vector<N, T> where
T: Sync,
T: Sync,
impl<const N: usize, T> Unpin for Vector<N, T> where
T: Unpin,
T: Unpin,
impl<const N: usize, T> UnwindSafe for Vector<N, T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[src]
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,