aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-08-16 23:44:34 +0100
committerUbitUmarov2017-08-16 23:44:34 +0100
commit218160494eab224ba1ac83491ff133154cfdb8b4 (patch)
tree6e5ab0876383f48b3e00bf91e351e9af9ae56680
parentMerge branch 'master' into BulletSim2017 (diff)
downloadopensim-SC_OLD-218160494eab224ba1ac83491ff133154cfdb8b4.zip
opensim-SC_OLD-218160494eab224ba1ac83491ff133154cfdb8b4.tar.gz
opensim-SC_OLD-218160494eab224ba1ac83491ff133154cfdb8b4.tar.bz2
opensim-SC_OLD-218160494eab224ba1ac83491ff133154cfdb8b4.tar.xz
fix llRot2Axis(ZERO_ROTATION) and non normalized inputs, same for llRot2Angle()
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs23
1 files changed, 9 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 75b6b0e..b810ffb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5527,20 +5527,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5527 { 5527 {
5528 m_host.AddScriptLPS(1); 5528 m_host.AddScriptLPS(1);
5529 5529
5530 if (Math.Abs(rot.s) > 1) // normalization needed 5530 rot.Normalize();
5531 rot.Normalize();
5532 5531
5533 double s = Math.Sqrt(1 - rot.s * rot.s); 5532 double s = Math.Sqrt(1 - rot.s * rot.s);
5534 if (s < 0.001) 5533 if (s < 1e-8)
5535 { 5534 return new LSL_Vector(0, 0, 0);
5536 return new LSL_Vector(1, 0, 0); 5535
5537 } 5536 double invS = 1.0 / s;
5538 else 5537 if (rot.s < 0)
5539 { 5538 invS = -invS;
5540 double invS = 1.0 / s; 5539 return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
5541 if (rot.s < 0) invS = -invS;
5542 return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
5543 }
5544 } 5540 }
5545 5541
5546 5542
@@ -5549,8 +5545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5549 { 5545 {
5550 m_host.AddScriptLPS(1); 5546 m_host.AddScriptLPS(1);
5551 5547
5552 if (Math.Abs(rot.s) > 1) // normalization needed 5548 rot.Normalize();
5553 rot.Normalize();
5554 5549
5555 double angle = 2 * Math.Acos(rot.s); 5550 double angle = 2 * Math.Acos(rot.s);
5556 if (angle > Math.PI) 5551 if (angle > Math.PI)