http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java index 296ade8..a0e9f59 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java @@ -27,7 +27,7 @@ import org.apache.commons.math4.exception.DimensionMismatchException; import org.apache.commons.math4.exception.MathArithmeticException; import org.apache.commons.math4.geometry.Space; import org.apache.commons.math4.geometry.euclidean.threed.Rotation; -import org.apache.commons.math4.geometry.euclidean.threed.Coordinates3D; +import org.apache.commons.math4.geometry.euclidean.threed.Cartesian3D; import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.rng.simple.RandomSource; import org.apache.commons.math4.util.FastMath; @@ -39,27 +39,27 @@ public class Vector3DTest { @Test public void testConstructors() throws DimensionMismatchException { double r = FastMath.sqrt(2) /2; - checkVector(new Coordinates3D(2, new Coordinates3D(FastMath.PI / 3, -FastMath.PI / 4)), + checkVector(new Cartesian3D(2, new Cartesian3D(FastMath.PI / 3, -FastMath.PI / 4)), r, r * FastMath.sqrt(3), -2 * r); - checkVector(new Coordinates3D(2, Coordinates3D.PLUS_I, - -3, Coordinates3D.MINUS_K), + checkVector(new Cartesian3D(2, Cartesian3D.PLUS_I, + -3, Cartesian3D.MINUS_K), 2, 0, 3); - checkVector(new Coordinates3D(2, Coordinates3D.PLUS_I, - 5, Coordinates3D.PLUS_J, - -3, Coordinates3D.MINUS_K), + checkVector(new Cartesian3D(2, Cartesian3D.PLUS_I, + 5, Cartesian3D.PLUS_J, + -3, Cartesian3D.MINUS_K), 2, 5, 3); - checkVector(new Coordinates3D(2, Coordinates3D.PLUS_I, - 5, Coordinates3D.PLUS_J, - 5, Coordinates3D.MINUS_J, - -3, Coordinates3D.MINUS_K), + checkVector(new Cartesian3D(2, Cartesian3D.PLUS_I, + 5, Cartesian3D.PLUS_J, + 5, Cartesian3D.MINUS_J, + -3, Cartesian3D.MINUS_K), 2, 0, 3); - checkVector(new Coordinates3D(new double[] { 2, 5, -3 }), + checkVector(new Cartesian3D(new double[] { 2, 5, -3 }), 2, 5, -3); } @Test public void testSpace() { - Space space = new Coordinates3D(1, 2, 2).getSpace(); + Space space = new Cartesian3D(1, 2, 2).getSpace(); Assert.assertEquals(3, space.getDimension()); Assert.assertEquals(2, space.getSubSpace().getDimension()); Space deserialized = (Space) TestUtils.serializeAndRecover(space); @@ -68,63 +68,63 @@ public class Vector3DTest { @Test public void testZero() { - Assert.assertEquals(0, new Coordinates3D(1, 2, 2).getZero().getNorm(), 1.0e-15); + Assert.assertEquals(0, new Cartesian3D(1, 2, 2).getZero().getNorm(), 1.0e-15); } @Test public void testEquals() { - Coordinates3D u1 = new Coordinates3D(1, 2, 3); - Coordinates3D u2 = new Coordinates3D(1, 2, 3); + Cartesian3D u1 = new Cartesian3D(1, 2, 3); + Cartesian3D u2 = new Cartesian3D(1, 2, 3); Assert.assertTrue(u1.equals(u1)); Assert.assertTrue(u1.equals(u2)); Assert.assertFalse(u1.equals(new Rotation(1, 0, 0, 0, false))); - Assert.assertFalse(u1.equals(new Coordinates3D(1, 2, 3 + 10 * Precision.EPSILON))); - Assert.assertFalse(u1.equals(new Coordinates3D(1, 2 + 10 * Precision.EPSILON, 3))); - Assert.assertFalse(u1.equals(new Coordinates3D(1 + 10 * Precision.EPSILON, 2, 3))); - Assert.assertTrue(new Coordinates3D(0, Double.NaN, 0).equals(new Coordinates3D(0, 0, Double.NaN))); + Assert.assertFalse(u1.equals(new Cartesian3D(1, 2, 3 + 10 * Precision.EPSILON))); + Assert.assertFalse(u1.equals(new Cartesian3D(1, 2 + 10 * Precision.EPSILON, 3))); + Assert.assertFalse(u1.equals(new Cartesian3D(1 + 10 * Precision.EPSILON, 2, 3))); + Assert.assertTrue(new Cartesian3D(0, Double.NaN, 0).equals(new Cartesian3D(0, 0, Double.NaN))); } @Test public void testHash() { - Assert.assertEquals(new Coordinates3D(0, Double.NaN, 0).hashCode(), new Coordinates3D(0, 0, Double.NaN).hashCode()); - Coordinates3D u = new Coordinates3D(1, 2, 3); - Coordinates3D v = new Coordinates3D(1, 2, 3 + 10 * Precision.EPSILON); + Assert.assertEquals(new Cartesian3D(0, Double.NaN, 0).hashCode(), new Cartesian3D(0, 0, Double.NaN).hashCode()); + Cartesian3D u = new Cartesian3D(1, 2, 3); + Cartesian3D v = new Cartesian3D(1, 2, 3 + 10 * Precision.EPSILON); Assert.assertTrue(u.hashCode() != v.hashCode()); } @Test public void testInfinite() { - Assert.assertTrue(new Coordinates3D(1, 1, Double.NEGATIVE_INFINITY).isInfinite()); - Assert.assertTrue(new Coordinates3D(1, Double.NEGATIVE_INFINITY, 1).isInfinite()); - Assert.assertTrue(new Coordinates3D(Double.NEGATIVE_INFINITY, 1, 1).isInfinite()); - Assert.assertFalse(new Coordinates3D(1, 1, 2).isInfinite()); - Assert.assertFalse(new Coordinates3D(1, Double.NaN, Double.NEGATIVE_INFINITY).isInfinite()); + Assert.assertTrue(new Cartesian3D(1, 1, Double.NEGATIVE_INFINITY).isInfinite()); + Assert.assertTrue(new Cartesian3D(1, Double.NEGATIVE_INFINITY, 1).isInfinite()); + Assert.assertTrue(new Cartesian3D(Double.NEGATIVE_INFINITY, 1, 1).isInfinite()); + Assert.assertFalse(new Cartesian3D(1, 1, 2).isInfinite()); + Assert.assertFalse(new Cartesian3D(1, Double.NaN, Double.NEGATIVE_INFINITY).isInfinite()); } @Test public void testNaN() { - Assert.assertTrue(new Coordinates3D(1, 1, Double.NaN).isNaN()); - Assert.assertTrue(new Coordinates3D(1, Double.NaN, 1).isNaN()); - Assert.assertTrue(new Coordinates3D(Double.NaN, 1, 1).isNaN()); - Assert.assertFalse(new Coordinates3D(1, 1, 2).isNaN()); - Assert.assertFalse(new Coordinates3D(1, 1, Double.NEGATIVE_INFINITY).isNaN()); + Assert.assertTrue(new Cartesian3D(1, 1, Double.NaN).isNaN()); + Assert.assertTrue(new Cartesian3D(1, Double.NaN, 1).isNaN()); + Assert.assertTrue(new Cartesian3D(Double.NaN, 1, 1).isNaN()); + Assert.assertFalse(new Cartesian3D(1, 1, 2).isNaN()); + Assert.assertFalse(new Cartesian3D(1, 1, Double.NEGATIVE_INFINITY).isNaN()); } @Test public void testToString() { - Assert.assertEquals("{3; 2; 1}", new Coordinates3D(3, 2, 1).toString()); + Assert.assertEquals("{3; 2; 1}", new Cartesian3D(3, 2, 1).toString()); NumberFormat format = new DecimalFormat("0.000", new DecimalFormatSymbols(Locale.US)); - Assert.assertEquals("{3.000; 2.000; 1.000}", new Coordinates3D(3, 2, 1).toString(format)); + Assert.assertEquals("{3.000; 2.000; 1.000}", new Cartesian3D(3, 2, 1).toString(format)); } @Test(expected=DimensionMismatchException.class) public void testWrongDimension() throws DimensionMismatchException { - new Coordinates3D(new double[] { 2, 5 }); + new Cartesian3D(new double[] { 2, 5 }); } @Test public void testCoordinates() { - Coordinates3D v = new Coordinates3D(1, 2, 3); + Cartesian3D v = new Cartesian3D(1, 2, 3); Assert.assertTrue(FastMath.abs(v.getX() - 1) < 1.0e-12); Assert.assertTrue(FastMath.abs(v.getY() - 2) < 1.0e-12); Assert.assertTrue(FastMath.abs(v.getZ() - 3) < 1.0e-12); @@ -136,69 +136,69 @@ public class Vector3DTest { @Test public void testNorm1() { - Assert.assertEquals(0.0, Coordinates3D.ZERO.getNorm1(), 0); - Assert.assertEquals(6.0, new Coordinates3D(1, -2, 3).getNorm1(), 0); + Assert.assertEquals(0.0, Cartesian3D.ZERO.getNorm1(), 0); + Assert.assertEquals(6.0, new Cartesian3D(1, -2, 3).getNorm1(), 0); } @Test public void testNorm() { - Assert.assertEquals(0.0, Coordinates3D.ZERO.getNorm(), 0); - Assert.assertEquals(FastMath.sqrt(14), new Coordinates3D(1, 2, 3).getNorm(), 1.0e-12); + Assert.assertEquals(0.0, Cartesian3D.ZERO.getNorm(), 0); + Assert.assertEquals(FastMath.sqrt(14), new Cartesian3D(1, 2, 3).getNorm(), 1.0e-12); } @Test public void testNormSq() { - Assert.assertEquals(0.0, new Coordinates3D(0, 0, 0).getNormSq(), 0); - Assert.assertEquals(14, new Coordinates3D(1, 2, 3).getNormSq(), 1.0e-12); + Assert.assertEquals(0.0, new Cartesian3D(0, 0, 0).getNormSq(), 0); + Assert.assertEquals(14, new Cartesian3D(1, 2, 3).getNormSq(), 1.0e-12); } @Test public void testNormInf() { - Assert.assertEquals(0.0, Coordinates3D.ZERO.getNormInf(), 0); - Assert.assertEquals(3.0, new Coordinates3D(1, -2, 3).getNormInf(), 0); + Assert.assertEquals(0.0, Cartesian3D.ZERO.getNormInf(), 0); + Assert.assertEquals(3.0, new Cartesian3D(1, -2, 3).getNormInf(), 0); } @Test public void testDistance1() { - Coordinates3D v1 = new Coordinates3D(1, -2, 3); - Coordinates3D v2 = new Coordinates3D(-4, 2, 0); - Assert.assertEquals(0.0, Coordinates3D.distance1(Coordinates3D.MINUS_I, Coordinates3D.MINUS_I), 0); - Assert.assertEquals(12.0, Coordinates3D.distance1(v1, v2), 1.0e-12); - Assert.assertEquals(v1.subtract(v2).getNorm1(), Coordinates3D.distance1(v1, v2), 1.0e-12); + Cartesian3D v1 = new Cartesian3D(1, -2, 3); + Cartesian3D v2 = new Cartesian3D(-4, 2, 0); + Assert.assertEquals(0.0, Cartesian3D.distance1(Cartesian3D.MINUS_I, Cartesian3D.MINUS_I), 0); + Assert.assertEquals(12.0, Cartesian3D.distance1(v1, v2), 1.0e-12); + Assert.assertEquals(v1.subtract(v2).getNorm1(), Cartesian3D.distance1(v1, v2), 1.0e-12); } @Test public void testDistance() { - Coordinates3D v1 = new Coordinates3D(1, -2, 3); - Coordinates3D v2 = new Coordinates3D(-4, 2, 0); - Assert.assertEquals(0.0, Coordinates3D.distance(Coordinates3D.MINUS_I, Coordinates3D.MINUS_I), 0); - Assert.assertEquals(FastMath.sqrt(50), Coordinates3D.distance(v1, v2), 1.0e-12); - Assert.assertEquals(v1.subtract(v2).getNorm(), Coordinates3D.distance(v1, v2), 1.0e-12); + Cartesian3D v1 = new Cartesian3D(1, -2, 3); + Cartesian3D v2 = new Cartesian3D(-4, 2, 0); + Assert.assertEquals(0.0, Cartesian3D.distance(Cartesian3D.MINUS_I, Cartesian3D.MINUS_I), 0); + Assert.assertEquals(FastMath.sqrt(50), Cartesian3D.distance(v1, v2), 1.0e-12); + Assert.assertEquals(v1.subtract(v2).getNorm(), Cartesian3D.distance(v1, v2), 1.0e-12); } @Test public void testDistanceSq() { - Coordinates3D v1 = new Coordinates3D(1, -2, 3); - Coordinates3D v2 = new Coordinates3D(-4, 2, 0); - Assert.assertEquals(0.0, Coordinates3D.distanceSq(Coordinates3D.MINUS_I, Coordinates3D.MINUS_I), 0); - Assert.assertEquals(50.0, Coordinates3D.distanceSq(v1, v2), 1.0e-12); - Assert.assertEquals(Coordinates3D.distance(v1, v2) * Coordinates3D.distance(v1, v2), - Coordinates3D.distanceSq(v1, v2), 1.0e-12); + Cartesian3D v1 = new Cartesian3D(1, -2, 3); + Cartesian3D v2 = new Cartesian3D(-4, 2, 0); + Assert.assertEquals(0.0, Cartesian3D.distanceSq(Cartesian3D.MINUS_I, Cartesian3D.MINUS_I), 0); + Assert.assertEquals(50.0, Cartesian3D.distanceSq(v1, v2), 1.0e-12); + Assert.assertEquals(Cartesian3D.distance(v1, v2) * Cartesian3D.distance(v1, v2), + Cartesian3D.distanceSq(v1, v2), 1.0e-12); } @Test public void testDistanceInf() { - Coordinates3D v1 = new Coordinates3D(1, -2, 3); - Coordinates3D v2 = new Coordinates3D(-4, 2, 0); - Assert.assertEquals(0.0, Coordinates3D.distanceInf(Coordinates3D.MINUS_I, Coordinates3D.MINUS_I), 0); - Assert.assertEquals(5.0, Coordinates3D.distanceInf(v1, v2), 1.0e-12); - Assert.assertEquals(v1.subtract(v2).getNormInf(), Coordinates3D.distanceInf(v1, v2), 1.0e-12); + Cartesian3D v1 = new Cartesian3D(1, -2, 3); + Cartesian3D v2 = new Cartesian3D(-4, 2, 0); + Assert.assertEquals(0.0, Cartesian3D.distanceInf(Cartesian3D.MINUS_I, Cartesian3D.MINUS_I), 0); + Assert.assertEquals(5.0, Cartesian3D.distanceInf(v1, v2), 1.0e-12); + Assert.assertEquals(v1.subtract(v2).getNormInf(), Cartesian3D.distanceInf(v1, v2), 1.0e-12); } @Test public void testSubtract() { - Coordinates3D v1 = new Coordinates3D(1, 2, 3); - Coordinates3D v2 = new Coordinates3D(-3, -2, -1); + Cartesian3D v1 = new Cartesian3D(1, 2, 3); + Cartesian3D v2 = new Cartesian3D(-3, -2, -1); v1 = v1.subtract(v2); checkVector(v1, 4, 4, 4); @@ -208,8 +208,8 @@ public class Vector3DTest { @Test public void testAdd() { - Coordinates3D v1 = new Coordinates3D(1, 2, 3); - Coordinates3D v2 = new Coordinates3D(-3, -2, -1); + Cartesian3D v1 = new Cartesian3D(1, 2, 3); + Cartesian3D v2 = new Cartesian3D(-3, -2, -1); v1 = v1.add(v2); checkVector(v1, -2, 0, 2); @@ -219,7 +219,7 @@ public class Vector3DTest { @Test public void testScalarProduct() { - Coordinates3D v = new Coordinates3D(1, 2, 3); + Cartesian3D v = new Cartesian3D(1, 2, 3); v = v.scalarMultiply(3); checkVector(v, 3, 6, 9); @@ -228,61 +228,61 @@ public class Vector3DTest { @Test public void testVectorialProducts() { - Coordinates3D v1 = new Coordinates3D(2, 1, -4); - Coordinates3D v2 = new Coordinates3D(3, 1, -1); + Cartesian3D v1 = new Cartesian3D(2, 1, -4); + Cartesian3D v2 = new Cartesian3D(3, 1, -1); - Assert.assertTrue(FastMath.abs(Coordinates3D.dotProduct(v1, v2) - 11) < 1.0e-12); + Assert.assertTrue(FastMath.abs(Cartesian3D.dotProduct(v1, v2) - 11) < 1.0e-12); - Coordinates3D v3 = Coordinates3D.crossProduct(v1, v2); + Cartesian3D v3 = Cartesian3D.crossProduct(v1, v2); checkVector(v3, 3, -10, -1); - Assert.assertTrue(FastMath.abs(Coordinates3D.dotProduct(v1, v3)) < 1.0e-12); - Assert.assertTrue(FastMath.abs(Coordinates3D.dotProduct(v2, v3)) < 1.0e-12); + Assert.assertTrue(FastMath.abs(Cartesian3D.dotProduct(v1, v3)) < 1.0e-12); + Assert.assertTrue(FastMath.abs(Cartesian3D.dotProduct(v2, v3)) < 1.0e-12); } @Test public void testCrossProductCancellation() { - Coordinates3D v1 = new Coordinates3D(9070467121.0, 4535233560.0, 1); - Coordinates3D v2 = new Coordinates3D(9070467123.0, 4535233561.0, 1); - checkVector(Coordinates3D.crossProduct(v1, v2), -1, 2, 1); + Cartesian3D v1 = new Cartesian3D(9070467121.0, 4535233560.0, 1); + Cartesian3D v2 = new Cartesian3D(9070467123.0, 4535233561.0, 1); + checkVector(Cartesian3D.crossProduct(v1, v2), -1, 2, 1); double scale = FastMath.scalb(1.0, 100); - Coordinates3D big1 = new Coordinates3D(scale, v1); - Coordinates3D small2 = new Coordinates3D(1 / scale, v2); - checkVector(Coordinates3D.crossProduct(big1, small2), -1, 2, 1); + Cartesian3D big1 = new Cartesian3D(scale, v1); + Cartesian3D small2 = new Cartesian3D(1 / scale, v2); + checkVector(Cartesian3D.crossProduct(big1, small2), -1, 2, 1); } @Test public void testAngular() { - Assert.assertEquals(0, Coordinates3D.PLUS_I.getAlpha(), 1.0e-10); - Assert.assertEquals(0, Coordinates3D.PLUS_I.getDelta(), 1.0e-10); - Assert.assertEquals(FastMath.PI / 2, Coordinates3D.PLUS_J.getAlpha(), 1.0e-10); - Assert.assertEquals(0, Coordinates3D.PLUS_J.getDelta(), 1.0e-10); - Assert.assertEquals(0, Coordinates3D.PLUS_K.getAlpha(), 1.0e-10); - Assert.assertEquals(FastMath.PI / 2, Coordinates3D.PLUS_K.getDelta(), 1.0e-10); - - Coordinates3D u = new Coordinates3D(-1, 1, -1); + Assert.assertEquals(0, Cartesian3D.PLUS_I.getAlpha(), 1.0e-10); + Assert.assertEquals(0, Cartesian3D.PLUS_I.getDelta(), 1.0e-10); + Assert.assertEquals(FastMath.PI / 2, Cartesian3D.PLUS_J.getAlpha(), 1.0e-10); + Assert.assertEquals(0, Cartesian3D.PLUS_J.getDelta(), 1.0e-10); + Assert.assertEquals(0, Cartesian3D.PLUS_K.getAlpha(), 1.0e-10); + Assert.assertEquals(FastMath.PI / 2, Cartesian3D.PLUS_K.getDelta(), 1.0e-10); + + Cartesian3D u = new Cartesian3D(-1, 1, -1); Assert.assertEquals(3 * FastMath.PI /4, u.getAlpha(), 1.0e-10); Assert.assertEquals(-1.0 / FastMath.sqrt(3), FastMath.sin(u.getDelta()), 1.0e-10); } @Test public void testAngularSeparation() throws MathArithmeticException { - Coordinates3D v1 = new Coordinates3D(2, -1, 4); + Cartesian3D v1 = new Cartesian3D(2, -1, 4); - Coordinates3D k = v1.normalize(); - Coordinates3D i = k.orthogonal(); - Coordinates3D v2 = k.scalarMultiply(FastMath.cos(1.2)).add(i.scalarMultiply(FastMath.sin(1.2))); + Cartesian3D k = v1.normalize(); + Cartesian3D i = k.orthogonal(); + Cartesian3D v2 = k.scalarMultiply(FastMath.cos(1.2)).add(i.scalarMultiply(FastMath.sin(1.2))); - Assert.assertTrue(FastMath.abs(Coordinates3D.angle(v1, v2) - 1.2) < 1.0e-12); + Assert.assertTrue(FastMath.abs(Cartesian3D.angle(v1, v2) - 1.2) < 1.0e-12); } @Test public void testNormalize() throws MathArithmeticException { - Assert.assertEquals(1.0, new Coordinates3D(5, -4, 2).normalize().getNorm(), 1.0e-12); + Assert.assertEquals(1.0, new Cartesian3D(5, -4, 2).normalize().getNorm(), 1.0e-12); try { - Coordinates3D.ZERO.normalize(); + Cartesian3D.ZERO.normalize(); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException ae) { // expected behavior @@ -291,21 +291,21 @@ public class Vector3DTest { @Test public void testNegate() { - checkVector(new Coordinates3D(0.1, 2.5, 1.3).negate(), -0.1, -2.5, -1.3); + checkVector(new Cartesian3D(0.1, 2.5, 1.3).negate(), -0.1, -2.5, -1.3); } @Test public void testOrthogonal() throws MathArithmeticException { - Coordinates3D v1 = new Coordinates3D(0.1, 2.5, 1.3); - Assert.assertEquals(0.0, Coordinates3D.dotProduct(v1, v1.orthogonal()), 1.0e-12); - Coordinates3D v2 = new Coordinates3D(2.3, -0.003, 7.6); - Assert.assertEquals(0.0, Coordinates3D.dotProduct(v2, v2.orthogonal()), 1.0e-12); - Coordinates3D v3 = new Coordinates3D(-1.7, 1.4, 0.2); - Assert.assertEquals(0.0, Coordinates3D.dotProduct(v3, v3.orthogonal()), 1.0e-12); - Coordinates3D v4 = new Coordinates3D(4.2, 0.1, -1.8); - Assert.assertEquals(0.0, Coordinates3D.dotProduct(v4, v4.orthogonal()), 1.0e-12); + Cartesian3D v1 = new Cartesian3D(0.1, 2.5, 1.3); + Assert.assertEquals(0.0, Cartesian3D.dotProduct(v1, v1.orthogonal()), 1.0e-12); + Cartesian3D v2 = new Cartesian3D(2.3, -0.003, 7.6); + Assert.assertEquals(0.0, Cartesian3D.dotProduct(v2, v2.orthogonal()), 1.0e-12); + Cartesian3D v3 = new Cartesian3D(-1.7, 1.4, 0.2); + Assert.assertEquals(0.0, Cartesian3D.dotProduct(v3, v3.orthogonal()), 1.0e-12); + Cartesian3D v4 = new Cartesian3D(4.2, 0.1, -1.8); + Assert.assertEquals(0.0, Cartesian3D.dotProduct(v4, v4.orthogonal()), 1.0e-12); try { - new Coordinates3D(0, 0, 0).orthogonal(); + new Cartesian3D(0, 0, 0).orthogonal(); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException ae) { // expected behavior @@ -314,16 +314,16 @@ public class Vector3DTest { @Test public void testAngle() throws MathArithmeticException { Assert.assertEquals(0.22572612855273393616, - Coordinates3D.angle(new Coordinates3D(1, 2, 3), new Coordinates3D(4, 5, 6)), + Cartesian3D.angle(new Cartesian3D(1, 2, 3), new Cartesian3D(4, 5, 6)), 1.0e-12); Assert.assertEquals(7.98595620686106654517199e-8, - Coordinates3D.angle(new Coordinates3D(1, 2, 3), new Coordinates3D(2, 4, 6.000001)), + Cartesian3D.angle(new Cartesian3D(1, 2, 3), new Cartesian3D(2, 4, 6.000001)), 1.0e-12); Assert.assertEquals(3.14159257373023116985197793156, - Coordinates3D.angle(new Coordinates3D(1, 2, 3), new Coordinates3D(-2, -4, -6.000001)), + Cartesian3D.angle(new Cartesian3D(1, 2, 3), new Cartesian3D(-2, -4, -6.000001)), 1.0e-12); try { - Coordinates3D.angle(Coordinates3D.ZERO, Coordinates3D.PLUS_I); + Cartesian3D.angle(Cartesian3D.ZERO, Cartesian3D.PLUS_I); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException ae) { // expected behavior @@ -335,10 +335,10 @@ public class Vector3DTest { // the following two vectors are nearly but not exactly orthogonal // naive dot product (i.e. computing u1.x * u2.x + u1.y * u2.y + u1.z * u2.z // leads to a result of 0.0, instead of the correct -1.855129... - Coordinates3D u1 = new Coordinates3D(-1321008684645961.0 / 268435456.0, + Cartesian3D u1 = new Cartesian3D(-1321008684645961.0 / 268435456.0, -5774608829631843.0 / 268435456.0, -7645843051051357.0 / 8589934592.0); - Coordinates3D u2 = new Coordinates3D(-5712344449280879.0 / 2097152.0, + Cartesian3D u2 = new Cartesian3D(-5712344449280879.0 / 2097152.0, -4550117129121957.0 / 2097152.0, 8846951984510141.0 / 131072.0); double sNaive = u1.getX() * u2.getX() + u1.getY() * u2.getY() + u1.getZ() * u2.getZ(); @@ -360,7 +360,7 @@ public class Vector3DTest { double vy = 10000 * random.nextDouble(); double vz = 10000 * random.nextDouble(); double sNaive = ux * vx + uy * vy + uz * vz; - double sAccurate = new Coordinates3D(ux, uy, uz).dotProduct(new Coordinates3D(vx, vy, vz)); + double sAccurate = new Cartesian3D(ux, uy, uz).dotProduct(new Cartesian3D(vx, vy, vz)); Assert.assertEquals(sNaive, sAccurate, 2.5e-16 * sAccurate); } } @@ -372,19 +372,19 @@ public class Vector3DTest { // computing u1.x * u2.x + u1.y * u2.y + u1.z * u2.z // leads to a result of [0.0009765, -0.0001220, -0.0039062], // instead of the correct [0.0006913, -0.0001254, -0.0007909] - final Coordinates3D u1 = new Coordinates3D(-1321008684645961.0 / 268435456.0, + final Cartesian3D u1 = new Cartesian3D(-1321008684645961.0 / 268435456.0, -5774608829631843.0 / 268435456.0, -7645843051051357.0 / 8589934592.0); - final Coordinates3D u2 = new Coordinates3D( 1796571811118507.0 / 2147483648.0, + final Cartesian3D u2 = new Cartesian3D( 1796571811118507.0 / 2147483648.0, 7853468008299307.0 / 2147483648.0, 2599586637357461.0 / 17179869184.0); - final Coordinates3D u3 = new Coordinates3D(12753243807587107.0 / 18446744073709551616.0, + final Cartesian3D u3 = new Cartesian3D(12753243807587107.0 / 18446744073709551616.0, -2313766922703915.0 / 18446744073709551616.0, -227970081415313.0 / 288230376151711744.0); - Coordinates3D cNaive = new Coordinates3D(u1.getY() * u2.getZ() - u1.getZ() * u2.getY(), + Cartesian3D cNaive = new Cartesian3D(u1.getY() * u2.getZ() - u1.getZ() * u2.getY(), u1.getZ() * u2.getX() - u1.getX() * u2.getZ(), u1.getX() * u2.getY() - u1.getY() * u2.getX()); - Coordinates3D cAccurate = u1.crossProduct(u2); + Cartesian3D cAccurate = u1.crossProduct(u2); Assert.assertTrue(u3.distance(cNaive) > 2.9 * u3.getNorm()); Assert.assertEquals(0.0, u3.distance(cAccurate), 1.0e-30 * cAccurate.getNorm()); } @@ -401,13 +401,13 @@ public class Vector3DTest { double vx = 10000 * random.nextDouble(); double vy = 10000 * random.nextDouble(); double vz = 10000 * random.nextDouble(); - Coordinates3D cNaive = new Coordinates3D(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx); - Coordinates3D cAccurate = new Coordinates3D(ux, uy, uz).crossProduct(new Coordinates3D(vx, vy, vz)); + Cartesian3D cNaive = new Cartesian3D(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx); + Cartesian3D cAccurate = new Cartesian3D(ux, uy, uz).crossProduct(new Cartesian3D(vx, vy, vz)); Assert.assertEquals(0.0, cAccurate.distance(cNaive), 6.0e-15 * cAccurate.getNorm()); } } - private void checkVector(Coordinates3D v, double x, double y, double z) { + private void checkVector(Cartesian3D v, double x, double y, double z) { Assert.assertEquals(x, v.getX(), 1.0e-12); Assert.assertEquals(y, v.getY(), 1.0e-12); Assert.assertEquals(z, v.getZ(), 1.0e-12);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java index 841a87c..727bdfa 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.commons.math4.geometry.enclosing.EnclosingBall; import org.apache.commons.math4.geometry.euclidean.twod.DiskGenerator; import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D; -import org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D; +import org.apache.commons.math4.geometry.euclidean.twod.Cartesian2D; import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator; import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.rng.simple.RandomSource; @@ -35,8 +35,8 @@ public class DiskGeneratorTest { @Test public void testSupport0Point() { - List<Coordinates2D> support = Arrays.asList(new Coordinates2D[0]); - EnclosingBall<Euclidean2D, Coordinates2D> disk = new DiskGenerator().ballOnSupport(support); + List<Cartesian2D> support = Arrays.asList(new Cartesian2D[0]); + EnclosingBall<Euclidean2D, Cartesian2D> disk = new DiskGenerator().ballOnSupport(support); Assert.assertTrue(disk.getRadius() < 0); Assert.assertEquals(0, disk.getSupportSize()); Assert.assertEquals(0, disk.getSupport().length); @@ -44,15 +44,15 @@ public class DiskGeneratorTest { @Test public void testSupport1Point() { - List<Coordinates2D> support = Arrays.asList(new Coordinates2D(1, 2)); - EnclosingBall<Euclidean2D, Coordinates2D> disk = new DiskGenerator().ballOnSupport(support); + List<Cartesian2D> support = Arrays.asList(new Cartesian2D(1, 2)); + EnclosingBall<Euclidean2D, Cartesian2D> disk = new DiskGenerator().ballOnSupport(support); Assert.assertEquals(0.0, disk.getRadius(), 1.0e-10); Assert.assertTrue(disk.contains(support.get(0))); Assert.assertTrue(disk.contains(support.get(0), 0.5)); - Assert.assertFalse(disk.contains(new Coordinates2D(support.get(0).getX() + 0.1, + Assert.assertFalse(disk.contains(new Cartesian2D(support.get(0).getX() + 0.1, support.get(0).getY() - 0.1), 0.001)); - Assert.assertTrue(disk.contains(new Coordinates2D(support.get(0).getX() + 0.1, + Assert.assertTrue(disk.contains(new Cartesian2D(support.get(0).getX() + 0.1, support.get(0).getY() - 0.1), 0.5)); Assert.assertEquals(0, support.get(0).distance(disk.getCenter()), 1.0e-10); @@ -62,41 +62,41 @@ public class DiskGeneratorTest { @Test public void testSupport2Points() { - List<Coordinates2D> support = Arrays.asList(new Coordinates2D(1, 0), - new Coordinates2D(3, 0)); - EnclosingBall<Euclidean2D, Coordinates2D> disk = new DiskGenerator().ballOnSupport(support); + List<Cartesian2D> support = Arrays.asList(new Cartesian2D(1, 0), + new Cartesian2D(3, 0)); + EnclosingBall<Euclidean2D, Cartesian2D> disk = new DiskGenerator().ballOnSupport(support); Assert.assertEquals(1.0, disk.getRadius(), 1.0e-10); int i = 0; - for (Coordinates2D v : support) { + for (Cartesian2D v : support) { Assert.assertTrue(disk.contains(v)); Assert.assertEquals(1.0, v.distance(disk.getCenter()), 1.0e-10); Assert.assertTrue(v == disk.getSupport()[i++]); } - Assert.assertTrue(disk.contains(new Coordinates2D(2, 0.9))); - Assert.assertFalse(disk.contains(Coordinates2D.ZERO)); - Assert.assertEquals(0.0, new Coordinates2D(2, 0).distance(disk.getCenter()), 1.0e-10); + Assert.assertTrue(disk.contains(new Cartesian2D(2, 0.9))); + Assert.assertFalse(disk.contains(Cartesian2D.ZERO)); + Assert.assertEquals(0.0, new Cartesian2D(2, 0).distance(disk.getCenter()), 1.0e-10); Assert.assertEquals(2, disk.getSupportSize()); } @Test public void testSupport3Points() { - List<Coordinates2D> support = Arrays.asList(new Coordinates2D(1, 0), - new Coordinates2D(3, 0), - new Coordinates2D(2, 2)); - EnclosingBall<Euclidean2D, Coordinates2D> disk = new DiskGenerator().ballOnSupport(support); + List<Cartesian2D> support = Arrays.asList(new Cartesian2D(1, 0), + new Cartesian2D(3, 0), + new Cartesian2D(2, 2)); + EnclosingBall<Euclidean2D, Cartesian2D> disk = new DiskGenerator().ballOnSupport(support); Assert.assertEquals(5.0 / 4.0, disk.getRadius(), 1.0e-10); int i = 0; - for (Coordinates2D v : support) { + for (Cartesian2D v : support) { Assert.assertTrue(disk.contains(v)); Assert.assertEquals(5.0 / 4.0, v.distance(disk.getCenter()), 1.0e-10); Assert.assertTrue(v == disk.getSupport()[i++]); } - Assert.assertTrue(disk.contains(new Coordinates2D(2, 0.9))); - Assert.assertFalse(disk.contains(new Coordinates2D(0.9, 0))); - Assert.assertFalse(disk.contains(new Coordinates2D(3.1, 0))); - Assert.assertTrue(disk.contains(new Coordinates2D(2.0, -0.499))); - Assert.assertFalse(disk.contains(new Coordinates2D(2.0, -0.501))); - Assert.assertEquals(0.0, new Coordinates2D(2.0, 3.0 / 4.0).distance(disk.getCenter()), 1.0e-10); + Assert.assertTrue(disk.contains(new Cartesian2D(2, 0.9))); + Assert.assertFalse(disk.contains(new Cartesian2D(0.9, 0))); + Assert.assertFalse(disk.contains(new Cartesian2D(3.1, 0))); + Assert.assertTrue(disk.contains(new Cartesian2D(2.0, -0.499))); + Assert.assertFalse(disk.contains(new Cartesian2D(2.0, -0.501))); + Assert.assertEquals(0.0, new Cartesian2D(2.0, 3.0 / 4.0).distance(disk.getCenter()), 1.0e-10); Assert.assertEquals(3, disk.getSupportSize()); } @@ -108,12 +108,12 @@ public class DiskGeneratorTest { for (int i = 0; i < 500; ++i) { double d = 25 * random.nextDouble(); double refRadius = 10 * random.nextDouble(); - Coordinates2D refCenter = new Coordinates2D(d, new Coordinates2D(sr.nextVector())); - List<Coordinates2D> support = new ArrayList<>(); + Cartesian2D refCenter = new Cartesian2D(d, new Cartesian2D(sr.nextVector())); + List<Cartesian2D> support = new ArrayList<>(); for (int j = 0; j < 3; ++j) { - support.add(new Coordinates2D(1.0, refCenter, refRadius, new Coordinates2D(sr.nextVector()))); + support.add(new Cartesian2D(1.0, refCenter, refRadius, new Cartesian2D(sr.nextVector()))); } - EnclosingBall<Euclidean2D, Coordinates2D> disk = new DiskGenerator().ballOnSupport(support); + EnclosingBall<Euclidean2D, Cartesian2D> disk = new DiskGenerator().ballOnSupport(support); Assert.assertEquals(0.0, refCenter.distance(disk.getCenter()), 3e-9 * refRadius); Assert.assertEquals(refRadius, disk.getRadius(), 7e-10 * refRadius); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java index 79e9fa4..9f1beef 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java @@ -19,10 +19,7 @@ package org.apache.commons.math4.geometry.euclidean.twod; import org.apache.commons.math4.exception.MathIllegalArgumentException; import org.apache.commons.math4.geometry.Point; import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D; -import org.apache.commons.math4.geometry.euclidean.oned.Coordinates1D; -import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D; -import org.apache.commons.math4.geometry.euclidean.twod.Line; -import org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D; +import org.apache.commons.math4.geometry.euclidean.oned.Cartesian1D; import org.apache.commons.math4.geometry.partitioning.Transform; import org.apache.commons.math4.util.FastMath; import org.junit.Assert; @@ -32,54 +29,54 @@ public class LineTest { @Test public void testContains() { - Line l = new Line(new Coordinates2D(0, 1), new Coordinates2D(1, 2), 1.0e-10); - Assert.assertTrue(l.contains(new Coordinates2D(0, 1))); - Assert.assertTrue(l.contains(new Coordinates2D(1, 2))); - Assert.assertTrue(l.contains(new Coordinates2D(7, 8))); - Assert.assertTrue(! l.contains(new Coordinates2D(8, 7))); + Line l = new Line(new Cartesian2D(0, 1), new Cartesian2D(1, 2), 1.0e-10); + Assert.assertTrue(l.contains(new Cartesian2D(0, 1))); + Assert.assertTrue(l.contains(new Cartesian2D(1, 2))); + Assert.assertTrue(l.contains(new Cartesian2D(7, 8))); + Assert.assertTrue(! l.contains(new Cartesian2D(8, 7))); } @Test public void testAbscissa() { - Line l = new Line(new Coordinates2D(2, 1), new Coordinates2D(-2, -2), 1.0e-10); + Line l = new Line(new Cartesian2D(2, 1), new Cartesian2D(-2, -2), 1.0e-10); Assert.assertEquals(0.0, - (l.toSubSpace(new Coordinates2D(-3, 4))).getX(), + (l.toSubSpace(new Cartesian2D(-3, 4))).getX(), 1.0e-10); Assert.assertEquals(0.0, - (l.toSubSpace(new Coordinates2D( 3, -4))).getX(), + (l.toSubSpace(new Cartesian2D( 3, -4))).getX(), 1.0e-10); Assert.assertEquals(-5.0, - (l.toSubSpace(new Coordinates2D( 7, -1))).getX(), + (l.toSubSpace(new Cartesian2D( 7, -1))).getX(), 1.0e-10); Assert.assertEquals(5.0, - (l.toSubSpace(new Coordinates2D(-1, -7))).getX(), + (l.toSubSpace(new Cartesian2D(-1, -7))).getX(), 1.0e-10); } @Test public void testOffset() { - Line l = new Line(new Coordinates2D(2, 1), new Coordinates2D(-2, -2), 1.0e-10); - Assert.assertEquals(-5.0, l.getOffset(new Coordinates2D(5, -3)), 1.0e-10); - Assert.assertEquals(+5.0, l.getOffset(new Coordinates2D(-5, 2)), 1.0e-10); + Line l = new Line(new Cartesian2D(2, 1), new Cartesian2D(-2, -2), 1.0e-10); + Assert.assertEquals(-5.0, l.getOffset(new Cartesian2D(5, -3)), 1.0e-10); + Assert.assertEquals(+5.0, l.getOffset(new Cartesian2D(-5, 2)), 1.0e-10); } @Test public void testDistance() { - Line l = new Line(new Coordinates2D(2, 1), new Coordinates2D(-2, -2), 1.0e-10); - Assert.assertEquals(+5.0, l.distance(new Coordinates2D(5, -3)), 1.0e-10); - Assert.assertEquals(+5.0, l.distance(new Coordinates2D(-5, 2)), 1.0e-10); + Line l = new Line(new Cartesian2D(2, 1), new Cartesian2D(-2, -2), 1.0e-10); + Assert.assertEquals(+5.0, l.distance(new Cartesian2D(5, -3)), 1.0e-10); + Assert.assertEquals(+5.0, l.distance(new Cartesian2D(-5, 2)), 1.0e-10); } @Test public void testPointAt() { - Line l = new Line(new Coordinates2D(2, 1), new Coordinates2D(-2, -2), 1.0e-10); + Line l = new Line(new Cartesian2D(2, 1), new Cartesian2D(-2, -2), 1.0e-10); for (double a = -2.0; a < 2.0; a += 0.2) { - Point<Euclidean1D> pA = new Coordinates1D(a); + Point<Euclidean1D> pA = new Cartesian1D(a); Point<Euclidean2D> point = l.toSpace(pA); Assert.assertEquals(a, (l.toSubSpace(point)).getX(), 1.0e-10); Assert.assertEquals(0.0, l.getOffset(point), 1.0e-10); for (double o = -2.0; o < 2.0; o += 0.2) { - point = l.getPointAt((Coordinates1D) pA, o); + point = l.getPointAt((Cartesian1D) pA, o); Assert.assertEquals(a, (l.toSubSpace(point)).getX(), 1.0e-10); Assert.assertEquals(o, l.getOffset(point), 1.0e-10); } @@ -88,34 +85,34 @@ public class LineTest { @Test public void testOriginOffset() { - Line l1 = new Line(new Coordinates2D(0, 1), new Coordinates2D(1, 2), 1.0e-10); + Line l1 = new Line(new Cartesian2D(0, 1), new Cartesian2D(1, 2), 1.0e-10); Assert.assertEquals(FastMath.sqrt(0.5), l1.getOriginOffset(), 1.0e-10); - Line l2 = new Line(new Coordinates2D(1, 2), new Coordinates2D(0, 1), 1.0e-10); + Line l2 = new Line(new Cartesian2D(1, 2), new Cartesian2D(0, 1), 1.0e-10); Assert.assertEquals(-FastMath.sqrt(0.5), l2.getOriginOffset(), 1.0e-10); } @Test public void testParallel() { - Line l1 = new Line(new Coordinates2D(0, 1), new Coordinates2D(1, 2), 1.0e-10); - Line l2 = new Line(new Coordinates2D(2, 2), new Coordinates2D(3, 3), 1.0e-10); + Line l1 = new Line(new Cartesian2D(0, 1), new Cartesian2D(1, 2), 1.0e-10); + Line l2 = new Line(new Cartesian2D(2, 2), new Cartesian2D(3, 3), 1.0e-10); Assert.assertTrue(l1.isParallelTo(l2)); - Line l3 = new Line(new Coordinates2D(1, 0), new Coordinates2D(0.5, -0.5), 1.0e-10); + Line l3 = new Line(new Cartesian2D(1, 0), new Cartesian2D(0.5, -0.5), 1.0e-10); Assert.assertTrue(l1.isParallelTo(l3)); - Line l4 = new Line(new Coordinates2D(1, 0), new Coordinates2D(0.5, -0.51), 1.0e-10); + Line l4 = new Line(new Cartesian2D(1, 0), new Cartesian2D(0.5, -0.51), 1.0e-10); Assert.assertTrue(! l1.isParallelTo(l4)); } @Test public void testTransform() throws MathIllegalArgumentException { - Line l1 = new Line(new Coordinates2D(1.0 ,1.0), new Coordinates2D(4.0 ,1.0), 1.0e-10); + Line l1 = new Line(new Cartesian2D(1.0 ,1.0), new Cartesian2D(4.0 ,1.0), 1.0e-10); Transform<Euclidean2D, Euclidean1D> t1 = Line.getTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5); Assert.assertEquals(0.5 * FastMath.PI, ((Line) t1.apply(l1)).getAngle(), 1.0e-10); - Line l2 = new Line(new Coordinates2D(0.0, 0.0), new Coordinates2D(1.0, 1.0), 1.0e-10); + Line l2 = new Line(new Cartesian2D(0.0, 0.0), new Cartesian2D(1.0, 1.0), 1.0e-10); Transform<Euclidean2D, Euclidean1D> t2 = Line.getTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5); Assert.assertEquals(FastMath.atan2(1.0, -2.0), @@ -126,9 +123,9 @@ public class LineTest { @Test public void testIntersection() { - Line l1 = new Line(new Coordinates2D( 0, 1), new Coordinates2D(1, 2), 1.0e-10); - Line l2 = new Line(new Coordinates2D(-1, 2), new Coordinates2D(2, 1), 1.0e-10); - Coordinates2D p = l1.intersection(l2); + Line l1 = new Line(new Cartesian2D( 0, 1), new Cartesian2D(1, 2), 1.0e-10); + Line l2 = new Line(new Cartesian2D(-1, 2), new Cartesian2D(2, 1), 1.0e-10); + Cartesian2D p = l1.intersection(l2); Assert.assertEquals(0.5, p.getX(), 1.0e-10); Assert.assertEquals(1.5, p.getY(), 1.0e-10); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoopsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoopsTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoopsTest.java index 822cea7..912c4a5 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoopsTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoopsTest.java @@ -32,13 +32,13 @@ public class NestedLoopsTest { @Test public void testNestedLoops() throws Exception { - Coordinates2D oneOne = new Coordinates2D(1.0, 1.0); - Coordinates2D oneNegativeOne = new Coordinates2D(1.0, -1.0); - Coordinates2D negativeOneNegativeOne = new Coordinates2D(-1.0, -1.0); - Coordinates2D negativeOneOne = new Coordinates2D(-1.0, 1.0); - Coordinates2D origin = new Coordinates2D(0, 0); + Cartesian2D oneOne = new Cartesian2D(1.0, 1.0); + Cartesian2D oneNegativeOne = new Cartesian2D(1.0, -1.0); + Cartesian2D negativeOneNegativeOne = new Cartesian2D(-1.0, -1.0); + Cartesian2D negativeOneOne = new Cartesian2D(-1.0, 1.0); + Cartesian2D origin = new Cartesian2D(0, 0); - Coordinates2D [] vertices = new Coordinates2D[]{ + Cartesian2D [] vertices = new Cartesian2D[]{ oneOne, oneNegativeOne, negativeOneNegativeOne, @@ -55,8 +55,8 @@ public class NestedLoopsTest { surroundedField.setAccessible(Boolean.TRUE); loopField.setAccessible(Boolean.TRUE); List<NestedLoops> surrounded = (List<NestedLoops>) surroundedField.get(nestedLoops); - Coordinates2D[] loop = (Coordinates2D []) loopField.get(surrounded.get(0)); - Set<Coordinates2D> vertexSet = new HashSet<>(Arrays.asList(loop)); + Cartesian2D[] loop = (Cartesian2D []) loopField.get(surrounded.get(0)); + Set<Cartesian2D> vertexSet = new HashSet<>(Arrays.asList(loop)); Assert.assertTrue(vertexSet.contains(oneOne)); Assert.assertTrue(vertexSet.contains(oneNegativeOne)); Assert.assertTrue(vertexSet.contains(negativeOneNegativeOne));