Struct na::geometry::DualQuaternion[][src]

#[repr(C)]
pub struct DualQuaternion<N> where
    N: SimdRealField
{ pub real: Quaternion<N>, pub dual: Quaternion<N>, }

A dual quaternion.

Indexing

DualQuaternions are stored as [..real, ..dual]. Both of the quaternion components are laid out in i, j, k, w order.


let real = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let dual = Quaternion::new(5.0, 6.0, 7.0, 8.0);

let dq = DualQuaternion::from_real_and_dual(real, dual);
assert_eq!(dq[0], 2.0);
assert_eq!(dq[1], 3.0);

assert_eq!(dq[4], 6.0);
assert_eq!(dq[7], 5.0);

NOTE: As of December 2020, dual quaternion support is a work in progress. If a feature that you need is missing, feel free to open an issue or a PR. See https://github.com/dimforge/nalgebra/issues/487

Fields

real: Quaternion<N>

The real component of the quaternion

dual: Quaternion<N>

The dual component of the quaternion

Implementations

impl<N> DualQuaternion<N> where
    N: SimdRealField,
    <N as SimdValue>::Element: SimdRealField
[src]

#[must_use = "Did you mean to use normalize_mut()?"]
pub fn normalize(&self) -> DualQuaternion<N>
[src]

Normalizes this quaternion.

Example

let real = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let dual = Quaternion::new(5.0, 6.0, 7.0, 8.0);
let dq = DualQuaternion::from_real_and_dual(real, dual);

let dq_normalized = dq.normalize();

relative_eq!(dq_normalized.real.norm(), 1.0);

pub fn normalize_mut(&mut self)[src]

Normalizes this quaternion.

Example

let real = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let dual = Quaternion::new(5.0, 6.0, 7.0, 8.0);
let mut dq = DualQuaternion::from_real_and_dual(real, dual);

dq.normalize_mut();

relative_eq!(dq.real.norm(), 1.0);

impl<N> DualQuaternion<N> where
    N: SimdRealField
[src]

pub fn from_real_and_dual(
    real: Quaternion<N>,
    dual: Quaternion<N>
) -> DualQuaternion<N>
[src]

Creates a dual quaternion from its rotation and translation components.

Example

let rot = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let trans = Quaternion::new(5.0, 6.0, 7.0, 8.0);

let dq = DualQuaternion::from_real_and_dual(rot, trans);
assert_eq!(dq.real.w, 1.0);

pub fn identity() -> DualQuaternion<N>[src]

The dual quaternion multiplicative identity

Example


let dq1 = DualQuaternion::identity();
let dq2 = DualQuaternion::from_real_and_dual(
    Quaternion::new(1.,2.,3.,4.),
    Quaternion::new(5.,6.,7.,8.)
);

assert_eq!(dq1 * dq2, dq2);
assert_eq!(dq2 * dq1, dq2);

Trait Implementations

impl<N> Add<DualQuaternion<N>> for DualQuaternion<N> where
    N: SimdRealField,
    <N as SimdValue>::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the + operator.

impl<N> AsMut<[N; 8]> for DualQuaternion<N> where
    N: SimdRealField
[src]

impl<N> AsRef<[N; 8]> for DualQuaternion<N> where
    N: SimdRealField
[src]

impl<N> Clone for DualQuaternion<N> where
    N: Clone + SimdRealField
[src]

impl<N> Debug for DualQuaternion<N> where
    N: Debug + SimdRealField
[src]

impl<N> Default for DualQuaternion<N> where
    N: Default + SimdRealField
[src]

impl<'a, N> Deserialize<'a> for DualQuaternion<N> where
    N: SimdRealField + Deserialize<'a>, 
[src]

impl<N> Index<usize> for DualQuaternion<N> where
    N: SimdRealField
[src]

type Output = N

The returned type after indexing.

impl<N> IndexMut<usize> for DualQuaternion<N> where
    N: SimdRealField
[src]

impl<N> Mul<DualQuaternion<N>> for DualQuaternion<N> where
    N: SimdRealField,
    <N as SimdValue>::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the * operator.

impl<N> Mul<N> for DualQuaternion<N> where
    N: SimdRealField,
    <N as SimdValue>::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the * operator.

impl<N> PartialEq<DualQuaternion<N>> for DualQuaternion<N> where
    N: PartialEq<N> + SimdRealField
[src]

impl<N> Serialize for DualQuaternion<N> where
    N: SimdRealField + Serialize
[src]

impl<N> Sub<DualQuaternion<N>> for DualQuaternion<N> where
    N: SimdRealField,
    <N as SimdValue>::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the - operator.

impl<N> Copy for DualQuaternion<N> where
    N: Copy + SimdRealField
[src]

impl<N> Eq for DualQuaternion<N> where
    N: Eq + SimdRealField
[src]

impl<N> StructuralEq for DualQuaternion<N> where
    N: SimdRealField
[src]

impl<N> StructuralPartialEq for DualQuaternion<N> where
    N: SimdRealField
[src]

Auto Trait Implementations

impl<N> RefUnwindSafe for DualQuaternion<N> where
    N: RefUnwindSafe

impl<N> Send for DualQuaternion<N>

impl<N> Sync for DualQuaternion<N>

impl<N> Unpin for DualQuaternion<N> where
    N: Unpin

impl<N> UnwindSafe for DualQuaternion<N> where
    N: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoPnt<Point<T, U2>> for T where
    T: Scalar
[src]

impl<T> IntoPnt<Point<T, U3>> for T where
    T: Scalar
[src]

impl<T> IntoPnt<Point<T, U4>> for T where
    T: Scalar
[src]

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> JoinPnt<T, Point<T, U2>> for T where
    T: Scalar
[src]

type Output = Point<T, U3>

impl<T> JoinPnt<T, Point<T, U3>> for T where
    T: Scalar
[src]

type Output = Point<T, U4>

impl<T> JoinPnt<T, T> for T where
    T: Scalar
[src]

type Output = Point<T, U2>

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]