Struct nalgebra::geometry::DualQuaternion [−][src]
#[repr(C)]pub struct DualQuaternion<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: SimdRealField> DualQuaternion<N> where
N::Element: SimdRealField,
[src]
impl<N: SimdRealField> DualQuaternion<N> where
N::Element: SimdRealField,
[src]#[must_use = "Did you mean to use normalize_mut()?"]pub fn normalize(&self) -> 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 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: SimdRealField> DualQuaternion<N>
[src]
impl<N: SimdRealField> DualQuaternion<N>
[src]pub fn from_real_and_dual(real: Quaternion<N>, dual: Quaternion<N>) -> Self
[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() -> Self
[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: SimdRealField> Add<DualQuaternion<N>> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]
impl<N: SimdRealField> Add<DualQuaternion<N>> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]type Output = DualQuaternion<N>
The resulting type after applying the +
operator.
fn add(self, rhs: DualQuaternion<N>) -> Self::Output
[src]
impl<N: SimdRealField> AsMut<[N; 8]> for DualQuaternion<N>
[src]
impl<N: SimdRealField> AsMut<[N; 8]> for DualQuaternion<N>
[src]impl<N: SimdRealField> AsRef<[N; 8]> for DualQuaternion<N>
[src]
impl<N: SimdRealField> AsRef<[N; 8]> for DualQuaternion<N>
[src]impl<N: Clone + SimdRealField> Clone for DualQuaternion<N>
[src]
impl<N: Clone + SimdRealField> Clone for DualQuaternion<N>
[src]fn clone(&self) -> DualQuaternion<N>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<N: Debug + SimdRealField> Debug for DualQuaternion<N>
[src]
impl<N: Debug + SimdRealField> Debug for DualQuaternion<N>
[src]impl<N: Default + SimdRealField> Default for DualQuaternion<N>
[src]
impl<N: Default + SimdRealField> Default for DualQuaternion<N>
[src]fn default() -> DualQuaternion<N>
[src]
impl<'a, N: SimdRealField> Deserialize<'a> for DualQuaternion<N> where
N: Deserialize<'a>,
[src]
impl<'a, N: SimdRealField> Deserialize<'a> for DualQuaternion<N> where
N: Deserialize<'a>,
[src]fn deserialize<Des>(deserializer: Des) -> Result<Self, Des::Error> where
Des: Deserializer<'a>,
[src]
Des: Deserializer<'a>,
impl<N: SimdRealField> Index<usize> for DualQuaternion<N>
[src]
impl<N: SimdRealField> Index<usize> for DualQuaternion<N>
[src]impl<N: SimdRealField> IndexMut<usize> for DualQuaternion<N>
[src]
impl<N: SimdRealField> IndexMut<usize> for DualQuaternion<N>
[src]impl<N: SimdRealField> Mul<DualQuaternion<N>> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]
impl<N: SimdRealField> Mul<DualQuaternion<N>> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]type Output = DualQuaternion<N>
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self::Output
[src]
impl<N: SimdRealField> Mul<N> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]
impl<N: SimdRealField> Mul<N> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]type Output = DualQuaternion<N>
The resulting type after applying the *
operator.
fn mul(self, rhs: N) -> Self::Output
[src]
impl<N: PartialEq + SimdRealField> PartialEq<DualQuaternion<N>> for DualQuaternion<N>
[src]
impl<N: PartialEq + SimdRealField> PartialEq<DualQuaternion<N>> for DualQuaternion<N>
[src]fn eq(&self, other: &DualQuaternion<N>) -> bool
[src]
fn ne(&self, other: &DualQuaternion<N>) -> bool
[src]
impl<N: SimdRealField> Serialize for DualQuaternion<N> where
N: Serialize,
[src]
impl<N: SimdRealField> Serialize for DualQuaternion<N> where
N: Serialize,
[src]fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl<N: SimdRealField> Sub<DualQuaternion<N>> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]
impl<N: SimdRealField> Sub<DualQuaternion<N>> for DualQuaternion<N> where
N::Element: SimdRealField,
[src]type Output = DualQuaternion<N>
The resulting type after applying the -
operator.
fn sub(self, rhs: DualQuaternion<N>) -> Self::Output
[src]
impl<N: Copy + SimdRealField> Copy for DualQuaternion<N>
[src]
impl<N: Eq + SimdRealField> Eq for DualQuaternion<N>
[src]
impl<N: SimdRealField> StructuralEq for DualQuaternion<N>
[src]
impl<N: SimdRealField> StructuralPartialEq for DualQuaternion<N>
[src]
Auto Trait Implementations
impl<N> RefUnwindSafe for DualQuaternion<N> where
N: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for DualQuaternion<N>
impl<N> Sync for DualQuaternion<N>
impl<N> Unpin for DualQuaternion<N> where
N: Unpin,
N: Unpin,
impl<N> UnwindSafe for DualQuaternion<N> where
N: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,