![]() |
|
|
|
#1
|
|||
|
|||
|
The QuatDiff function simply uses the above method of computing the angle difference between the forward and up vectors, and returns the maximum of those two values.
You can modify the sample code I gave you to replicate this behavior. |
|
#2
|
|||
|
|||
|
Here is some code that calculates the difference between two angles based on the method steve described:
Code:
import viz
import math
viz.go()
euler1 = [90,0,0]
euler2 = [0,0,90]
def ComputeAngleDifference(euler1, euler2):
q1 = viz.Quat( vizmat.EulerToQuat(euler1) )
q2 = viz.Quat( vizmat.EulerToQuat(euler2) )
delta = q1 * q2.inverse()
return viz.degrees( math.acos( delta.w ) ) * 2.0
print ComputeAngleDifference(euler1,euler2)
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|