WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-16-2007, 03:13 PM
astull astull is offline
Member
 
Join Date: Dec 2005
Posts: 9
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!
Reply With Quote
  #2  
Old 02-16-2007, 03:32 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
From your first post it seems you are interested in the relative error between the two orientations. I don't see how having non-unique solutions affects this. Maybe I'm misunderstanding your original request.
Reply With Quote
  #3  
Old 02-16-2007, 04:28 PM
astull astull is offline
Member
 
Join Date: Dec 2005
Posts: 9
Yes

Yes, indeed! There are likely to be multiple euler sets that yield the same displacement errors. Sorry for being so bone-headed.
Reply With Quote
  #4  
Old 02-16-2007, 04:33 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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?
Reply With Quote
  #5  
Old 02-16-2007, 04:51 PM
astull astull is offline
Member
 
Join Date: Dec 2005
Posts: 9
Please

Yes, it would be helpful if you could offer a script for calculating the vector/rotation. Fewer variables makes the analysis much easier.

Thank you.

Last edited by astull; 02-16-2007 at 04:54 PM.
Reply With Quote
  #6  
Old 02-16-2007, 05:41 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is the vector/rotation code:
Code:
import viz
viz.go()

euler1 = [0,0,30]
euler2 = [0,5,-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 = vizmat.Vector(d[4:7])
	
	#Extract up vector from euler1 without roll
	m.setRot( vizmat.EulerToAxisAngle(euler1[0],euler1[1],0.0) )
	d = m.get()
	up1_no_roll = vizmat.Vector(d[4:7])
	
	#Compute rotation around forward vector of euler1
	roll1 = vizmat.AngleBetweenVector(up1,up1_no_roll)
	if (up1_no_roll.cross(up1) * forward1) < 0.0:
		roll1 *= -1.0
	
	#Extract forward/up/side vector from euler2
	m.setRot( vizmat.EulerToAxisAngle(euler2) )
	d = m.get()
	forward2 = d[8:11]
	up2 = vizmat.Vector(d[4:7])
	
	#Extract up vector from euler2 without roll
	m.setRot( vizmat.EulerToAxisAngle(euler2[0],euler2[1],0.0) )
	d = m.get()
	up2_no_roll = vizmat.Vector(d[4:7])
	
	#Compute rotation around forward vector of euler2
	roll2 = vizmat.AngleBetweenVector(up2,up2_no_roll)
	if (up2_no_roll.cross(up2) * forward2) < 0.0:
		roll2 *= -1.0

	#Compute angle difference between forward/up/side vectors
	forward_diff = vizmat.AngleBetweenVector(forward1,forward2)
	rotation_diff = abs(vizmat.AngleDiff(roll1,roll2))

	return forward_diff,rotation_diff
	
print ComputeAngleDifference(euler1,euler2)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:55 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC