pub struct Vector3Wrapper<T>(pub Vector3<T>);
Expand description

Treated as Pure Quaternion.

QuaternionWrapper = ScalarWrapper + Vector3Wrapper

Tuple Fields§

§0: Vector3<T>

Implementations§

source§

impl<T: Float> Vector3Wrapper<T>

source

pub fn new(v: Vector3<T>) -> Self

Create a new Vector3Wrapper

source

pub fn unwrap(self) -> Vector3<T>

Returns the Vector3<T>

source

pub fn matrix_product(self, m: DCM<T>) -> Self

Product of Vector3Wrapper and DCM.

m * self

source

pub fn sum(self) -> ScalarWrapper<T>

Sum of the element of the vector.

source

pub fn scale_add(self, s: ScalarWrapper<T>, b: Vector3Wrapper<T>) -> Self

Calculate s*self + b

If the fma feature is enabled, the FMA calculation is performed using the mul_add method. If not enabled, it’s computed by unfused multiply-add (s*a + b).

source

pub fn hadamard(self, other: Vector3Wrapper<T>) -> Self

Hadamard product of vector.

Calculate a ∘ b

source

pub fn hadamard_add(self, b: Vector3Wrapper<T>, c: Vector3Wrapper<T>) -> Self

Hadamard product and Addiction of Vector.

Calculate a ∘ b + c

If the fma feature is enabled, the FMA calculation is performed using the mul_add method. If not enabled, it’s computed by unfused multiply-add (s*a + b).

source

pub fn dot(self, other: Vector3Wrapper<T>) -> ScalarWrapper<T>

Dot product of the vector.

source

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

Cross product of the vector.

self × other

source

pub fn norm(self) -> ScalarWrapper<T>

Calcurate the L2 norm of the vector.

source

pub fn normalize(self) -> Self

Normalization of vector.

If you enter a zero vector, it returns a zero vector.

Examples
// This norm is not 1.
let v = Vector3Wrapper::<f64>::new([1.0, 2.0, 3.0]);
assert!( (1.0 - v.norm().unwrap()).abs() > 1e-12 );
 
// Now that normalized, this norm is 1!
let v_n = v.normalize();
assert!( (1.0 - v_n.norm().unwrap()).abs() < 1e-12 );
source

pub fn inv(self) -> Self

Calculate the inverse of pure quaternion.

Examples
let v = Vector3Wrapper::<f64>::new( [1.0, 2.0, 3.0] );
 
// Identity quaternion
let id = (v * v.inv()).unwrap();  // = (v.inv() * v).unwrap()
 
assert!( (id.0 - 1.0).abs() < 1e-12 );
assert!( id.1[0].abs() < 1e-12 );
assert!( id.1[1].abs() < 1e-12 );
assert!( id.1[2].abs() < 1e-12 );
source

pub fn exp(self) -> QuaternionWrapper<T>

Exponential function of vector.

Trait Implementations§

source§

impl<T: Float> Add<QuaternionWrapper<T>> for Vector3Wrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the + operator.
source§

fn add(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>

Performs the + operation. Read more
source§

impl<T: Float> Add<ScalarWrapper<T>> for Vector3Wrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the + operator.
source§

fn add(self, other: ScalarWrapper<T>) -> QuaternionWrapper<T>

Performs the + operation. Read more
source§

impl<T: Float> Add<Vector3Wrapper<T>> for QuaternionWrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Vector3Wrapper<T>) -> Self

Performs the + operation. Read more
source§

impl<T: Float> Add<Vector3Wrapper<T>> for ScalarWrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>

Performs the + operation. Read more
source§

impl<T: Float> Add<Vector3Wrapper<T>> for Vector3Wrapper<T>

§

type Output = Vector3Wrapper<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Vector3Wrapper<T>) -> Self

Performs the + operation. Read more
source§

impl<T: Float> AddAssign<Vector3Wrapper<T>> for Vector3Wrapper<T>

source§

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

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Vector3Wrapper<T>

source§

fn clone(&self) -> Vector3Wrapper<T>

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> Debug for Vector3Wrapper<T>

source§

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

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

impl<T: Float> Div<ScalarWrapper<T>> for Vector3Wrapper<T>

§

type Output = Vector3Wrapper<T>

The resulting type after applying the / operator.
source§

fn div(self, other: ScalarWrapper<T>) -> Self

Performs the / operation. Read more
source§

impl<T: Float> Mul<QuaternionWrapper<T>> for Vector3Wrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T: Float> Mul<ScalarWrapper<T>> for Vector3Wrapper<T>

§

type Output = Vector3Wrapper<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: ScalarWrapper<T>) -> Self

Performs the * operation. Read more
source§

impl<T: Float> Mul<Vector3Wrapper<T>> for QuaternionWrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: Vector3Wrapper<T>) -> Self

Performs the * operation. Read more
source§

impl<T: Float> Mul<Vector3Wrapper<T>> for ScalarWrapper<T>

§

type Output = Vector3Wrapper<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T: Float> Mul<Vector3Wrapper<T>> for Vector3Wrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>

Performs the * operation. Read more
source§

impl<T: Float> Neg for Vector3Wrapper<T>

§

type Output = Vector3Wrapper<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<T: Float> Sub<QuaternionWrapper<T>> for Vector3Wrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>

Performs the - operation. Read more
source§

impl<T: Float> Sub<ScalarWrapper<T>> for Vector3Wrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: ScalarWrapper<T>) -> QuaternionWrapper<T>

Performs the - operation. Read more
source§

impl<T: Float> Sub<Vector3Wrapper<T>> for QuaternionWrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Vector3Wrapper<T>) -> Self

Performs the - operation. Read more
source§

impl<T: Float> Sub<Vector3Wrapper<T>> for ScalarWrapper<T>

§

type Output = QuaternionWrapper<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>

Performs the - operation. Read more
source§

impl<T: Float> Sub<Vector3Wrapper<T>> for Vector3Wrapper<T>

§

type Output = Vector3Wrapper<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Vector3Wrapper<T>) -> Self

Performs the - operation. Read more
source§

impl<T: Float> SubAssign<Vector3Wrapper<T>> for Vector3Wrapper<T>

source§

fn sub_assign(&mut self, other: Vector3Wrapper<T>)

Performs the -= operation. Read more
source§

impl<T: Copy> Copy for Vector3Wrapper<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Vector3Wrapper<T>where T: RefUnwindSafe,

§

impl<T> Send for Vector3Wrapper<T>where T: Send,

§

impl<T> Sync for Vector3Wrapper<T>where T: Sync,

§

impl<T> Unpin for Vector3Wrapper<T>where T: Unpin,

§

impl<T> UnwindSafe for Vector3Wrapper<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.