aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs17
1 files changed, 6 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 c315d03..9744526 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5136,6 +5136,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5136 else 5136 else
5137 { 5137 {
5138 double invS = 1.0 / s; 5138 double invS = 1.0 / s;
5139 if (rot.s < 0) invS = -invS;
5139 return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS); 5140 return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
5140 } 5141 }
5141 } 5142 }
@@ -5146,19 +5147,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5146 { 5147 {
5147 m_host.AddScriptLPS(1); 5148 m_host.AddScriptLPS(1);
5148 5149
5149 if (rot.s > 1) // normalization needed 5150 if (Math.Abs(rot.s) > 1) // normalization needed
5150 { 5151 rot.Normalize();
5151 double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
5152 rot.z * rot.z + rot.s * rot.s);
5153
5154 rot.x /= length;
5155 rot.y /= length;
5156 rot.z /= length;
5157 rot.s /= length;
5158 }
5159 5152
5160 double angle = 2 * Math.Acos(rot.s); 5153 double angle = 2 * Math.Acos(rot.s);
5161 if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; 5154 if (angle > Math.PI)
5155 angle = 2 * Math.PI - angle;
5156
5162 return angle; 5157 return angle;
5163 } 5158 }
5164 5159