mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fix llRot2Fwd/llRot2Left/llRot2Up and add regression tests.
This commit is contained in:
parent
a8231586c1
commit
91fd9734c8
2 changed files with 19 additions and 3 deletions
|
@ -1568,21 +1568,21 @@ def llRot2Euler(r):
|
|||
|
||||
def llRot2Fwd(r):
|
||||
assert isrotation(r)
|
||||
v = (1., 0., 0.)
|
||||
v = Vector((1., 0., 0.))
|
||||
if r == (0., 0., 0., 0.):
|
||||
return v
|
||||
return llVecNorm(mul(v, r, f32=False))
|
||||
|
||||
def llRot2Left(r):
|
||||
assert isrotation(r)
|
||||
v = (0., 1., 0.)
|
||||
v = Vector((0., 1., 0.))
|
||||
if r == (0., 0., 0., 0.):
|
||||
return v
|
||||
return llVecNorm(mul(v, r, f32=False))
|
||||
|
||||
def llRot2Up(r):
|
||||
assert isrotation(r)
|
||||
v = (0., 0., 1.)
|
||||
v = Vector((0., 0., 1.))
|
||||
if r == (0., 0., 0., 0.):
|
||||
return v
|
||||
return llVecNorm(mul(v, r, f32=False))
|
||||
|
|
16
testfuncs.py
16
testfuncs.py
|
@ -924,6 +924,22 @@ def do_tests():
|
|||
test('llFrand(F32(1.4e-45))', 0.0)
|
||||
test('llFrand(F32(1.1754942106924411e-38))', 0.0)
|
||||
|
||||
test('llRot2Fwd(Quaternion((1.,0.,0.,0.)))', Vector((1.,0.,0.)))
|
||||
test('llRot2Fwd(Quaternion((0.,1.,0.,0.)))', Vector((-1.,0.,0.)))
|
||||
test('llRot2Fwd(Quaternion((0.,0.,1.,0.)))', Vector((-1.,0.,0.)))
|
||||
test('llRot2Fwd(Quaternion((0.,0.,0.,1.)))', Vector((1.,0.,0.)))
|
||||
test('llRot2Fwd(Quaternion((0.,0.,0.,0.)))', Vector((1.,0.,0.)))
|
||||
test('llRot2Left(Quaternion((1.,0.,0.,0.)))', Vector((0.,-1.,0.)))
|
||||
test('llRot2Left(Quaternion((0.,1.,0.,0.)))', Vector((0.,1.,0.)))
|
||||
test('llRot2Left(Quaternion((0.,0.,1.,0.)))', Vector((0.,-1.,0.)))
|
||||
test('llRot2Left(Quaternion((0.,0.,0.,1.)))', Vector((0.,1.,0.)))
|
||||
test('llRot2Left(Quaternion((0.,0.,0.,0.)))', Vector((0.,1.,0.)))
|
||||
test('llRot2Up(Quaternion((1.,0.,0.,0.)))', Vector((0.,0.,-1.)))
|
||||
test('llRot2Up(Quaternion((0.,1.,0.,0.)))', Vector((0.,0.,-1.)))
|
||||
test('llRot2Up(Quaternion((0.,0.,1.,0.)))', Vector((0.,0.,1.)))
|
||||
test('llRot2Up(Quaternion((0.,0.,0.,1.)))', Vector((0.,0.,1.)))
|
||||
test('llRot2Up(Quaternion((0.,0.,0.,0.)))', Vector((0.,0.,1.)))
|
||||
|
||||
lslcommon.IsCalc = True
|
||||
test('cond(llGenerateKey())', True)
|
||||
lslcommon.IsCalc = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue