aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2013-06-11 01:03:15 +0100
committerMelanie2013-06-11 01:03:15 +0100
commita022ee576639c1bbceb5c4ba8de3cbd82e538bb3 (patch)
treefb0d2ee165b7c87e814fc35c6551a26c2c6a488a /OpenSim/Region/ScriptEngine
parentMerge branch 'master' into careminster (diff)
parentCheck For NaN and Infinity in llRot2Axis/Angle Fixes mantis #6669 (diff)
downloadopensim-SC_OLD-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.zip
opensim-SC_OLD-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.tar.gz
opensim-SC_OLD-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.tar.bz2
opensim-SC_OLD-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs25
2 files changed, 30 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7c375e6..f5d5bc6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5109,6 +5109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5109 5109
5110 s = Math.Cos(angle * 0.5); 5110 s = Math.Cos(angle * 0.5);
5111 t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs 5111 t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs
5112 axis = LSL_Vector.Norm(axis);
5112 x = axis.x * t; 5113 x = axis.x * t;
5113 y = axis.y * t; 5114 y = axis.y * t;
5114 z = axis.z * t; 5115 z = axis.z * t;
@@ -5149,7 +5150,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5149 y = rot.y / s; 5150 y = rot.y / s;
5150 z = rot.z / s; 5151 z = rot.z / s;
5151 } 5152 }
5152 5153 if ((double.IsNaN(x)) || double.IsInfinity(x)) x = 0;
5154 if ((double.IsNaN(y)) || double.IsInfinity(y)) y = 0;
5155 if ((double.IsNaN(z)) || double.IsInfinity(z)) z = 0;
5153 return new LSL_Vector(x,y,z); 5156 return new LSL_Vector(x,y,z);
5154 } 5157 }
5155 5158
@@ -5171,7 +5174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5171 } 5174 }
5172 5175
5173 double angle = 2 * Math.Acos(rot.s); 5176 double angle = 2 * Math.Acos(rot.s);
5174 5177 if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0;
5175 return angle; 5178 return angle;
5176 } 5179 }
5177 5180
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 3e69ab9..c685afb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -371,6 +371,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
371 371
372 #endregion 372 #endregion
373 373
374 #region Methods
375 public Quaternion Normalize()
376 {
377 double length = Math.Sqrt(x * x + y * y + z * z + s * s);
378 if (length < float.Epsilon)
379 {
380 x = 1;
381 y = 0;
382 z = 0;
383 s = 0;
384 }
385 else
386 {
387
388 double invLength = 1.0 / length;
389 x *= invLength;
390 y *= invLength;
391 z *= invLength;
392 s *= invLength;
393 }
394
395 return this;
396 }
397 #endregion
398
374 #region Overriders 399 #region Overriders
375 400
376 public override int GetHashCode() 401 public override int GetHashCode()