aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDahlia Trimble2009-04-08 03:16:24 +0000
committerDahlia Trimble2009-04-08 03:16:24 +0000
commitd5727c8c1a8c80bc00c748bbd8610e45f911b60c (patch)
treea52d19389beb0177d261abf032db16b6b0456794
parent* minor: remove some mono compiler warnings (diff)
downloadopensim-SC-d5727c8c1a8c80bc00c748bbd8610e45f911b60c.zip
opensim-SC-d5727c8c1a8c80bc00c748bbd8610e45f911b60c.tar.gz
opensim-SC-d5727c8c1a8c80bc00c748bbd8610e45f911b60c.tar.bz2
opensim-SC-d5727c8c1a8c80bc00c748bbd8610e45f911b60c.tar.xz
Correct unit test for llAngleBetween()
Reinstate patch for Mantis #3007
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs6
2 files changed, 3 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fe051e6..0f7d039 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4277,8 +4277,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4277 m_host.AddScriptLPS(1); 4277 m_host.AddScriptLPS(1);
4278 4278
4279 double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; 4279 double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2;
4280 //if (angle < 0) angle = -angle; 4280 if (angle < 0) angle = -angle;
4281 //if (angle > Math.PI) return (Math.PI * 2 - angle); 4281 if (angle > Math.PI) return (Math.PI * 2 - angle);
4282 return angle; 4282 return angle;
4283 } 4283 }
4284 4284
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 336cc12..cde772b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
45 public class LSL_ApiTest 45 public class LSL_ApiTest
46 { 46 {
47 47
48 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-7; 48 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
49 private LSL_Api lslApi; 49 private LSL_Api lslApi;
50 50
51 [SetUp] 51 [SetUp]
@@ -73,22 +73,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
73 TestllAngleBetween(new Vector3(1, 0, 0), 0); 73 TestllAngleBetween(new Vector3(1, 0, 0), 0);
74 TestllAngleBetween(new Vector3(1, 0, 0), 90); 74 TestllAngleBetween(new Vector3(1, 0, 0), 90);
75 TestllAngleBetween(new Vector3(1, 0, 0), 180); 75 TestllAngleBetween(new Vector3(1, 0, 0), 180);
76 //TestllAngleBetween(new Vector3(1, 0, 0), 270); // angles cant be larger than 180
77 76
78 TestllAngleBetween(new Vector3(0, 1, 0), 0); 77 TestllAngleBetween(new Vector3(0, 1, 0), 0);
79 TestllAngleBetween(new Vector3(0, 1, 0), 90); 78 TestllAngleBetween(new Vector3(0, 1, 0), 90);
80 TestllAngleBetween(new Vector3(0, 1, 0), 180); 79 TestllAngleBetween(new Vector3(0, 1, 0), 180);
81 //TestllAngleBetween(new Vector3(0, 1, 0), 270);
82 80
83 TestllAngleBetween(new Vector3(0, 0, 1), 0); 81 TestllAngleBetween(new Vector3(0, 0, 1), 0);
84 TestllAngleBetween(new Vector3(0, 0, 1), 90); 82 TestllAngleBetween(new Vector3(0, 0, 1), 90);
85 TestllAngleBetween(new Vector3(0, 0, 1), 180); 83 TestllAngleBetween(new Vector3(0, 0, 1), 180);
86 //TestllAngleBetween(new Vector3(0, 0, 1), 270);
87 84
88 TestllAngleBetween(new Vector3(1, 1, 1), 0); 85 TestllAngleBetween(new Vector3(1, 1, 1), 0);
89 TestllAngleBetween(new Vector3(1, 1, 1), 90); 86 TestllAngleBetween(new Vector3(1, 1, 1), 90);
90 TestllAngleBetween(new Vector3(1, 1, 1), 180); 87 TestllAngleBetween(new Vector3(1, 1, 1), 180);
91 //TestllAngleBetween(new Vector3(1, 1, 1), 270);
92 } 88 }
93 89
94 private void TestllAngleBetween(Vector3 axis,float originalAngle) 90 private void TestllAngleBetween(Vector3 axis,float originalAngle)