Quaternions and critically damped spring

794 Views Asked by At

I would like to apply critically damped spring smoothing method to smooth movement on the unit sphere to a desired orientation. I have two quaternions, one that represent current orientation and one that represents the target orientation. Somehow I'm convinced that there is a way to smooth the "quaternion" movement using critically damped spring. Is there?

1

There are 1 best solutions below

1
On

I would approach this by using spherical linear interpolation and dampening $t$ during each iteration as it changes from 0 (the starting orientation) to 1 (the target orientation). Using the total angular distance and desired angular velocity you can get the $t$ velocity.

In terms of pseudo code, it would look something like this I think

// startQ
// endQ
angDist = startQ.angularDistance(endQ)
tVel = desiredAngVel / angDist

t = 0
while(t < 1) {
  // Args- target t, current t, &t velocity
  // Returns new t
  // The function internally will also need a timestep and damping factor
  t = criticallyDampedSpring(1, t, &tVel) 
  Quaternion currentQ = startQ.slerp(t, endQ)
}