Expand description
An n-dimensional vector
The dimensionality of the vector is defined by the const generic D
parameter.
Fields
components: [Scalar; D]The vector components
Implementations
sourceimpl<const D: usize> Vector<D>
impl<const D: usize> Vector<D>
sourcepub fn from_components_f64(components: [f64; D]) -> Self
pub fn from_components_f64(components: [f64; D]) -> Self
Construct a Vector from f64 components
Panics
Panics, if the components can not be converted to Scalar. See
Scalar::from_f64, which this method uses internally.
sourcepub fn to_uv(self) -> Vector<2>
pub fn to_uv(self) -> Vector<2>
Convert the vector into a 2-dimensional vector
If the vector is 0-, or 1-dimensional, the missing components will be initialized to zero.
If the vector has higher dimensionality than two, the superfluous components will be discarded.
sourcepub fn to_xyz(self) -> Vector<3>
pub fn to_xyz(self) -> Vector<3>
Convert the vector into a 3-dimensional vector
If the vector is 0-, 1-, or 2-dimensional, the missing components will be initialized to zero.
If the vector has higher dimensionality than three, the superfluous components will be discarded.
sourcepub fn scalar_projection_onto(&self, other: &Self) -> Scalar
pub fn scalar_projection_onto(&self, other: &Self) -> Scalar
Compute the scalar project of this vector onto another
Trait Implementations
sourceimpl<const D: usize> AbsDiffEq<Vector<D>> for Vector<D>
impl<const D: usize> AbsDiffEq<Vector<D>> for Vector<D>
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
sourcefn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
sourcefn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.sourceimpl<const D: usize> From<Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>> for Vector<D>
impl<const D: usize> From<Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>> for Vector<D>
sourceimpl<const D: usize> Ord for Vector<D>
impl<const D: usize> Ord for Vector<D>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl<const D: usize> PartialEq<Vector<D>> for Vector<D>
impl<const D: usize> PartialEq<Vector<D>> for Vector<D>
sourceimpl<const D: usize> PartialOrd<Vector<D>> for Vector<D>
impl<const D: usize> PartialOrd<Vector<D>> for Vector<D>
sourcefn partial_cmp(&self, other: &Vector<D>) -> Option<Ordering>
fn partial_cmp(&self, other: &Vector<D>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl<const D: usize> Copy for Vector<D>
impl<const D: usize> Eq for Vector<D>
impl<const D: usize> StructuralEq for Vector<D>
impl<const D: usize> StructuralPartialEq for Vector<D>
Auto Trait Implementations
impl<const D: usize> RefUnwindSafe for Vector<D>
impl<const D: usize> Send for Vector<D>
impl<const D: usize> Sync for Vector<D>
impl<const D: usize> Unpin for Vector<D>
impl<const D: usize> UnwindSafe for Vector<D>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s. Read moreimpl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.