diff options
author | dahlia | 2013-06-10 17:11:49 -0700 |
---|---|---|
committer | dahlia | 2013-06-10 17:11:49 -0700 |
commit | 9d9b9d4938687f97ac82fc22917471f22198ef12 (patch) | |
tree | 860ea56ca3a118c8f8e5465931a15e938d7f2a3f /OpenSim/Region/ScriptEngine | |
parent | llRot2Axis now checks absolute value of s rotation component before normalizi... (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 |
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 | ||