mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Simplify the llRot2Euler equations.
We save a few multiplications by dividing both atan2 arguments by 2.
This commit is contained in:
parent
6ac02854aa
commit
250438dfe9
1 changed files with 4 additions and 4 deletions
|
@ -1584,14 +1584,14 @@ def llRot2Euler(r):
|
||||||
|
|
||||||
# Check gimbal lock conditions
|
# Check gimbal lock conditions
|
||||||
if abs(y) > 0.99999:
|
if abs(y) > 0.99999:
|
||||||
return Vector(F32((0., math.asin(y), math.atan2(2.*(r[2]*r[3]+r[0]*r[1]),
|
return Vector(F32((0., math.asin(y), math.atan2(r[2]*r[3]+r[0]*r[1],
|
||||||
1.-2.*(r[0]*r[0]+r[2]*r[2])))))
|
.5-(r[0]*r[0]+r[2]*r[2])))))
|
||||||
|
|
||||||
qy2 = r[1]*r[1]
|
qy2 = r[1]*r[1]
|
||||||
return Vector(F32((
|
return Vector(F32((
|
||||||
math.atan2(2.*(r[0]*r[3]-r[1]*r[2]), 1.-2.*(r[0]*r[0]+qy2)),
|
math.atan2(r[0]*r[3]-r[1]*r[2], .5-(r[0]*r[0]+qy2)),
|
||||||
math.asin(y),
|
math.asin(y),
|
||||||
math.atan2(2.*(r[2]*r[3]-r[0]*r[1]), 1.-2.*(r[2]*r[2]+qy2))
|
math.atan2(r[2]*r[3]-r[0]*r[1], .5-(r[2]*r[2]+qy2))
|
||||||
)))
|
)))
|
||||||
|
|
||||||
def llRot2Fwd(r):
|
def llRot2Fwd(r):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue