diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index a5db1c69..a56b69c3 100755 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -1542,6 +1542,17 @@ where pub fn inverse_transform_unit_vector(&self, v: &Unit>) -> Unit> { self.inverse() * v } + + /// Appends to `self` a rotation given in the axis-angle form, using a linearized formulation. + /// + /// This is faster, but approximate, way to compute `UnitQuaternion::new(axisangle) * self`. + #[inline] + pub fn append_axisangle_linearized(&self, axisangle: &Vector3) -> Self { + let half: N = crate::convert(0.5); + let q1 = self.into_inner(); + let q2 = Quaternion::from_imag(axisangle * half); + Unit::new_normalize(q1 + q2 * q1) + } } impl Default for UnitQuaternion {