Skip to content

Commit 3ecad2e

Browse files
committed
Slerp documentation update
1 parent 6c40de6 commit 3ecad2e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/qvm.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,18 @@ Preconditions: :: `t>=0 && t\<=1`.
23832383

23842384
Returns: :: A quaternion that is the result of Spherical Linear Interpolation of the quaternions `a` and `b` and the interpolation parameter `c`. When `slerp` is applied to unit quaternions, the quaternion path maps to a path through 3D rotations in a standard way. The effect is a rotation with uniform angular velocity around a fixed rotation axis.
23852385

2386+
[WARNING]
2387+
--
2388+
Many slerp implementations always take "the short path" if the angle between the input quaternions is greater than 180 degrees, however this is not the case with QVM.
2389+
2390+
There are use cases for both behaviors. If "the short path" behavior is preferable, when calling `slerp`, negate one of the quaternions if the dot product between the two quaternions is negative:
2391+
2392+
[source,c++]
2393+
----
2394+
auto r = slerp( dot(q1, q2) < 0 ? -q1 : q1, q2, t);
2395+
----
2396+
--
2397+
23862398
NOTE: The <<deduce_quat2,`deduce_quat2`>> template can be specialized to deduce the desired return type, given the types `A` and `B`.
23872399

23882400
'''

0 commit comments

Comments
 (0)