DualQuaternion: Fix to_vector self convention.
By taking a ref, we can avoid an extra copy on the caller side.
This commit is contained in:
parent
f404bcbd6d
commit
bfb84e8fc6
|
@ -320,7 +320,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: RealField> DualQuaternion<T> {
|
impl<T: RealField> DualQuaternion<T> {
|
||||||
fn to_vector(self) -> OVector<T, U8> {
|
fn to_vector(&self) -> OVector<T, U8> {
|
||||||
self.as_ref().clone().into()
|
self.as_ref().clone().into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,9 +335,9 @@ impl<T: RealField + AbsDiffEq<Epsilon = T>> AbsDiffEq for DualQuaternion<T> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool {
|
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool {
|
||||||
self.clone().to_vector().abs_diff_eq(&other.clone().to_vector(), epsilon.clone()) ||
|
self.to_vector().abs_diff_eq(&other.to_vector(), epsilon.clone()) ||
|
||||||
// Account for the double-covering of S², i.e. q = -q
|
// Account for the double-covering of S², i.e. q = -q
|
||||||
self.clone().to_vector().iter().zip(other.clone().to_vector().iter()).all(|(a, b)| a.abs_diff_eq(&-b.clone(), epsilon.clone()))
|
self.to_vector().iter().zip(other.to_vector().iter()).all(|(a, b)| a.abs_diff_eq(&-b.clone(), epsilon.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,9 +354,9 @@ impl<T: RealField + RelativeEq<Epsilon = T>> RelativeEq for DualQuaternion<T> {
|
||||||
epsilon: Self::Epsilon,
|
epsilon: Self::Epsilon,
|
||||||
max_relative: Self::Epsilon,
|
max_relative: Self::Epsilon,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
self.clone().to_vector().relative_eq(&other.clone().to_vector(), epsilon.clone(), max_relative.clone()) ||
|
self.to_vector().relative_eq(&other.to_vector(), epsilon.clone(), max_relative.clone()) ||
|
||||||
// Account for the double-covering of S², i.e. q = -q
|
// Account for the double-covering of S², i.e. q = -q
|
||||||
self.clone().to_vector().iter().zip(other.clone().to_vector().iter()).all(|(a, b)| a.relative_eq(&-b.clone(), epsilon.clone(), max_relative.clone()))
|
self.to_vector().iter().zip(other.to_vector().iter()).all(|(a, b)| a.relative_eq(&-b.clone(), epsilon.clone(), max_relative.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,9 +368,9 @@ impl<T: RealField + UlpsEq<Epsilon = T>> UlpsEq for DualQuaternion<T> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool {
|
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool {
|
||||||
self.clone().to_vector().ulps_eq(&other.clone().to_vector(), epsilon.clone(), max_ulps) ||
|
self.to_vector().ulps_eq(&other.to_vector(), epsilon.clone(), max_ulps) ||
|
||||||
// Account for the double-covering of S², i.e. q = -q.
|
// Account for the double-covering of S², i.e. q = -q.
|
||||||
self.clone().to_vector().iter().zip(other.clone().to_vector().iter()).all(|(a, b)| a.ulps_eq(&-b.clone(), epsilon.clone(), max_ulps))
|
self.to_vector().iter().zip(other.to_vector().iter()).all(|(a, b)| a.ulps_eq(&-b.clone(), epsilon.clone(), max_ulps))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue