Correct unit test for llAngleBetween()

Reinstate patch for Mantis #3007
0.6.5-rc1
Dahlia Trimble 2009-04-08 03:16:24 +00:00
parent ad7b005784
commit d5727c8c1a
2 changed files with 3 additions and 7 deletions

View File

@ -4277,8 +4277,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2;
//if (angle < 0) angle = -angle; if (angle < 0) angle = -angle;
//if (angle > Math.PI) return (Math.PI * 2 - angle); if (angle > Math.PI) return (Math.PI * 2 - angle);
return angle; return angle;
} }

View File

@ -45,7 +45,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
public class LSL_ApiTest public class LSL_ApiTest
{ {
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-7; private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
private LSL_Api lslApi; private LSL_Api lslApi;
[SetUp] [SetUp]
@ -73,22 +73,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TestllAngleBetween(new Vector3(1, 0, 0), 0); TestllAngleBetween(new Vector3(1, 0, 0), 0);
TestllAngleBetween(new Vector3(1, 0, 0), 90); TestllAngleBetween(new Vector3(1, 0, 0), 90);
TestllAngleBetween(new Vector3(1, 0, 0), 180); TestllAngleBetween(new Vector3(1, 0, 0), 180);
//TestllAngleBetween(new Vector3(1, 0, 0), 270); // angles cant be larger than 180
TestllAngleBetween(new Vector3(0, 1, 0), 0); TestllAngleBetween(new Vector3(0, 1, 0), 0);
TestllAngleBetween(new Vector3(0, 1, 0), 90); TestllAngleBetween(new Vector3(0, 1, 0), 90);
TestllAngleBetween(new Vector3(0, 1, 0), 180); TestllAngleBetween(new Vector3(0, 1, 0), 180);
//TestllAngleBetween(new Vector3(0, 1, 0), 270);
TestllAngleBetween(new Vector3(0, 0, 1), 0); TestllAngleBetween(new Vector3(0, 0, 1), 0);
TestllAngleBetween(new Vector3(0, 0, 1), 90); TestllAngleBetween(new Vector3(0, 0, 1), 90);
TestllAngleBetween(new Vector3(0, 0, 1), 180); TestllAngleBetween(new Vector3(0, 0, 1), 180);
//TestllAngleBetween(new Vector3(0, 0, 1), 270);
TestllAngleBetween(new Vector3(1, 1, 1), 0); TestllAngleBetween(new Vector3(1, 1, 1), 0);
TestllAngleBetween(new Vector3(1, 1, 1), 90); TestllAngleBetween(new Vector3(1, 1, 1), 90);
TestllAngleBetween(new Vector3(1, 1, 1), 180); TestllAngleBetween(new Vector3(1, 1, 1), 180);
//TestllAngleBetween(new Vector3(1, 1, 1), 270);
} }
private void TestllAngleBetween(Vector3 axis,float originalAngle) private void TestllAngleBetween(Vector3 axis,float originalAngle)