diff options
llRot2Euler() now returns angles -PI < angle < PI
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 077315e..f261c16 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -476,9 +476,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
476 | // normalize an angle between -PI and PI (-180 to +180 degrees) | 476 | // normalize an angle between -PI and PI (-180 to +180 degrees) |
477 | protected double NormalizeAngle(double angle) | 477 | protected double NormalizeAngle(double angle) |
478 | { | 478 | { |
479 | angle = angle % (Math.PI * 2); | 479 | if (angle > -Math.PI && angle < Math.PI) |
480 | // if (angle < 0) angle = angle + Math.PI * 2; | 480 | return angle; |
481 | return angle; | 481 | |
482 | int numPis = (int)(Math.PI / angle); | ||
483 | double remainder = angle - Math.PI * numPis; | ||
484 | if (numPis % 2 == 1) | ||
485 | return Math.PI - angle; | ||
486 | return remainder; | ||
482 | } | 487 | } |
483 | 488 | ||
484 | // Old implementation of llRot2Euler, now normalized | 489 | // Old implementation of llRot2Euler, now normalized |