Vector

Struct Vector 

Source
pub struct Vector<const P: usize, const Q: usize, const R: usize> {
    pub mv: Multivector<P, Q, R>,
}
Expand description

Vector type - wrapper around Multivector with only grade 1

Fields§

§mv: Multivector<P, Q, R>

Implementations§

Source§

impl<const P: usize, const Q: usize, const R: usize> Vector<P, Q, R>

Source

pub fn zero() -> Self

Create zero vector

Source

pub fn from_components(x: f64, y: f64, z: f64) -> Self

Source

pub fn e1() -> Self

Source

pub fn e2() -> Self

Source

pub fn e3() -> Self

Source

pub fn from_multivector(mv: &Multivector<P, Q, R>) -> Self

Source

pub fn geometric_product(&self, other: &Self) -> Multivector<P, Q, R>

Source

pub fn geometric_product_with_multivector( &self, other: &Multivector<P, Q, R>, ) -> Multivector<P, Q, R>

Source

pub fn geometric_product_with_bivector( &self, other: &Bivector<P, Q, R>, ) -> Multivector<P, Q, R>

Source

pub fn geometric_product_with_scalar( &self, other: &Scalar<P, Q, R>, ) -> Multivector<P, Q, R>

Source

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

Source

pub fn magnitude(&self) -> f64

Source

pub fn as_slice(&self) -> &[f64]

Source

pub fn inner_product(&self, other: &Self) -> Multivector<P, Q, R>

Inner product with another vector

Source

pub fn inner_product_with_mv( &self, other: &Multivector<P, Q, R>, ) -> Multivector<P, Q, R>

Inner product with a multivector

Source

pub fn inner_product_with_bivector( &self, other: &Bivector<P, Q, R>, ) -> Multivector<P, Q, R>

Inner product with a bivector

Source

pub fn outer_product(&self, other: &Self) -> Multivector<P, Q, R>

Outer product with another vector

Source

pub fn outer_product_with_mv( &self, other: &Multivector<P, Q, R>, ) -> Multivector<P, Q, R>

Outer product with a multivector

Source

pub fn outer_product_with_bivector( &self, other: &Bivector<P, Q, R>, ) -> Multivector<P, Q, R>

Outer product with a bivector

Source

pub fn left_contraction( &self, other: &Bivector<P, Q, R>, ) -> Multivector<P, Q, R>

Left contraction with bivector

Source

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

Normalize the vector (return unit vector if possible)

Source

pub fn norm_squared(&self) -> f64

Compute the squared norm of the vector

Source

pub fn reverse(&self) -> Self

Compute the reverse (for vectors, this is the same as the original)

Source

pub fn norm(&self) -> f64

Compute the norm (magnitude) of the vector

Note: This method is maintained for backward compatibility. New code should prefer magnitude() for clarity.

Source

pub fn hodge_dual(&self) -> Bivector<P, Q, R>

Hodge dual of the vector Maps vectors to bivectors in 3D space

Trait Implementations§

Source§

impl<const P: usize, const Q: usize, const R: usize> Clone for Vector<P, Q, R>

Source§

fn clone(&self) -> Vector<P, Q, R>

Returns a duplicate 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<const P: usize, const Q: usize, const R: usize> Debug for Vector<P, Q, R>

Source§

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

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

impl<const P: usize, const Q: usize, const R: usize> PartialEq for Vector<P, Q, R>

Source§

fn eq(&self, other: &Vector<P, Q, R>) -> 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<const P: usize, const Q: usize, const R: usize> StructuralPartialEq for Vector<P, Q, R>

Auto Trait Implementations§

§

impl<const P: usize, const Q: usize, const R: usize> Freeze for Vector<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> RefUnwindSafe for Vector<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> Send for Vector<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> Sync for Vector<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> Unpin for Vector<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> UnwindSafe for Vector<P, Q, R>

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, 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.