Skip to content

Instantly share code, notes, and snippets.

@usefulslug
Created September 11, 2015 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usefulslug/1a925ed706fd8ab80808 to your computer and use it in GitHub Desktop.
Save usefulslug/1a925ed706fd8ab80808 to your computer and use it in GitHub Desktop.
// Tries to compute sensible tangent values for the quaternion
def Intermediate(q0 as Quaternion, q1 as Quaternion, q2 as Quaternion):
q1inv as Quaternion = Quaternion.Inverse(q1)
c1 as Quaternion = q1inv * q2
c2 as Quaternion = q1inv * q0
c1.Log()
c2.Log()
c3 as Quaternion = c2 + c1
c3.Scale(-0.25)
c3.Exp()
r as Quaternion = q1 * c3
r.Normalize()
return r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment