aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authordahlia2013-06-10 17:11:49 -0700
committerdahlia2013-06-10 17:11:49 -0700
commit9d9b9d4938687f97ac82fc22917471f22198ef12 (patch)
tree860ea56ca3a118c8f8e5465931a15e938d7f2a3f /OpenSim/Region/ScriptEngine/Shared
parentllRot2Axis now checks absolute value of s rotation component before normalizi... (diff)
downloadopensim-SC_OLD-9d9b9d4938687f97ac82fc22917471f22198ef12.zip
opensim-SC_OLD-9d9b9d4938687f97ac82fc22917471f22198ef12.tar.gz
opensim-SC_OLD-9d9b9d4938687f97ac82fc22917471f22198ef12.tar.bz2
opensim-SC_OLD-9d9b9d4938687f97ac82fc22917471f22198ef12.tar.xz
llRot2Angle now checks absolute value of s rotation component before normalizing
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs14
1 files changed, 3 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c48285a..39bac82 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4688,19 +4688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4688 { 4688 {
4689 m_host.AddScriptLPS(1); 4689 m_host.AddScriptLPS(1);
4690 4690
4691 if (rot.s > 1) // normalization needed 4691 if (Math.Abs(rot.s) > 1) // normalization needed
4692 { 4692 rot.Normalize();
4693 double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
4694 rot.z * rot.z + rot.s * rot.s);
4695
4696 rot.x /= length;
4697 rot.y /= length;
4698 rot.z /= length;
4699 rot.s /= length;
4700 }
4701 4693
4702 double angle = 2 * Math.Acos(rot.s); 4694 double angle = 2 * Math.Acos(rot.s);
4703 if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; 4695
4704 return angle; 4696 return angle;
4705 } 4697 }
4706 4698