![]() |
|
|
|
#1
|
|||
|
|||
|
I'm not sure what the problem is. The solution you are getting for those sets of euler angles is correct. The problem with getting non-unique solutions is when extracting euler angles from a matrix. In this example we are creating a matrix from euler angles, so there should be no problem.
|
|
#2
|
|||
|
|||
|
3 vectors?
Is the non-unique solution due to the selection of 90 degrees as the pitch angle? Ultimately, I need a unique solution. Is it reasonable to assume that this might be addressed by calculating the difference for a 3rd vector? I don't know the math so I'm only assuming the following modified script would retrieve the necessary values from the matrix to calculate a 3rd vector:
#Extract forward/up vector from euler1 m.setRot( vizmat.EulerToAxisAngle(euler1) ) d = m.get() forward1 = d[8:11] up1 = d[4:7] side1 = d[12:3] #Extract forward/up vector from euler2 m.setRot( vizmat.EulerToAxisAngle(euler2) ) d = m.get() forward2 = d[8:11] up2 = d[4:7] side2 = d[12:3] Am I wondering in the dark? Alternatively, wouldn't a unique solution also result if I calculated the displacement from the facing direction AND the angle of rotation about that axis (the facing direction)? |
|
#3
|
|||
|
|||
|
Yes, you could also compute the angle difference between the side vectors as well. Here is a modified version of the sample code that also returns the difference between the side vectors:
Code:
import viz viz.go() euler1 = [0,0,0] euler2 = [0,90,30] def ComputeAngleDifference(euler1, euler2): m = viz.Transform() #Extract forward/up/side vector from euler1 m.setRot( vizmat.EulerToAxisAngle(euler1) ) d = m.get() forward1 = d[8:11] up1 = d[4:7] side1 = d[:3] #Extract forward/up/side vector from euler2 m.setRot( vizmat.EulerToAxisAngle(euler2) ) d = m.get() forward2 = d[8:11] up2 = d[4:7] side2 = d[:3] #Compute angle difference between forward/up/side vectors forward_diff = vizmat.AngleBetweenVector(forward1,forward2) up_diff = vizmat.AngleBetweenVector(up1,up2) side_diff = vizmat.AngleBetweenVector(side1,side2) return forward_diff,up_diff,side_diff print ComputeAngleDifference(euler1,euler2) Quote:
|
|
#4
|
|||
|
|||
|
another hole
I don't mean to be a bother but the modified script still yields a non-unique solution. For example, both of the following sets of eulers yield the same solution:
euler1 = [30,90,0] euler2 = [0,0,0] euler1 = [0,90,30] euler2 = [0,0,0] solution: (90, 90, 30) I don't understand why this happens. Maybe the vector/rotation alternative may be a more practical solution. Thank you again for your help! |
|
#5
|
|||
|
|||
|
Those values are correct. I'm not sure what you are expecting. There is always going to be multiple euler sets that will yield the same angle difference. The vector/rotation alternative will also yield the same value for multiple sets. For example, the vector/rotation difference between the following sets will be the same:
Code:
euler1 = [0,0,0] euler2 = [90,0,0] #Vector difference will be 90 #Rotation difference will be 0 euler1 = [90,0,0] euler2 = [180,0,0] #Vector difference will be 90 #Rotation difference will be 0 |
|
#6
|
|||
|
|||
|
Yes
Yes, indeed! There are likely to be multiple euler sets that yield the same displacement errors. Sorry for being so bone-headed.
|
|
#7
|
|||
|
|||
|
No worries. I know how confusing all this 3d math can get.
Would you still like me to provide you with the vector/rotation alternative? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|