Thread: Saving as a WRL
View Single Post
  #4  
Old 05-14-2008, 09:49 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The VRML rotation field is an axis-angle rotation. To convert a Vizard axis-angle rotation to a VRML axix-angle rotation, you will need to negate the x,y components of the axis vector and convert the degrees to radians. Here is a function that will return the VRML rotation of a cone given the bottom and top points of the cone:
Code:
def getVRMLConeRotation(bottom,top):
	
	v = viz.Vector(top)
	v -= bottom
	
	m = viz.Matrix()
	m.makeVecRotVec([0,1,0],v)
	
	r = m.getAxisAngle()
	
	return -r[0],-r[1],r[2],viz.radians(r[3])
Reply With Quote