Pass rotation angles directly when rotY or rotZ equals to 0 or 180 degrees
This commit is contained in:
parent
f95697edd8
commit
4f451da99b
@ -538,11 +538,16 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, FOV=math.tan(2*math.pi/9.0)):
|
|||||||
return WrapAngle(theta)
|
return WrapAngle(theta)
|
||||||
X = 2*X-1
|
X = 2*X-1
|
||||||
Y = 2*Y-1
|
Y = 2*Y-1
|
||||||
rotY = -rotY*math.pi/180.0 # Positive value means clockwise in Flas
|
if WrapAngle(rotY) in (0, 180) or WrapAngle(rotZ) in (0, 180):
|
||||||
rotZ = -rotZ*math.pi/180.0
|
outX = 0
|
||||||
outY = math.atan2(-math.sin(rotY)*math.cos(rotZ), math.cos(rotY))*180/math.pi
|
outY = -rotY # Positive value means clockwise in Flash
|
||||||
outZ = math.atan2(-math.cos(rotY)*math.sin(rotZ), math.cos(rotZ))*180/math.pi
|
outZ = -rotZ
|
||||||
outX = math.asin(-math.sin(rotY)*math.sin(rotZ))*180/math.pi
|
else:
|
||||||
|
rotY = rotY*math.pi/180.0
|
||||||
|
rotZ = rotZ*math.pi/180.0
|
||||||
|
outY = math.atan2(-math.sin(rotY)*math.cos(rotZ), math.cos(rotY))*180/math.pi
|
||||||
|
outZ = math.atan2(-math.cos(rotY)*math.sin(rotZ), math.cos(rotZ))*180/math.pi
|
||||||
|
outX = math.asin(-math.sin(rotY)*math.sin(rotZ))*180/math.pi
|
||||||
outX = CalcPerspectiveCorrection(outX, -Y, FOV*0.75)
|
outX = CalcPerspectiveCorrection(outX, -Y, FOV*0.75)
|
||||||
outY = CalcPerspectiveCorrection(outY, X, FOV)
|
outY = CalcPerspectiveCorrection(outY, X, FOV)
|
||||||
return (round(outX), round(outY), round(outZ), 0, round(-0.75*Y*math.sin(outY*math.pi/180.0), 3))
|
return (round(outX), round(outY), round(outZ), 0, round(-0.75*Y*math.sin(outY*math.pi/180.0), 3))
|
||||||
|
Loading…
Reference in New Issue
Block a user