diff options
author | Melanie Thielker | 2008-09-19 17:00:17 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-19 17:00:17 +0000 |
commit | 592f98c4aaa5265a31c481a49cfc7afb49590da3 (patch) | |
tree | 27a3509ff0fa9039e394f0f079cab400fc0126b9 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Fix issue introduces by a fix in 6256. Fixes mantis #2214 (diff) | |
download | opensim-SC_OLD-592f98c4aaa5265a31c481a49cfc7afb49590da3.zip opensim-SC_OLD-592f98c4aaa5265a31c481a49cfc7afb49590da3.tar.gz opensim-SC_OLD-592f98c4aaa5265a31c481a49cfc7afb49590da3.tar.bz2 opensim-SC_OLD-592f98c4aaa5265a31c481a49cfc7afb49590da3.tar.xz |
Mantis #2217
Guard against NaN being returned from llRotBetween. Return a zero rotation
if the result is NaN.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 758cf4b..bff63f1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -581,7 +581,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
581 | LSL_Types.Vector3 axis = LSL_Types.Vector3.Norm(crossProduct); | 581 | LSL_Types.Vector3 axis = LSL_Types.Vector3.Norm(crossProduct); |
582 | double s = Math.Sin(angle / 2); | 582 | double s = Math.Sin(angle / 2); |
583 | 583 | ||
584 | return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2)); | 584 | double x = axis.x * s; |
585 | double y = axis.y * s; | ||
586 | double z = axis.z * s; | ||
587 | double w = Math.Cos(angle / 2); | ||
588 | |||
589 | if(Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w)) | ||
590 | return new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | ||
591 | |||
592 | return new LSL_Types.Quaternion((float)x, (float)y, (float)z, (float)w); | ||
585 | } | 593 | } |
586 | 594 | ||
587 | public void llWhisper(int channelID, string text) | 595 | public void llWhisper(int channelID, string text) |