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>
impl<T: Float> Vector3Wrapper<T>
Sourcepub fn matrix_product(self, m: DCM<T>) -> Self
pub fn matrix_product(self, m: DCM<T>) -> Self
Product of Vector3Wrapper and DCM.
m * self
Sourcepub fn sum(self) -> ScalarWrapper<T>
pub fn sum(self) -> ScalarWrapper<T>
Sum of the element of the vector.
Sourcepub fn scale_add(self, s: ScalarWrapper<T>, b: Vector3Wrapper<T>) -> Self
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).
Sourcepub fn hadamard(self, other: Vector3Wrapper<T>) -> Self
pub fn hadamard(self, other: Vector3Wrapper<T>) -> Self
Hadamard product of vector.
Calculate a ∘ b
Sourcepub fn hadamard_add(self, b: Vector3Wrapper<T>, c: Vector3Wrapper<T>) -> Self
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).
Sourcepub fn dot(self, other: Vector3Wrapper<T>) -> ScalarWrapper<T>
pub fn dot(self, other: Vector3Wrapper<T>) -> ScalarWrapper<T>
Dot product of the vector.
Sourcepub fn cross(self, other: Vector3Wrapper<T>) -> Self
pub fn cross(self, other: Vector3Wrapper<T>) -> Self
Cross product of the vector.
self × other
Sourcepub fn norm(self) -> ScalarWrapper<T>
pub fn norm(self) -> ScalarWrapper<T>
Calcurate the L2 norm of the vector.
Sourcepub fn normalize(self) -> Self
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 );
Sourcepub fn inv(self) -> Self
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 );
Sourcepub fn exp(self) -> QuaternionWrapper<T>
pub fn exp(self) -> QuaternionWrapper<T>
Exponential function of vector.
Trait Implementations§
Source§impl<T: Float> Add<QuaternionWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Add<QuaternionWrapper<T>> for Vector3Wrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
+
operator.Source§fn add(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>
fn add(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>
+
operation. Read moreSource§impl<T: Float> Add<ScalarWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Add<ScalarWrapper<T>> for Vector3Wrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
+
operator.Source§fn add(self, other: ScalarWrapper<T>) -> QuaternionWrapper<T>
fn add(self, other: ScalarWrapper<T>) -> QuaternionWrapper<T>
+
operation. Read moreSource§impl<T: Float> Add<Vector3Wrapper<T>> for QuaternionWrapper<T>
impl<T: Float> Add<Vector3Wrapper<T>> for QuaternionWrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
+
operator.Source§fn add(self, other: Vector3Wrapper<T>) -> Self
fn add(self, other: Vector3Wrapper<T>) -> Self
+
operation. Read moreSource§impl<T: Float> Add<Vector3Wrapper<T>> for ScalarWrapper<T>
impl<T: Float> Add<Vector3Wrapper<T>> for ScalarWrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
+
operator.Source§fn add(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>
fn add(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>
+
operation. Read moreSource§impl<T: Float> Add for Vector3Wrapper<T>
impl<T: Float> Add for Vector3Wrapper<T>
Source§type Output = Vector3Wrapper<T>
type Output = Vector3Wrapper<T>
+
operator.Source§fn add(self, other: Vector3Wrapper<T>) -> Self
fn add(self, other: Vector3Wrapper<T>) -> Self
+
operation. Read moreSource§impl<T: Float> AddAssign for Vector3Wrapper<T>
impl<T: Float> AddAssign for Vector3Wrapper<T>
Source§fn add_assign(&mut self, other: Vector3Wrapper<T>)
fn add_assign(&mut self, other: Vector3Wrapper<T>)
+=
operation. Read moreSource§impl<T: Clone> Clone for Vector3Wrapper<T>
impl<T: Clone> Clone for Vector3Wrapper<T>
Source§fn clone(&self) -> Vector3Wrapper<T>
fn clone(&self) -> Vector3Wrapper<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Debug> Debug for Vector3Wrapper<T>
impl<T: Debug> Debug for Vector3Wrapper<T>
Source§impl<T: Float> Div<ScalarWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Div<ScalarWrapper<T>> for Vector3Wrapper<T>
Source§type Output = Vector3Wrapper<T>
type Output = Vector3Wrapper<T>
/
operator.Source§fn div(self, other: ScalarWrapper<T>) -> Self
fn div(self, other: ScalarWrapper<T>) -> Self
/
operation. Read moreSource§impl<T: Float> Mul<QuaternionWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Mul<QuaternionWrapper<T>> for Vector3Wrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
*
operator.Source§fn mul(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>
fn mul(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>
*
operation. Read moreSource§impl<T: Float> Mul<ScalarWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Mul<ScalarWrapper<T>> for Vector3Wrapper<T>
Source§type Output = Vector3Wrapper<T>
type Output = Vector3Wrapper<T>
*
operator.Source§fn mul(self, other: ScalarWrapper<T>) -> Self
fn mul(self, other: ScalarWrapper<T>) -> Self
*
operation. Read moreSource§impl<T: Float> Mul<Vector3Wrapper<T>> for QuaternionWrapper<T>
impl<T: Float> Mul<Vector3Wrapper<T>> for QuaternionWrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
*
operator.Source§fn mul(self, other: Vector3Wrapper<T>) -> Self
fn mul(self, other: Vector3Wrapper<T>) -> Self
*
operation. Read moreSource§impl<T: Float> Mul<Vector3Wrapper<T>> for ScalarWrapper<T>
impl<T: Float> Mul<Vector3Wrapper<T>> for ScalarWrapper<T>
Source§type Output = Vector3Wrapper<T>
type Output = Vector3Wrapper<T>
*
operator.Source§fn mul(self, other: Vector3Wrapper<T>) -> Vector3Wrapper<T>
fn mul(self, other: Vector3Wrapper<T>) -> Vector3Wrapper<T>
*
operation. Read moreSource§impl<T: Float> Mul for Vector3Wrapper<T>
impl<T: Float> Mul for Vector3Wrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
*
operator.Source§fn mul(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>
fn mul(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>
*
operation. Read moreSource§impl<T: Float> Neg for Vector3Wrapper<T>
impl<T: Float> Neg for Vector3Wrapper<T>
Source§impl<T: Float> Sub<QuaternionWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Sub<QuaternionWrapper<T>> for Vector3Wrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
-
operator.Source§fn sub(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>
fn sub(self, other: QuaternionWrapper<T>) -> QuaternionWrapper<T>
-
operation. Read moreSource§impl<T: Float> Sub<ScalarWrapper<T>> for Vector3Wrapper<T>
impl<T: Float> Sub<ScalarWrapper<T>> for Vector3Wrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
-
operator.Source§fn sub(self, other: ScalarWrapper<T>) -> QuaternionWrapper<T>
fn sub(self, other: ScalarWrapper<T>) -> QuaternionWrapper<T>
-
operation. Read moreSource§impl<T: Float> Sub<Vector3Wrapper<T>> for QuaternionWrapper<T>
impl<T: Float> Sub<Vector3Wrapper<T>> for QuaternionWrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
-
operator.Source§fn sub(self, other: Vector3Wrapper<T>) -> Self
fn sub(self, other: Vector3Wrapper<T>) -> Self
-
operation. Read moreSource§impl<T: Float> Sub<Vector3Wrapper<T>> for ScalarWrapper<T>
impl<T: Float> Sub<Vector3Wrapper<T>> for ScalarWrapper<T>
Source§type Output = QuaternionWrapper<T>
type Output = QuaternionWrapper<T>
-
operator.Source§fn sub(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>
fn sub(self, other: Vector3Wrapper<T>) -> QuaternionWrapper<T>
-
operation. Read moreSource§impl<T: Float> Sub for Vector3Wrapper<T>
impl<T: Float> Sub for Vector3Wrapper<T>
Source§type Output = Vector3Wrapper<T>
type Output = Vector3Wrapper<T>
-
operator.Source§fn sub(self, other: Vector3Wrapper<T>) -> Self
fn sub(self, other: Vector3Wrapper<T>) -> Self
-
operation. Read moreSource§impl<T: Float> SubAssign for Vector3Wrapper<T>
impl<T: Float> SubAssign for Vector3Wrapper<T>
Source§fn sub_assign(&mut self, other: Vector3Wrapper<T>)
fn sub_assign(&mut self, other: Vector3Wrapper<T>)
-=
operation. Read more