aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-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)