mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 20:55:43 +08:00
* This is the fabled LibOMV update with all of the libOMV types from JHurliman
* This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point. Regular people should let the dust settle. * This has been tested to work with most basic functions. However.. make sure you back up 'everything' before using this. It's that big! * Essentially we're back at square 1 in the testing phase.. so lets identify things that broke.
This commit is contained in:
@@ -26,17 +26,17 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using libsecondlife;
|
||||
using OpenMetaverse;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace OpenSim.Tests.Common
|
||||
{
|
||||
public class VectorToleranceConstraint : ANumericalToleranceConstraint
|
||||
{
|
||||
private LLVector3 _baseValue;
|
||||
private LLVector3 _valueToBeTested;
|
||||
private Vector3 _baseValue;
|
||||
private Vector3 _valueToBeTested;
|
||||
|
||||
public VectorToleranceConstraint(LLVector3 baseValue, double tolerance) : base(tolerance)
|
||||
public VectorToleranceConstraint(Vector3 baseValue, double tolerance) : base(tolerance)
|
||||
{
|
||||
_baseValue = baseValue;
|
||||
}
|
||||
@@ -54,12 +54,12 @@ namespace OpenSim.Tests.Common
|
||||
{
|
||||
throw new ArgumentException("Constraint cannot be used upon null values.");
|
||||
}
|
||||
if (valueToBeTested.GetType() != typeof (LLVector3))
|
||||
if (valueToBeTested.GetType() != typeof (Vector3))
|
||||
{
|
||||
throw new ArgumentException("Constraint cannot be used upon non vector values.");
|
||||
}
|
||||
|
||||
_valueToBeTested = (LLVector3) valueToBeTested;
|
||||
_valueToBeTested = (Vector3) valueToBeTested;
|
||||
|
||||
return (IsWithinDoubleConstraint(_valueToBeTested.X, _baseValue.X) &&
|
||||
IsWithinDoubleConstraint(_valueToBeTested.Y, _baseValue.Y) &&
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using libsecondlife;
|
||||
using OpenMetaverse;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
using OpenSim.Tests.Common;
|
||||
@@ -38,15 +38,15 @@ namespace OpenSim.Framework.Tests
|
||||
[Test]
|
||||
public void VectorOperationTests()
|
||||
{
|
||||
LLVector3 v1, v2;
|
||||
Vector3 v1, v2;
|
||||
double expectedDistance;
|
||||
double expectedMagnitude;
|
||||
double lowPrecisionTolerance = 0.001;
|
||||
|
||||
//Lets test a simple case of <0,0,0> and <5,5,5>
|
||||
{
|
||||
v1 = new LLVector3(0, 0, 0);
|
||||
v2 = new LLVector3(5, 5, 5);
|
||||
v1 = new Vector3(0, 0, 0);
|
||||
v2 = new Vector3(5, 5, 5);
|
||||
expectedDistance = 8.66;
|
||||
Assert.That(Util.GetDistanceTo(v1, v2),
|
||||
new DoubleToleranceConstraint(expectedDistance, lowPrecisionTolerance),
|
||||
@@ -65,9 +65,9 @@ namespace OpenSim.Framework.Tests
|
||||
Assert.That(causesArgumentException, Is.True,
|
||||
"Getting magnitude of null vector did not cause argument exception.");
|
||||
|
||||
LLVector3 expectedNormalizedVector = new LLVector3(.577f, .577f, .577f);
|
||||
Vector3 expectedNormalizedVector = new Vector3(.577f, .577f, .577f);
|
||||
double expectedNormalizedMagnitude = 1;
|
||||
LLVector3 normalizedVector = Util.GetNormalizedVector(v2);
|
||||
Vector3 normalizedVector = Util.GetNormalizedVector(v2);
|
||||
Assert.That(normalizedVector,
|
||||
new VectorToleranceConstraint(expectedNormalizedVector, lowPrecisionTolerance),
|
||||
"Normalized vector generated from vector was not what was expected.");
|
||||
@@ -78,8 +78,8 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
//Lets test a simple case of <0,0,0> and <0,0,0>
|
||||
{
|
||||
v1 = new LLVector3(0, 0, 0);
|
||||
v2 = new LLVector3(0, 0, 0);
|
||||
v1 = new Vector3(0, 0, 0);
|
||||
v2 = new Vector3(0, 0, 0);
|
||||
expectedDistance = 0;
|
||||
Assert.That(Util.GetDistanceTo(v1, v2),
|
||||
new DoubleToleranceConstraint(expectedDistance, lowPrecisionTolerance),
|
||||
@@ -106,8 +106,8 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
//Lets test a simple case of <0,0,0> and <-5,-5,-5>
|
||||
{
|
||||
v1 = new LLVector3(0, 0, 0);
|
||||
v2 = new LLVector3(-5, -5, -5);
|
||||
v1 = new Vector3(0, 0, 0);
|
||||
v2 = new Vector3(-5, -5, -5);
|
||||
expectedDistance = 8.66;
|
||||
Assert.That(Util.GetDistanceTo(v1, v2),
|
||||
new DoubleToleranceConstraint(expectedDistance, lowPrecisionTolerance),
|
||||
@@ -126,9 +126,9 @@ namespace OpenSim.Framework.Tests
|
||||
Assert.That(causesArgumentException, Is.True,
|
||||
"Getting magnitude of null vector did not cause argument exception.");
|
||||
|
||||
LLVector3 expectedNormalizedVector = new LLVector3(-.577f, -.577f, -.577f);
|
||||
Vector3 expectedNormalizedVector = new Vector3(-.577f, -.577f, -.577f);
|
||||
double expectedNormalizedMagnitude = 1;
|
||||
LLVector3 normalizedVector = Util.GetNormalizedVector(v2);
|
||||
Vector3 normalizedVector = Util.GetNormalizedVector(v2);
|
||||
Assert.That(normalizedVector,
|
||||
new VectorToleranceConstraint(expectedNormalizedVector, lowPrecisionTolerance),
|
||||
"Normalized vector generated from vector was not what was expected.");
|
||||
|
||||
Reference in New Issue
Block a user