rgeometry::data

Struct Vector

source
#[repr(transparent)]
pub struct Vector<T, const N: usize>(pub [T; N]);

Tuple Fields§

§0: [T; N]

Implementations§

source§

impl<T, const N: usize> Vector<T, N>
where T: Clone,

source

pub fn qda(&self) -> T

source

pub fn squared_magnitude(&self) -> T
where T: Sum + AddAssign + Sub<T, Output = T> + Mul<Output = T>,

source

pub fn map<U, F>(&self, f: F) -> Vector<U, N>
where T: Clone, F: Fn(T) -> U,

source

pub fn cast<U>(&self) -> Vector<U, N>
where T: Clone + Into<U>,

source§

impl<T> Vector<T, 2>

source

pub fn unit_right() -> Vector<T, 2>
where T: PolygonScalar,

source

pub fn ccw_cmp_around(&self, p: &Vector<T, 2>, q: &Vector<T, 2>) -> Ordering
where T: PolygonScalar,

source

pub fn ccw_cmp_around_with( &self, z: &Vector<T, 2>, p: &Vector<T, 2>, q: &Vector<T, 2>, ) -> Ordering
where T: PolygonScalar,

source

pub fn sort_around(pts: &mut [Vector<T, 2>])
where T: PolygonScalar,

source

pub fn cmp_along(&self, p: &Point<T, 2>, q: &Point<T, 2>) -> Ordering
where T: PolygonScalar,

Trait Implementations§

source§

impl<'a, 'b, T, const N: usize> Add<&'a Vector<T, N>> for &'b Point<T, N>
where T: Add<Output = T> + Clone,

source§

type Output = Point<T, N>

The resulting type after applying the + operator.
source§

fn add(self: &'b Point<T, N>, other: &'a Vector<T, N>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, const N: usize> Add<&Vector<T, N>> for &Vector<T, N>
where T: NumOps + Clone,

source§

type Output = Vector<T, N>

The resulting type after applying the + operator.
source§

fn add(self, other: &Vector<T, N>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, const N: usize> Add<&Vector<T, N>> for Point<T, N>
where T: Add<Output = T> + Clone,

source§

type Output = Point<T, N>

The resulting type after applying the + operator.
source§

fn add(self: Point<T, N>, other: &Vector<T, N>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, const N: usize> Add<Vector<T, N>> for Point<T, N>
where T: Add<Output = T> + Clone,

source§

type Output = Point<T, N>

The resulting type after applying the + operator.
source§

fn add(self: Point<T, N>, other: Vector<T, N>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, const N: usize> Add for Vector<T, N>
where T: NumOps + Clone,

source§

type Output = Vector<T, N>

The resulting type after applying the + operator.
source§

fn add(self: Vector<T, N>, other: Vector<T, N>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, const N: usize> AddAssign<&Vector<T, N>> for Point<T, N>
where T: NumOps + Clone + AddAssign,

source§

fn add_assign(&mut self, other: &Vector<T, N>)

Performs the += operation. Read more
source§

impl<T, const N: usize> AddAssign<Vector<T, N>> for Point<T, N>
where T: NumOps + Clone + AddAssign,

source§

fn add_assign(&mut self, other: Vector<T, N>)

Performs the += operation. Read more
source§

impl<T, const N: usize> AddAssign for Vector<T, N>
where T: NumOps + Clone + AddAssign,

source§

fn add_assign(&mut self, other: Vector<T, N>)

Performs the += operation. Read more
source§

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

source§

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

Returns a copy 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, const N: usize> Debug for Vector<T, N>

source§

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

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

impl<T, const N: usize> Distribution<Vector<T, N>> for Standard

source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>

Generate a random value of T, using rng as the source of randomness.
source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
source§

impl<T, const N: usize> Div<T> for Vector<T, N>
where T: NumOps + Clone,

source§

type Output = Vector<T, N>

The resulting type after applying the / operator.
source§

fn div(self: Vector<T, N>, other: T) -> Self::Output

Performs the / operation. Read more
source§

impl<'a, T, const N: usize> From<&'a Point<T, N>> for &'a Vector<T, N>

source§

fn from(point: &Point<T, N>) -> &Vector<T, N>

Converts to this type from the input type.
source§

impl<T, const N: usize> From<Point<T, N>> for Vector<T, N>

source§

fn from(point: Point<T, N>) -> Vector<T, N>

Converts to this type from the input type.
source§

impl<T, const N: usize> From<Vector<T, N>> for Point<T, N>

source§

fn from(vector: Vector<T, N>) -> Point<T, N>

Converts to this type from the input type.
source§

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

source§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: usize) -> &T

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

impl<T, const N: usize> Mul<&Vector<T, N>> for &Transform<T, N>
where T: TransformScalar,

source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
source§

fn mul(self, other: &Vector<T, N>) -> Vector<T, N>

Performs the * operation. Read more
source§

impl<T, const N: usize> Mul<&Vector<T, N>> for Transform<T, N>
where T: TransformScalar,

source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
source§

fn mul(self, other: &Vector<T, N>) -> Vector<T, N>

Performs the * operation. Read more
source§

impl<T, const N: usize> Mul<T> for Vector<T, N>
where T: NumOps + Clone,

source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
source§

fn mul(self: Vector<T, N>, other: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T, const N: usize> Mul<Vector<T, N>> for &Transform<T, N>
where T: TransformScalar,

source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
source§

fn mul(self, other: Vector<T, N>) -> Vector<T, N>

Performs the * operation. Read more
source§

impl<T, const N: usize> Neg for Vector<T, N>
where T: NumOps + Neg<Output = T> + Clone,

source§

type Output = Vector<T, N>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<T: Ord, const N: usize> Ord for Vector<T, N>

source§

fn cmp(&self, other: &Vector<T, N>) -> 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, const N: usize> PartialEq for Vector<T, N>

source§

fn eq(&self, other: &Vector<T, N>) -> 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, const N: usize> PartialOrd for Vector<T, N>

source§

fn partial_cmp(&self, other: &Vector<T, N>) -> 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<'a, 'b, T, const N: usize> Sub<&'a Vector<T, N>> for &'b Vector<T, N>
where T: Sub<T, Output = T> + Clone,

source§

type Output = Vector<T, N>

The resulting type after applying the - operator.
source§

fn sub(self: &'b Vector<T, N>, other: &'a Vector<T, N>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, const N: usize> Sum for Vector<T, N>
where T: NumOps + AddAssign + Clone + Sum,

source§

fn sum<I>(iter: I) -> Vector<T, N>
where I: Iterator<Item = Vector<T, N>>,

Takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<const N: usize> TryFrom<Vector<f64, N>> for Vector<BigRational, N>

source§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(point: Vector<f64, N>) -> Result<Vector<BigRational, N>, ()>

Performs the conversion.
source§

impl<T: Eq, const N: usize> Eq for Vector<T, N>

source§

impl<T, const N: usize> StructuralPartialEq for Vector<T, N>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T, const N: usize> UnwindSafe for Vector<T, N>
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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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, 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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V