Skip to main content

Vector

Struct Vector 

Source
pub struct Vector<S, const N: usize> { /* private fields */ }

Implementations§

Source§

impl<S: Scalar, const N: usize> Vector<S, N>

Source

pub fn add(&self, other: &Self) -> Self

Source

pub fn sub(&self, other: &Self) -> Self

Source

pub fn neg(&self) -> Self

Source

pub fn sharpen(&self) -> Self

Componentwise Scalar::sharpen — see that method’s own doc comment for when collapsing a value to a single representative point is a safe, free choice (you only ever needed some point within the interval) versus a silent loss of real uncertainty.

Source

pub fn interpolate(a: &Self, b: &Self, alpha: S) -> Self

Componentwise Scalar::interpolate: a at alpha=0, b at alpha=1. See that method’s doc comment for why this beats a manual a*(1-alpha) + b*alpha when components of a/b may coincide.

Source

pub fn prod_scalar(&self, s: S) -> Self

Source

pub fn prod_dot(&self, other: &Self) -> S

Source

pub fn norm_sq(&self) -> S

Source

pub fn norm(&self) -> S

Source

pub fn normalize(&self) -> GeopResult<Self>

Source

pub fn could_be_equal(&self, other: &Self) -> bool

True if every component could_be_equal other’s.

Source

pub fn union(&self, other: &Self) -> Self

The componentwise Scalar::union of self and other.

Source§

impl<S: Scalar> Vector<S, 3>

Source

pub fn prod_cross(&self, other: &Self) -> Self

Source§

impl<S: Default + Copy, const N: usize> Vector<S, N>

Source

pub fn new() -> Self

Source

pub fn size(&self) -> usize

Source§

impl<S: Scalar, const N: usize> Vector<S, N>

Source

pub fn from_array(data: [S; N]) -> Self

Source

pub fn get(&self, idx: &[usize]) -> S

Element access using a multi-index slice; only the first index is used (vectors are 1-D). Panics if idx is empty.

Source§

impl<S: Scalar> Vector<S, 2>

Source

pub fn swap_xy(&self) -> Self

Source§

impl<S: Scalar, const N: usize> Vector<S, N>

Source

pub fn zero() -> Self

Source

pub fn everything() -> Self

Every component set to Scalar::ENTIRE — could_be_equals any other vector of the same dimension componentwise.

Trait Implementations§

Source§

impl<S: Clone, const N: usize> Clone for Vector<S, N>

Source§

fn clone(&self) -> Vector<S, N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S: Copy, const N: usize> Copy for Vector<S, N>

Source§

impl<S: Debug, const N: usize> Debug for Vector<S, N>

Source§

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

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

impl<S: Scalar, const N: usize> Display for Vector<S, N>

Source§

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

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

impl<S, const N: usize> Index<usize> for Vector<S, N>

Source§

type Output = S

The returned type after indexing.
Source§

fn index(&self, idx: usize) -> &Self::Output

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

impl<S: Default + Copy, const N: usize> IndexMut<usize> for Vector<S, N>

Source§

fn index_mut(&mut self, idx: usize) -> &mut Self::Output

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

impl<S: Scalar, const N: usize> Mergeable for Vector<S, N>

Source§

fn could_be_equal(&self, other: &Self) -> bool

Source§

fn union(&self, other: &Self) -> Self

Source§

impl<S: PartialEq, const N: usize> PartialEq for Vector<S, N>

Source§

fn eq(&self, other: &Vector<S, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<S: PartialEq, const N: usize> StructuralPartialEq for Vector<S, N>

Auto Trait Implementations§

§

impl<S, const N: usize> Freeze for Vector<S, N>
where S: Freeze,

§

impl<S, const N: usize> RefUnwindSafe for Vector<S, N>
where S: RefUnwindSafe,

§

impl<S, const N: usize> Send for Vector<S, N>
where S: Send,

§

impl<S, const N: usize> Sync for Vector<S, N>
where S: Sync,

§

impl<S, const N: usize> Unpin for Vector<S, N>
where S: Unpin,

§

impl<S, const N: usize> UnsafeUnpin for Vector<S, N>
where S: UnsafeUnpin,

§

impl<S, const N: usize> UnwindSafe for Vector<S, N>
where S: 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.