From 9d9b9d4938687f97ac82fc22917471f22198ef12 Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 10 Jun 2013 17:11:49 -0700 Subject: llRot2Angle now checks absolute value of s rotation component before normalizing --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'OpenSim') 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 { m_host.AddScriptLPS(1); - if (rot.s > 1) // normalization needed - { - double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y + - rot.z * rot.z + rot.s * rot.s); - - rot.x /= length; - rot.y /= length; - rot.z /= length; - rot.s /= length; - } + if (Math.Abs(rot.s) > 1) // normalization needed + rot.Normalize(); double angle = 2 * Math.Acos(rot.s); - if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; + return angle; } -- cgit v1.1