3d-dart/server/system/NAfunctionLib.py
def UnitvecToDegree(gltilt,glroll,glangle):
	
	"""Calculate orientation of global angle in Euler angle space"""
	
	ftilt = cmp(gltilt,0)
	froll = cmp(glroll,0)
	
	orient1 = math.degrees(math.acos(pow((gltilt/glangle),2)*ftilt))
	orient2 = math.degrees(math.acos(pow((glroll/glangle),2)*froll))
	
	if ftilt == 1 and froll == 1:
		return orient1
	elif ftilt == -1 and froll == 1:
		return orient1
	elif ftilt == -1 and froll == -1:
		return orient2+90
	elif ftilt == 1 and froll == 0:
		return 0.0		
	else:
		return 360-orient1
Calculate orientation of global angle in Euler angle space
Calculate orientation of global angle in Euler angle space
Calculate orientation of global angle in Euler angle space
def UnitvecToDegree(gltilt,glroll,glangle):
	ftilt = cmp(gltilt,0)
	froll = cmp(glroll,0)
	orient1 = math.degrees(math.acos(pow((gltilt/glangle),2)*ftilt))
	orient2 = math.degrees(math.acos(pow((glroll/glangle),2)*froll))
	if ftilt == 1 and froll == 1:
		return orient1
	elif ftilt == -1 and froll == 1:
		return orient1
	elif ftilt == -1 and froll == -1:
		return orient2+90
	elif ftilt == 1 and froll == 0:
		return 0.0		
	else:
		return 360-orient1
def UnitvecToDegree ( gltilt , glroll , glangle ) : ftilt = cmp ( gltilt , 0 ) froll = cmp ( glroll , 0 ) orient1 = math . degrees ( math . acos ( pow ( ( gltilt / glangle ) , 2 ) * ftilt ) ) orient2 = math . degrees ( math . acos ( pow ( ( glroll / glangle ) , 2 ) * froll ) ) if ftilt == 1 and froll == 1 : return orient1 elif ftilt == - 1 and froll == 1 : return orient1 elif ftilt == - 1 and froll == - 1 : return orient2 + 90 elif ftilt == 1 and froll == 0 : return 0.0 else : return 360 - orient1
Calculate orientation of global angle in Euler angle space
Calculate orientation of global angle in Euler angle space
"""Calculate orientation of global angle in Euler angle space"""
gltilt
glroll
glangle