Skip to content

Commit

Permalink
Optimize slerp edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Dec 3, 2024
1 parent 0c06d94 commit 7d84218
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rts/System/Quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ CQuaternion CQuaternion::Lerp(const CQuaternion& q1, const CQuaternion& q2, cons
}

CQuaternion CQuaternion::SLerp(const CQuaternion& q1, const CQuaternion& q2_, const float a) {
if (a == 0.0f)
return q1;
else if (a == 1.0f)
return q2_;

float cosTheta = q1.dot(q2_);

const float s = Sign(cosTheta);
Expand Down

0 comments on commit 7d84218

Please sign in to comment.