From a18c90d7c3f295cbebfa9e1921529d84150ca73e Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Wed, 30 Apr 2014 20:36:09 +0800 Subject: [PATCH] Experimental rotation conversion --- danmaku2ass.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 2f088e7..66a2cc7 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -542,7 +542,7 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, FOV=math.tan(2*math.pi/9.0)): Y = 2*Y-1 rotY = WrapAngle(rotY) rotZ = WrapAngle(rotZ) - if rotY in (0, 180) or rotZ in (0, 180): + if rotY == 0 or rotZ == 0: outX = 0 outY = -rotY # Positive value means clockwise in Flash outZ = -rotZ @@ -551,19 +551,7 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, FOV=math.tan(2*math.pi/9.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 = 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), - (outX, outY, outZ), - ( - math.sin(rotY)*math.sin(rotZ), - -(math.sin(rotY)+math.sin(outY*math.pi/180.0)*math.cos(outZ*math.pi/180.0))/math.cos(outY*math.pi/180.0)/math.sin(outZ*math.pi/180.0) - ) - ) - ''' + outX = math.asin(math.sin(rotY)*math.sin(rotZ))*180/math.pi if FOV is not None: outX = CalcPerspectiveCorrection(outX, -Y, FOV*0.75) outY = CalcPerspectiveCorrection(outY, X, FOV)