Type Alias Vector3d

Source
pub type Vector3d<T> = Vector<T, 3>;
Expand description

A static 3-dimensional vector.

Aliased Type§

struct Vector3d<T> {
    pub coords: [T; 3],
}

Fields§

§coords: [T; 3]

The vector coordinates in some basis.

Implementations

Source§

impl<T, const D: usize> Vector<T, D>

Source

pub const fn new(coords: [T; D]) -> Self

Returns a new Vector from the given coords array.

Source§

impl<T: Clone + Add<Output = T>, const D: usize> Vector<T, D>

Source

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

Adds two vectors together

Source§

impl<T: Clone + Sub<Output = T>, const D: usize> Vector<T, D>

Source

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

Subtracts two vectors together.

Source§

impl<T: Clone + Mul<Output = T>, const D: usize> Vector<T, D>

Source

pub fn clone_mul_scalar(&self, scalar: &T) -> Self

Multiplies a vector by a scalar.

Source§

impl<T: Clone + Div<Output = T>, const D: usize> Vector<T, D>

Source

pub fn clone_div_scalar(&self, scalar: &T) -> Self

Divides a vector by a scalar.

Source§

impl Vector<f32, 3>

§Methods for 3d vectors represented using f32.

Source

pub fn cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<f64, 3>

§Methods for 3d vectors represented using f64.

Source

pub fn cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl<const D: usize> Vector<f64, D>

§Methods for vectors represented using f64.

Source

pub const ONE: Self

Available on crate feature _float_f64 only.

A Vector with all ones.

Source

pub const ZERO: Self

Available on crate feature _float_f64 only.

A Vector with all zeros.

Source

pub const NEG_ONE: Self

Available on crate feature _float_f64 only.

A Vector with all negative ones.

Source

pub fn normalize(&self) -> Self

Available on crate feature _float_f64 only.

Returns the normalized vector, as a unit vector.

$$ \bm{n} = \widehat{\bm{a}} = \frac{1}{d}\thinspace\bm{a} = \frac{\bm{a}}{|\bm{a}|} $$

Source

pub fn magnitude(self) -> f64

Available on crate feature _float_f64 only.

Calculates the magnitude of the vector.

§Formula

$$ \large |\vec{V}| = \sqrt{V_0^2 + … + V_n^2} $$

Source

pub fn magnitude_sq(self) -> f64

Available on crate feature _float_f64 only.

Calculates the squared magnitude of the vector.

This is faster than calculating the magnitude, which is useful for comparisons.

§Formula

$$ \large |\vec{V}|^2 = V_0^2 + … + V_n^2 $$

Source

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

Available on crate feature _float_f64 only.

Adds two vectors together.

Source

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

Available on crate feature _float_f64 only.

Subtracts another vector from this vector.

Source

pub fn dot(self, other: Self) -> f64

Available on crate feature _float_f64 only.

Computes the dot product of two vectors.

That is the magnitude of one vector in the direction of another.

Also known as the inner produc or the scalar product.

§Formula

$$ \large \vec{a}\cdot\vec{b} = \begin{bmatrix} a_0 \cr … \cr a_n \end{bmatrix} \cdot \begin{bmatrix} b_0 \cr … \cr b_n \end{bmatrix} = a_0 b_0 + … + a_n b_n $$

Source§

impl Vector<i128, 3>

§Methods for 3d vectors represented using i128.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<i16, 3>

§Methods for 3d vectors represented using i16.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<i32, 3>

§Methods for 3d vectors represented using i32.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<i64, 3>

§Methods for 3d vectors represented using i64.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl<const D: usize> Vector<i64, D>

§Methods for vectors represented using i64, signed.

Source

pub const NEG_ONE: Self

Available on crate feature _int_i64 only.

A Vector with all negative ones.

Source

pub const fn c_magnitude_floor(self) -> i64

Available on crate feature _int_i64 only.

Calculates the floored magnitude of the vector.

It could underestimate the true magnitude.

§Features

This will only be const if the “_cmp_i64” feature is enabled.

Source

pub const fn c_magnitude_ceil(self) -> i64

Available on crate feature _int_i64 only.

Calculates the ceiled magnitude of the vector.

It could overestimate the true magnitude.

§Features

This will only be const if the “_cmp_i64” feature is enabled.

Source

pub const fn c_magnitude_round(self) -> i64

Available on crate feature _int_i64 only.

Calculates the rounded magnitude of the vector.

§Panics

Can panic if we reach a i128 value close to its maximum during operations.

Source§

impl<const D: usize> Vector<i64, D>

§Methods for vectors represented using i64.

Source

pub const ONE: Self

Available on crate feature _int_i64 only.

A Vector with all ones.

Source

pub const ZERO: Self

Available on crate feature _int_i64 only.

A Vector with all zeros.

Source

pub const fn c_normalize_with(self, magnitude: i64) -> Self

Available on crate feature _int_i64 only.

Returns the normalized vector, using the given vector magnitude.

$$ \bm{n} = \widehat{\bm{a}} = \frac{1}{d}\thinspace\bm{a} = \frac{\bm{a}}{|\bm{a}|} $$

Source

pub const fn c_magnitude_sq(self) -> i64

Available on crate feature _int_i64 only.

Calculates the magnitude of the vector (squared).

This is faster than calculating the magnitude, which is useful for comparisons.

§Formula

$$ \large |\vec{V}|^2 = V_0^2 + … + V_n^2 $$

Source

pub const fn c_add(self, other: Self) -> Self

Available on crate feature _int_i64 only.

Adds two vectors together, in compile-time.

Source

pub const fn c_sub(self, other: Self) -> Self

Available on crate feature _int_i64 only.

Subtracts another vector from this vector, in compile-time.

Source

pub const fn c_dot(self, other: Self) -> i64

Available on crate feature _int_i64 only.

Computes the dot product of two vectors, in compile-time.

Source

pub const fn c_scalar_mul(self, scalar: i64) -> Self

Available on crate feature _int_i64 only.

Multiplies each element of the vector by a scalar, in compile-time.

Source

pub const fn c_scalar_div(self, scalar: i64) -> Self

Available on crate feature _int_i64 only.

Divides each element of the vector by a scalar, in compile-time.

Source§

impl Vector<i8, 3>

§Methods for 3d vectors represented using i8.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<isize, 3>

§Methods for 3d vectors represented using isize.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<u128, 3>

§Methods for 3d vectors represented using u128.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<u16, 3>

§Methods for 3d vectors represented using u16.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<u32, 3>

§Methods for 3d vectors represented using u32.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl<const D: usize> Vector<u32, D>

§Methods for vectors represented using u32, unsigned.

Source

pub const fn c_magnitude_floor(self) -> u32

Available on crate feature _int_u32 only.

Calculates the floored magnitude of the vector.

It could underestimate the true magnitude.

§Features

This will only be const if the “_cmp_u32” feature is enabled.

Source

pub const fn c_magnitude_ceil(self) -> u32

Available on crate feature _int_u32 only.

Calculates the ceiled magnitude of the vector.

It could overestimate the true magnitude.

§Features

This will only be const if the “_cmp_u32” feature is enabled.

Source

pub const fn c_magnitude_round(self) -> u32

Available on crate feature _int_u32 only.

Calculates the rounded magnitude of the vector.

§Panics

Can panic if we reach a u128 value close to its maximum during operations.

Source§

impl<const D: usize> Vector<u32, D>

§Methods for vectors represented using u32.

Source

pub const ONE: Self

Available on crate feature _int_u32 only.

A Vector with all ones.

Source

pub const ZERO: Self

Available on crate feature _int_u32 only.

A Vector with all zeros.

Source

pub const fn c_normalize_with(self, magnitude: u32) -> Self

Available on crate feature _int_u32 only.

Returns the normalized vector, using the given vector magnitude.

$$ \bm{n} = \widehat{\bm{a}} = \frac{1}{d}\thinspace\bm{a} = \frac{\bm{a}}{|\bm{a}|} $$

Source

pub const fn c_magnitude_sq(self) -> u32

Available on crate feature _int_u32 only.

Calculates the magnitude of the vector (squared).

This is faster than calculating the magnitude, which is useful for comparisons.

§Formula

$$ \large |\vec{V}|^2 = V_0^2 + … + V_n^2 $$

Source

pub const fn c_add(self, other: Self) -> Self

Available on crate feature _int_u32 only.

Adds two vectors together, in compile-time.

Source

pub const fn c_sub(self, other: Self) -> Self

Available on crate feature _int_u32 only.

Subtracts another vector from this vector, in compile-time.

Source

pub const fn c_dot(self, other: Self) -> u32

Available on crate feature _int_u32 only.

Computes the dot product of two vectors, in compile-time.

Source

pub const fn c_scalar_mul(self, scalar: u32) -> Self

Available on crate feature _int_u32 only.

Multiplies each element of the vector by a scalar, in compile-time.

Source

pub const fn c_scalar_div(self, scalar: u32) -> Self

Available on crate feature _int_u32 only.

Divides each element of the vector by a scalar, in compile-time.

Source§

impl Vector<u64, 3>

§Methods for 3d vectors represented using u64.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<u8, 3>

§Methods for 3d vectors represented using u8.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Source§

impl Vector<usize, 3>

§Methods for 3d vectors represented using usize.

Source

pub const fn c_cross(self, other: Self) -> Self

Computes the cross product of two vectors.

That is the vector orthogonal to both vectors.

Also known as the exterior product or the vector product.

It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.

§Formula

$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$

Trait Implementations

Source§

impl<T: Clone + Add<Output = T>, const D: usize> Add for Vector<T, D>

Source§

type Output = Vector<T, D>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Clone + Add<Output = T>, const D: usize> AddAssign<&Vector<T, D>> for Vector<T, D>

Source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
Source§

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

Source§

fn clone(&self) -> Self

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: ConstDefault, const D: usize> ConstDefault for Vector<T, D>

Source§

const DEFAULT: Self

Returns a Vector, allocated in the stack, using the default value to fill the data.

Source§

impl<T: Debug, const D: usize> Debug for Vector<T, D>

Source§

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

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

impl<T: Default, const D: usize> Default for Vector<T, D>

Source§

fn default() -> Self

Returns a Vector, allocated in the stack, using the default value to fill the data.

Source§

impl<T: Clone + Div<Output = T>, const D: usize> Div<&T> for Vector<T, D>

Source§

type Output = Vector<T, D>

The resulting type after applying the / operator.
Source§

fn div(self, scalar: &T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Clone + Div<Output = T>, const D: usize> Div<T> for Vector<T, D>

Source§

type Output = Vector<T, D>

The resulting type after applying the / operator.
Source§

fn div(self, scalar: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Clone + Div<Output = T>, const D: usize> DivAssign<&T> for Vector<T, D>

Source§

fn div_assign(&mut self, scalar: &T)

Performs the /= operation. Read more
Source§

impl<T: Clone + Div<Output = T>, const D: usize> DivAssign<T> for Vector<T, D>

Source§

fn div_assign(&mut self, scalar: T)

Performs the /= operation. Read more
Source§

impl<T: Hash, const D: usize> Hash for Vector<T, D>

Source§

fn hash<HR: Hasher>(&self, state: &mut HR)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Clone + Mul<Output = T>, const D: usize> Mul<&T> for Vector<T, D>

Source§

type Output = Vector<T, D>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Clone + Mul<Output = T>, const D: usize> Mul<T> for Vector<T, D>

Source§

type Output = Vector<T, D>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Clone + Mul<Output = T>, const D: usize> MulAssign<&T> for Vector<T, D>

Source§

fn mul_assign(&mut self, scalar: &T)

Performs the *= operation. Read more
Source§

impl<T: Clone + Mul<Output = T>, const D: usize> MulAssign<T> for Vector<T, D>

Source§

fn mul_assign(&mut self, scalar: T)

Performs the *= operation. Read more
Source§

impl<T: Num, const D: usize> Num for Vector<T, D>

Source§

type Inner = [T; D]

The internal representation of this numeric type.
Source§

type Out = Vector<T, D>

The output type for operations.
Source§

type Rhs = Vector<T, D>

The right hand side type for operations.
Source§

fn num_into(self) -> Self::Inner

Returns the inner self representation.
Source§

fn num_from(value: Self::Inner) -> Result<Self>
where Self: Sized,

Returns Self if given a valid value.
Source§

fn num_from_ref(value: &Self::Inner) -> Result<Self>
where Self: Sized,

Returns Self if given a valid &value.
Source§

fn num_set(&mut self, value: Self::Inner) -> Result<()>

Sets self to the given valid value.
Source§

fn num_set_ref(&mut self, value: &Self::Inner) -> Result<()>

Sets self to the given valid &value.
Source§

fn num_is_zero(&self) -> Result<bool>

Returns true if self is zero.
Source§

fn num_get_zero() -> Result<Self>
where Self: Sized,

Returns the number zero.
Source§

fn num_set_zero(&mut self) -> Result<()>

Sets self to 0.
Source§

fn num_is_one(&self) -> Result<bool>

Returns true if self is one.
Source§

fn num_get_one() -> Result<Self>
where Self: Sized,

Returns the number one.
Source§

fn num_set_one(&mut self) -> Result<()>

Sets the number to one.
Source§

fn num_add(self, rhs: Self::Rhs) -> Result<Self::Out>
where Self: Sized,

Computes self + rhs (addition).
Source§

fn num_ref_add(&self, rhs: &Self::Rhs) -> Result<Self::Out>

Like num_add but takes the arguments by reference.
Source§

fn num_ref_add_assign(&mut self, rhs: &Self::Rhs) -> Result<()>

Computes &mut self += rhs; (addition).
Source§

fn num_sub(self, rhs: Self::Rhs) -> Result<Self::Out>
where Self: Sized,

Computes self - rhs (subtraction).
Source§

fn num_ref_sub(&self, rhs: &Self::Rhs) -> Result<Self::Out>

Like num_sub but takes the arguments by reference.
Source§

fn num_ref_sub_assign(&mut self, rhs: &Self::Rhs) -> Result<()>

Computes &mut self -= rhs; (subtraction).
Source§

fn num_mul(self, rhs: Self::Rhs) -> Result<Self::Out>
where Self: Sized,

Computes self * rhs (multiplication).
Source§

fn num_ref_mul(&self, rhs: &Self::Rhs) -> Result<Self::Out>

Like num_mul but takes the arguments by reference.
Source§

fn num_ref_mul_assign(&mut self, rhs: &Self::Rhs) -> Result<()>

Computes &mut self *= rhs; (multiplication).
Source§

fn num_div(self, rhs: Self::Rhs) -> Result<Self::Out>
where Self: Sized,

Computes self / rhs (division).
Source§

fn num_ref_div(&self, rhs: &Self::Rhs) -> Result<Self::Out>

Like num_div but takes the arguments by reference.
Source§

fn num_ref_div_assign(&mut self, rhs: &Self::Rhs) -> Result<()>

Computes &mut self /= rhs; (division).
Source§

fn num_rem(self, rhs: Self::Rhs) -> Result<Self::Out>
where Self: Sized,

Computes self % rhs (remainder).
Source§

fn num_ref_rem(&self, rhs: &Self::Rhs) -> Result<Self::Out>

Like num_rem but takes the arguments by reference.
Source§

fn num_ref_rem_assign(&mut self, rhs: &Self::Rhs) -> Result<()>

Computes &mut self %= rhs; (remainder).
Source§

fn num_neg(self) -> Result<Self::Out>
where Self: Sized,

Computes -self (additive inverse).
Source§

fn num_ref_neg(&self) -> Result<Self::Out>

Like num_neg but takes the arguments by reference.
Source§

fn num_abs(self) -> Result<Self::Out>
where Self: Sized,

Computes |self| (absolute value).
Source§

fn num_ref_abs(&self) -> Result<Self::Out>

Like num_abs but takes the arguments by reference.
Source§

impl<T: Num, const D: usize> NumVector for Vector<T, D>

Source§

type Scalar = T

The associated scalar type.
Source§

impl<T: PartialEq, const D: usize> PartialEq for Vector<T, D>

Source§

fn eq(&self, other: &Self) -> 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: Clone + Sub<Output = T>, const D: usize> Sub for Vector<T, D>

Source§

type Output = Vector<T, D>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Clone + Sub<Output = T>, const D: usize> SubAssign<&Vector<T, D>> for Vector<T, D>

Source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
Source§

impl<T: Num + 'static, const D: usize> TryInto<Box<dyn NumVector<Rhs = Vector<T, D>, Inner = [T; D], Out = Vector<T, D>, Scalar = T>>> for Vector<T, D>

Available on crate feature alloc only.
Source§

type Error = NumError

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

fn try_into( self, ) -> Result<Box<dyn NumVector<Scalar = T, Rhs = Self, Inner = [T; D], Out = Self>>>

Performs the conversion.
Source§

impl<T: Copy, const D: usize> Copy for Vector<T, D>

Source§

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