Add testdrive test-3drot.py
This commit is contained in:
@ -511,6 +511,8 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, FOV=math.tan(2*math.pi/9.0)):
|
||||
return 180-((180+deg)%360)
|
||||
def CalcPerspectiveCorrection(alpha, X, FOV=FOV):
|
||||
alpha = WrapAngle(alpha)
|
||||
if FOV is None:
|
||||
return alpha
|
||||
if 0 <= alpha <= 180:
|
||||
costheta = (FOV*math.cos(alpha*math.pi/180.0)-X*math.sin(alpha*math.pi/180.0))/(FOV+max(2, abs(X)+1)*math.sin(alpha*math.pi/180.0))
|
||||
try:
|
||||
@ -548,8 +550,8 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, FOV=math.tan(2*math.pi/9.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 = math.acos(math.cos(rotY)/math.cos(outY*math.pi/180.0))*180/math.pi
|
||||
outX = math.atan2(-math.sin(rotY)*math.cos(rotZ)*abs(math.cos(outY*math.pi/180.0)*(1 if math.sin(outY*math.pi/180.0) >= 0 else -1)), math.cos(rotY)*abs(math.sin(outY*math.pi/180.0)*(1 if math.cos(outY*math.pi/180.0) >= 0 else -1)))*180/math.pi
|
||||
outX = math.acos(math.cos(rotY)/math.cos(outY*math.pi/180.0))*180/math.pi
|
||||
#outX = math.atan2(-math.sin(rotY)*math.cos(rotZ)*abs(math.cos(outY*math.pi/180.0)*(1 if math.sin(outY*math.pi/180.0) >= 0 else -1)), math.cos(rotY)*abs(math.sin(outY*math.pi/180.0)*(1 if math.cos(outY*math.pi/180.0) >= 0 else -1)))*180/math.pi
|
||||
'''
|
||||
print(
|
||||
(rotY*180.0/math.pi, rotZ*180.0/math.pi),
|
||||
@ -560,8 +562,9 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, FOV=math.tan(2*math.pi/9.0)):
|
||||
)
|
||||
)
|
||||
'''
|
||||
outX = CalcPerspectiveCorrection(outX, -Y, FOV*0.75)
|
||||
outY = CalcPerspectiveCorrection(outY, X, FOV)
|
||||
if FOV is not None:
|
||||
outX = CalcPerspectiveCorrection(outX, -Y, FOV*0.75)
|
||||
outY = CalcPerspectiveCorrection(outY, X, FOV)
|
||||
return (WrapAngle(round(outX)), WrapAngle(round(outY)), WrapAngle(round(outZ)), 0, round(-0.75*Y*math.sin(outY*math.pi/180.0), 3))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user