samboooo / pyeuclid

Automatically exported from code.google.com/p/pyeuclid
0 stars 0 forks source link

Quaternion interpolation for small rotational differences #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The Quaternion.new_interpolate function does not interpolate small angles 
correctly. It looks like the code is written to skip interpolation altogether 
if the angle between the quaternions is too small.

        theta = math.acos(costheta)
        if abs(theta) < 0.01:
            Q.w = q2.w
            Q.x = q2.x
            Q.y = q2.y
            Q.z = q2.z
            return Q

        sintheta = math.sqrt(1.0 - costheta * costheta)
        if abs(sintheta) < 0.01:
            Q.w = (q1.w + q2.w) * 0.5
            Q.x = (q1.x + q2.x) * 0.5
            Q.y = (q1.y + q2.y) * 0.5
            Q.z = (q1.z + q2.z) * 0.5
            return Q

However for my application I require accurate interpolation and have switched 
to using a different method to do this. It seems like you would want to get rid 
of these shortcuts in favor of accuracy?

Original issue reported on code.google.com by chris.fl...@gmail.com on 18 Nov 2013 at 4:46