Use constants defined in "Commons Numbers".
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java
deleted file mode 100644
index 37c40aa..0000000
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.geometry.core;
-
-/** Class containing geometric constants.
- */
-public final class Geometry {
-
- /** Alias for {@link Math#PI}, placed here for completeness. */
- public static final double PI = Math.PI;
-
- /** Constant value for {@code -pi}. */
- public static final double MINUS_PI = -Math.PI;
-
- /** Constant value for {@code 2*pi}. */
- public static final double TWO_PI = 2.0 * Math.PI;
-
- /** Constant value for {@code -2*pi}. */
- public static final double MINUS_TWO_PI = -2.0 * Math.PI;
-
- /** Constant value for {@code pi/2}. */
- public static final double HALF_PI = 0.5 * Math.PI;
-
- /** Constant value for {@code - pi/2}. */
- public static final double MINUS_HALF_PI = -0.5 * Math.PI;
-
- /** Constant value for {@code 3*pi/2}. */
- public static final double THREE_HALVES_PI = 1.5 * Math.PI;
-
- /** Constant value for {@code 0*pi}, which is, of course, 0.
- * This value is placed here for completeness.
- */
- public static final double ZERO_PI = 0.0;
-
- /** Private constructor. */
- private Geometry() {}
-}
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java
deleted file mode 100644
index 7fedb49..0000000
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.geometry.core;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class GeometryTest {
-
- @Test
- public void testConstants() {
- // arrange
- double eps = 0.0;
-
- // act/assert
- Assert.assertEquals(0.0, 0.0, eps);
-
- Assert.assertEquals(Math.PI, Geometry.PI, eps);
- Assert.assertEquals(-Math.PI, Geometry.MINUS_PI, eps);
-
- Assert.assertEquals(2.0 * Math.PI, Geometry.TWO_PI, eps);
- Assert.assertEquals(-2.0 * Math.PI, Geometry.MINUS_TWO_PI, eps);
-
- Assert.assertEquals(Math.PI / 2.0, Geometry.HALF_PI, 0.0);
- Assert.assertEquals(-Math.PI / 2.0, Geometry.MINUS_HALF_PI, eps);
-
- Assert.assertEquals((3.0 * Math.PI) / 2.0, Geometry.THREE_HALVES_PI, eps);
- }
-
- @Test
- public void testConstants_trigEval() {
- // arrange
- double eps = 1e-15;
-
- // act/assert
- Assert.assertEquals(0.0, Math.sin(0.0), eps);
- Assert.assertEquals(1.0, Math.cos(0.0), eps);
-
- Assert.assertEquals(0.0, Math.sin(Geometry.PI), eps);
- Assert.assertEquals(-1.0, Math.cos(Geometry.PI), eps);
-
- Assert.assertEquals(0.0, Math.sin(Geometry.MINUS_PI), eps);
- Assert.assertEquals(-1.0, Math.cos(Geometry.MINUS_PI), eps);
-
- Assert.assertEquals(0.0, Math.sin(Geometry.TWO_PI), eps);
- Assert.assertEquals(1.0, Math.cos(Geometry.TWO_PI), eps);
-
- Assert.assertEquals(0.0, Math.sin(Geometry.MINUS_TWO_PI), eps);
- Assert.assertEquals(1.0, Math.cos(Geometry.MINUS_TWO_PI), eps);
-
- Assert.assertEquals(1.0, Math.sin(Geometry.HALF_PI), eps);
- Assert.assertEquals(0.0, Math.cos(Geometry.HALF_PI), eps);
-
- Assert.assertEquals(-1.0, Math.sin(Geometry.MINUS_HALF_PI), eps);
- Assert.assertEquals(0.0, Math.cos(Geometry.MINUS_HALF_PI), eps);
- }
-}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
index 9316b1d..e4e921a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
@@ -19,7 +19,7 @@
import java.util.Comparator;
import java.util.function.UnaryOperator;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
import org.apache.commons.geometry.euclidean.EuclideanVector;
@@ -224,7 +224,7 @@
final double sig2 = Math.signum(v.x);
// the angle is 0 if the x value signs are the same and pi if not
- return (sig1 == sig2) ? 0.0 : Geometry.PI;
+ return (sig1 == sig2) ? 0.0 : PlaneAngleRadians.PI;
}
/** Convenience method to apply a function to this vector. This
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java
index ca4eb46..9772f26 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.threed;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Spatial;
import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.internal.Vectors;
@@ -82,8 +82,8 @@
if (radius < 0) {
// negative radius; flip the angles
radius = Math.abs(radius);
- azimuth += Geometry.PI;
- polar += Geometry.PI;
+ azimuth += PlaneAngleRadians.PI;
+ polar += PlaneAngleRadians.PI;
}
this.radius = radius;
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java
index 99dc077..1b203b7 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java
@@ -18,7 +18,7 @@
import java.util.Objects;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.exception.GeometryValueException;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.core.internal.GeometryInternalError;
@@ -402,8 +402,8 @@
final double angle1TanX = vec2.dot(axis2);
final double angle2 = angle2Sin > AXIS_ANGLE_SINGULARITY_THRESHOLD ?
- Geometry.HALF_PI :
- Geometry.MINUS_HALF_PI;
+ PlaneAngleRadians.PI_OVER_TWO :
+ PlaneAngleRadians.MINUS_PI_OVER_TWO;
return new double[] {
Math.atan2(angle1TanY, angle1TanX),
@@ -469,7 +469,7 @@
final double angle1TanY = vec2.dot(crossAxis);
final double angle1TanX = vec2.dot(axis2);
- final double angle2 = angle2Cos > AXIS_ANGLE_SINGULARITY_THRESHOLD ? 0.0 : Geometry.PI;
+ final double angle2 = angle2Cos > AXIS_ANGLE_SINGULARITY_THRESHOLD ? 0.0 : PlaneAngleRadians.PI;
return new double[] {
Math.atan2(angle1TanY, angle1TanX),
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnector.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnector.java
index b0ed43a..67f6e2d 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnector.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnector.java
@@ -19,7 +19,7 @@
import java.util.Collection;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
/** Line segment connector that selects between multiple connection options
* based on the resulting interior angle. An interior angle in this
@@ -45,7 +45,7 @@
ConnectableSegment selected = null;
for (ConnectableSegment candidate : outgoing) {
- double interiorAngle = Geometry.PI - segmentLine.angle(candidate.getSegment().getLine());
+ double interiorAngle = PlaneAngleRadians.PI - segmentLine.angle(candidate.getSegment().getLine());
if (selected == null || isBetterAngle(interiorAngle, selectedInteriorAngle)) {
selectedInteriorAngle = interiorAngle;
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java
index 45cf239..e2898d6 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.twod;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Spatial;
import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.numbers.angle.PlaneAngleRadians;
@@ -62,7 +62,7 @@
if (radius < 0) {
// negative radius; flip the angles
radius = Math.abs(radius);
- azimuth += Geometry.PI;
+ azimuth += PlaneAngleRadians.PI;
}
this.radius = radius;
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java
index 7b27f91..9e6d634 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.oned;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
@@ -184,7 +184,7 @@
@Test
public void testApply_translate() {
// arrange
- Vector1D translation = Vector1D.of(-Geometry.PI);
+ Vector1D translation = Vector1D.of(-PlaneAngleRadians.PI);
AffineTransformMatrix1D transform = AffineTransformMatrix1D.identity()
.translate(translation);
@@ -279,7 +279,7 @@
@Test
public void testApplyVector_translate() {
// arrange
- Vector1D translation = Vector1D.of(-Geometry.PI);
+ Vector1D translation = Vector1D.of(-PlaneAngleRadians.PI);
AffineTransformMatrix1D transform = AffineTransformMatrix1D.identity()
.translate(translation);
@@ -313,7 +313,7 @@
@Test
public void testApplyVector_representsDisplacement() {
// arrange
- Vector1D p1 = Vector1D.of(Geometry.PI);
+ Vector1D p1 = Vector1D.of(PlaneAngleRadians.PI);
Vector1D translation = Vector1D.of(-2.0);
Vector1D scale = Vector1D.of(5.0);
@@ -349,7 +349,7 @@
@Test
public void testApplyDirection_translate() {
// arrange
- Vector1D translation = Vector1D.of(-Geometry.PI);
+ Vector1D translation = Vector1D.of(-PlaneAngleRadians.PI);
AffineTransformMatrix1D transform = AffineTransformMatrix1D.identity()
.translate(translation);
@@ -383,7 +383,7 @@
@Test
public void testApplyDirection_representsNormalizedDisplacement() {
// arrange
- Vector1D p1 = Vector1D.of(Geometry.PI);
+ Vector1D p1 = Vector1D.of(PlaneAngleRadians.PI);
Vector1D translation = Vector1D.of(-2.0);
Vector1D scale = Vector1D.of(5.0);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java
index 917b667..b3ee5cc 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java
@@ -19,7 +19,7 @@
import java.util.Comparator;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -385,23 +385,23 @@
// act/assert
Assert.assertEquals(0.0, v1.angle(v1), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v1.angle(v2), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v1.angle(v2), TEST_TOLERANCE);
Assert.assertEquals(0.0, v1.angle(v3), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v1.angle(v4), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v1.angle(v4), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v2.angle(v1), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v2.angle(v1), TEST_TOLERANCE);
Assert.assertEquals(0.0, v2.angle(v2), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v2.angle(v3), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v2.angle(v3), TEST_TOLERANCE);
Assert.assertEquals(0.0, v2.angle(v4), TEST_TOLERANCE);
Assert.assertEquals(0.0, v3.angle(v1), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v3.angle(v2), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v3.angle(v2), TEST_TOLERANCE);
Assert.assertEquals(0.0, v3.angle(v3), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v3.angle(v4), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v3.angle(v4), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v4.angle(v1), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v4.angle(v1), TEST_TOLERANCE);
Assert.assertEquals(0.0, v4.angle(v2), TEST_TOLERANCE);
- Assert.assertEquals(Geometry.PI, v4.angle(v3), TEST_TOLERANCE);
+ Assert.assertEquals(PlaneAngleRadians.PI, v4.angle(v3), TEST_TOLERANCE);
Assert.assertEquals(0.0, v4.angle(v4), TEST_TOLERANCE);
}
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3DTest.java
index 10bf43a..58a8cea 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3DTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.threed;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
@@ -286,7 +286,7 @@
public void testCreateRotation() {
// arrange
Vector3D center = Vector3D.of(1, 2, 3);
- QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI);
+ QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO);
// act
AffineTransformMatrix3D result = AffineTransformMatrix3D.createRotation(center, rotation);
@@ -309,7 +309,7 @@
9, 10, 11, 12
);
- QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI);
+ QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO);
// act
AffineTransformMatrix3D result = a.rotate(rotation);
@@ -333,7 +333,7 @@
);
Vector3D center = Vector3D.of(1, 2, 3);
- QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI);
+ QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO);
// act
AffineTransformMatrix3D result = a.rotate(center, rotation);
@@ -363,7 +363,7 @@
@Test
public void testApply_translate() {
// arrange
- Vector3D translation = Vector3D.of(1.1, -Geometry.PI, 5.5);
+ Vector3D translation = Vector3D.of(1.1, -PlaneAngleRadians.PI, 5.5);
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.translate(translation);
@@ -449,7 +449,7 @@
@Test
public void testApply_rotate() {
// arrange
- QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.of(1, 1, 1), 2.0 * Geometry.PI / 3.0);
+ QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.of(1, 1, 1), 2.0 * PlaneAngleRadians.PI / 3.0);
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity().rotate(rotation);
@@ -468,7 +468,7 @@
// arrange
double scaleFactor = 2;
Vector3D center = Vector3D.of(3, -4, 5);
- QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI);
+ QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO);
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.scale(scaleFactor)
@@ -502,7 +502,7 @@
@Test
public void testApplyVector_translate() {
// arrange
- Vector3D translation = Vector3D.of(1.1, -Geometry.PI, 5.5);
+ Vector3D translation = Vector3D.of(1.1, -PlaneAngleRadians.PI, 5.5);
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.translate(translation);
@@ -541,7 +541,7 @@
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.scale(1.5)
.translate(4, 6, 5)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO));
// act/assert
runWithCoordinates((x, y, z) -> {
@@ -570,7 +570,7 @@
@Test
public void testApplyDirection_translate() {
// arrange
- Vector3D translation = Vector3D.of(1.1, -Geometry.PI, 5.5);
+ Vector3D translation = Vector3D.of(1.1, -PlaneAngleRadians.PI, 5.5);
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.translate(translation);
@@ -609,7 +609,7 @@
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.scale(1.5)
.translate(4, 6, 5)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO));
// act/assert
runWithCoordinates((x, y, z) -> {
@@ -898,7 +898,7 @@
public void testInverse_rotate() {
// arrange
Vector3D center = Vector3D.of(1, 2, 3);
- QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI);
+ QuaternionRotation rotation = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO);
AffineTransformMatrix3D transform = AffineTransformMatrix3D.createRotation(center, rotation);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java
index d8fa7cd..b4063cb 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java
@@ -19,7 +19,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.partitioning.Split;
@@ -221,7 +221,7 @@
// arrange
Plane plane = Plane.fromNormal(Vector3D.Unit.PLUS_Z, TEST_PRECISION);
ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromBounds(
- Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION)
));
@@ -237,9 +237,9 @@
// arrange
Plane plane = Plane.fromPointAndPlaneVectors(Vector3D.of(0, 0, 1), Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, TEST_PRECISION);
ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromBounds(
- Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION)
+ Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)
));
// act
@@ -306,7 +306,7 @@
ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.full());
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI))
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO))
.translate(Vector3D.Unit.PLUS_Y);
// act
@@ -327,7 +327,7 @@
ConvexArea.fromBounds(Line.fromPoints(Vector2D.of(1, 0), Vector2D.of(1, 1), TEST_PRECISION)));
AffineTransformMatrix3D transform = AffineTransformMatrix3D.createRotation(Vector3D.Unit.PLUS_Z,
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
ConvexSubPlane transformed = sp.transform(transform);
@@ -346,7 +346,7 @@
Arrays.asList(Vector3D.of(1, 0, 0), Vector3D.of(0, 1, 0), Vector3D.of(0, 0, 1)), TEST_PRECISION);
Transform<Vector3D> transform = AffineTransformMatrix3D.createScale(2)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
ConvexSubPlane transformed = sp.transform(transform);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Line3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Line3DTest.java
index 4f01e68..84e111a 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Line3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Line3DTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.threed;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -89,7 +89,7 @@
Line3D line = Line3D.fromPointAndDirection(pt, Vector3D.of(1, 1, 1), TEST_PRECISION);
AffineTransformMatrix3D mat = AffineTransformMatrix3D.createRotation(pt,
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
Line3D result = line.transform(mat);
@@ -152,7 +152,7 @@
Transform<Vector3D> transform = AffineTransformMatrix3D.identity()
.scale(2, 1, 1)
.translate(0.5, 1, 0)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
Line3D.SubspaceTransform result = line.subspaceTransform(transform);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java
index 55d0930..ac2c381 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java
@@ -20,7 +20,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.GeometryException;
import org.apache.commons.geometry.core.exception.IllegalNormException;
@@ -618,7 +618,7 @@
Plane plane = Plane.fromPointAndPlaneVectors(pt, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_X, TEST_PRECISION);
AffineTransformMatrix3D mat = AffineTransformMatrix3D.createRotation(pt,
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
Plane result = plane.transform(mat);
@@ -711,7 +711,7 @@
Vector3D.of(0, 0, 5), Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y,
Vector3D.of(2, 3, 5), Vector3D.of(3, 3, 5), Vector3D.of(2, 4, 5));
- checkSubspaceTransform(plane.subspaceTransform(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI)),
+ checkSubspaceTransform(plane.subspaceTransform(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO)),
Vector3D.of(1, 0, 0), Vector3D.Unit.MINUS_Z, Vector3D.Unit.PLUS_Y,
Vector3D.of(1, 0, 0), Vector3D.of(1, 0, -1), Vector3D.of(1, 1, 0));
}
@@ -738,7 +738,7 @@
EuclideanTestUtils.permuteSkipZero(-2, 2, 0.5, (a, b, c) -> {
// create a somewhat complicate transform to try to hit all of the edge cases
AffineTransformMatrix3D transform = AffineTransformMatrix3D.createTranslation(Vector3D.of(a, b, c))
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.of(b, c, a), Geometry.PI * c))
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.of(b, c, a), PlaneAngleRadians.PI * c))
.scale(0.1, 4, 8);
// act
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java
index 17559ba..c063dfe 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java
@@ -22,7 +22,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.Region;
import org.apache.commons.geometry.core.RegionLocation;
@@ -1554,8 +1554,8 @@
planes.add(Plane.fromPointAndNormal(bottomZ, Vector3D.Unit.MINUS_Z, TEST_PRECISION));
// add the side planes
- final double vDelta = Geometry.PI / stacks;
- final double hDelta = Geometry.PI * 2 / slices;
+ final double vDelta = PlaneAngleRadians.PI / stacks;
+ final double hDelta = PlaneAngleRadians.PI * 2 / slices;
final double adjustedRadius = (radius + (radius * Math.cos(vDelta * 0.5))) / 2.0;
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Segment3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Segment3DTest.java
index 4af514d..8979f97 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Segment3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Segment3DTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.threed;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.exception.GeometryValueException;
@@ -294,7 +294,7 @@
Transform<Vector3D> transform = AffineTransformMatrix3D.identity()
.scale(2, 1, 1)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
Segment3D transformed = segment.transform(transform);
@@ -312,7 +312,7 @@
Transform<Vector3D> transform = AffineTransformMatrix3D.identity()
.scale(2, 1, 1)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
Segment3D transformed = segment.transform(transform);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinatesTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinatesTest.java
index b98ac87..23ce394 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinatesTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinatesTest.java
@@ -18,7 +18,7 @@
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.junit.Assert;
import org.junit.Test;
@@ -26,10 +26,10 @@
private static final double EPS = 1e-10;
- private static final double QUARTER_PI = 0.25 * Geometry.PI;
- private static final double MINUS_QUARTER_PI = -0.25 * Geometry.PI;
- private static final double THREE_QUARTER_PI = 0.75 * Geometry.PI;
- private static final double MINUS_THREE_QUARTER_PI = -0.75 * Geometry.PI;
+ private static final double QUARTER_PI = 0.25 * PlaneAngleRadians.PI;
+ private static final double MINUS_QUARTER_PI = -0.25 * PlaneAngleRadians.PI;
+ private static final double THREE_QUARTER_PI = 0.75 * PlaneAngleRadians.PI;
+ private static final double MINUS_THREE_QUARTER_PI = -0.75 * PlaneAngleRadians.PI;
@Test
public void testOf() {
@@ -37,19 +37,19 @@
checkSpherical(SphericalCoordinates.of(0, 0, 0), 0, 0, 0);
checkSpherical(SphericalCoordinates.of(0.1, 0.2, 0.3), 0.1, 0.2, 0.3);
- checkSpherical(SphericalCoordinates.of(1, Geometry.HALF_PI, Geometry.PI),
- 1, Geometry.HALF_PI, Geometry.PI);
- checkSpherical(SphericalCoordinates.of(1, Geometry.MINUS_HALF_PI, Geometry.HALF_PI),
- 1, Geometry.THREE_HALVES_PI, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.of(1, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI),
+ 1, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
+ checkSpherical(SphericalCoordinates.of(1, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ 1, PlaneAngleRadians.THREE_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testOf_normalizesAzimuthAngle() {
// act/assert
- checkSpherical(SphericalCoordinates.of(2, Geometry.TWO_PI, 0), 2, 0, 0);
- checkSpherical(SphericalCoordinates.of(2, Geometry.HALF_PI + Geometry.TWO_PI, 0), 2, Geometry.HALF_PI, 0);
- checkSpherical(SphericalCoordinates.of(2, -Geometry.PI, 0), 2, Geometry.PI, 0);
- checkSpherical(SphericalCoordinates.of(2, Geometry.THREE_HALVES_PI, 0), 2, Geometry.THREE_HALVES_PI, 0);
+ checkSpherical(SphericalCoordinates.of(2, PlaneAngleRadians.TWO_PI, 0), 2, 0, 0);
+ checkSpherical(SphericalCoordinates.of(2, PlaneAngleRadians.PI_OVER_TWO + PlaneAngleRadians.TWO_PI, 0), 2, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkSpherical(SphericalCoordinates.of(2, -PlaneAngleRadians.PI, 0), 2, PlaneAngleRadians.PI, 0);
+ checkSpherical(SphericalCoordinates.of(2, PlaneAngleRadians.THREE_PI_OVER_TWO, 0), 2, PlaneAngleRadians.THREE_PI_OVER_TWO, 0);
}
@Test
@@ -60,14 +60,14 @@
checkSpherical(SphericalCoordinates.of(1, 0, QUARTER_PI), 1, 0, QUARTER_PI);
checkSpherical(SphericalCoordinates.of(1, 0, MINUS_QUARTER_PI), 1, 0, QUARTER_PI);
- checkSpherical(SphericalCoordinates.of(1, 0, Geometry.HALF_PI), 1, 0, Geometry.HALF_PI);
- checkSpherical(SphericalCoordinates.of(1, 0, Geometry.MINUS_HALF_PI), 1, 0, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.of(1, 0, PlaneAngleRadians.PI_OVER_TWO), 1, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkSpherical(SphericalCoordinates.of(1, 0, PlaneAngleRadians.MINUS_PI_OVER_TWO), 1, 0, PlaneAngleRadians.PI_OVER_TWO);
checkSpherical(SphericalCoordinates.of(1, 0, THREE_QUARTER_PI), 1, 0, THREE_QUARTER_PI);
checkSpherical(SphericalCoordinates.of(1, 0, MINUS_THREE_QUARTER_PI), 1, 0, THREE_QUARTER_PI);
- checkSpherical(SphericalCoordinates.of(1, 0, Geometry.TWO_PI), 1, 0, 0);
- checkSpherical(SphericalCoordinates.of(1, 0, Geometry.MINUS_TWO_PI), 1, 0, 0);
+ checkSpherical(SphericalCoordinates.of(1, 0, PlaneAngleRadians.TWO_PI), 1, 0, 0);
+ checkSpherical(SphericalCoordinates.of(1, 0, PlaneAngleRadians.MINUS_TWO_PI), 1, 0, 0);
}
@Test
@@ -75,15 +75,15 @@
// act/assert
checkOfWithAngleWrapAround(1, 0, 0);
checkOfWithAngleWrapAround(1, QUARTER_PI, QUARTER_PI);
- checkOfWithAngleWrapAround(1, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkOfWithAngleWrapAround(1, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
checkOfWithAngleWrapAround(1, THREE_QUARTER_PI, THREE_QUARTER_PI);
- checkOfWithAngleWrapAround(1, Geometry.PI, Geometry.PI);
+ checkOfWithAngleWrapAround(1, PlaneAngleRadians.PI, PlaneAngleRadians.PI);
}
private void checkOfWithAngleWrapAround(double radius, double azimuth, double polar) {
for (int i=-4; i<=4; ++i) {
checkSpherical(
- SphericalCoordinates.of(radius, azimuth + (i * Geometry.TWO_PI), polar + (-i * Geometry.TWO_PI)),
+ SphericalCoordinates.of(radius, azimuth + (i * PlaneAngleRadians.TWO_PI), polar + (-i * PlaneAngleRadians.TWO_PI)),
radius, azimuth, polar);
}
}
@@ -91,14 +91,14 @@
@Test
public void testOf_negativeRadius() {
// act/assert
- checkSpherical(SphericalCoordinates.of(-2, 0, 0), 2, Geometry.PI, Geometry.PI);
- checkSpherical(SphericalCoordinates.of(-2, Geometry.PI, Geometry.PI), 2, 0, 0);
+ checkSpherical(SphericalCoordinates.of(-2, 0, 0), 2, PlaneAngleRadians.PI, PlaneAngleRadians.PI);
+ checkSpherical(SphericalCoordinates.of(-2, PlaneAngleRadians.PI, PlaneAngleRadians.PI), 2, 0, 0);
- checkSpherical(SphericalCoordinates.of(-3, Geometry.HALF_PI, QUARTER_PI), 3, Geometry.THREE_HALVES_PI, THREE_QUARTER_PI);
- checkSpherical(SphericalCoordinates.of(-3, Geometry.MINUS_HALF_PI, THREE_QUARTER_PI), 3, Geometry.HALF_PI, QUARTER_PI);
+ checkSpherical(SphericalCoordinates.of(-3, PlaneAngleRadians.PI_OVER_TWO, QUARTER_PI), 3, PlaneAngleRadians.THREE_PI_OVER_TWO, THREE_QUARTER_PI);
+ checkSpherical(SphericalCoordinates.of(-3, PlaneAngleRadians.MINUS_PI_OVER_TWO, THREE_QUARTER_PI), 3, PlaneAngleRadians.PI_OVER_TWO, QUARTER_PI);
- checkSpherical(SphericalCoordinates.of(-4, QUARTER_PI, Geometry.HALF_PI), 4, Geometry.PI + QUARTER_PI, Geometry.HALF_PI);
- checkSpherical(SphericalCoordinates.of(-4, MINUS_THREE_QUARTER_PI, Geometry.HALF_PI), 4, QUARTER_PI, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.of(-4, QUARTER_PI, PlaneAngleRadians.PI_OVER_TWO), 4, PlaneAngleRadians.PI + QUARTER_PI, PlaneAngleRadians.PI_OVER_TWO);
+ checkSpherical(SphericalCoordinates.of(-4, MINUS_THREE_QUARTER_PI, PlaneAngleRadians.PI_OVER_TWO), 4, QUARTER_PI, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
@@ -120,17 +120,17 @@
// act/assert
checkSpherical(SphericalCoordinates.fromCartesian(0, 0, 0), 0, 0, 0);
- checkSpherical(SphericalCoordinates.fromCartesian(0.1, 0, 0), 0.1, 0, Geometry.HALF_PI);
- checkSpherical(SphericalCoordinates.fromCartesian(-0.1, 0, 0), 0.1, Geometry.PI, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.fromCartesian(0.1, 0, 0), 0.1, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkSpherical(SphericalCoordinates.fromCartesian(-0.1, 0, 0), 0.1, PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
- checkSpherical(SphericalCoordinates.fromCartesian(0, 0.1, 0), 0.1, Geometry.HALF_PI, Geometry.HALF_PI);
- checkSpherical(SphericalCoordinates.fromCartesian(0, -0.1, 0), 0.1, Geometry.THREE_HALVES_PI, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.fromCartesian(0, 0.1, 0), 0.1, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkSpherical(SphericalCoordinates.fromCartesian(0, -0.1, 0), 0.1, PlaneAngleRadians.THREE_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
checkSpherical(SphericalCoordinates.fromCartesian(0, 0, 0.1), 0.1, 0, 0);
- checkSpherical(SphericalCoordinates.fromCartesian(0, 0, -0.1), 0.1, 0, Geometry.PI);
+ checkSpherical(SphericalCoordinates.fromCartesian(0, 0, -0.1), 0.1, 0, PlaneAngleRadians.PI);
checkSpherical(SphericalCoordinates.fromCartesian(1, 1, 1), sqrt3, QUARTER_PI, Math.acos(1 / sqrt3));
- checkSpherical(SphericalCoordinates.fromCartesian(-1, -1, -1), sqrt3, 1.25 * Geometry.PI, Math.acos(-1 / sqrt3));
+ checkSpherical(SphericalCoordinates.fromCartesian(-1, -1, -1), sqrt3, 1.25 * PlaneAngleRadians.PI, Math.acos(-1 / sqrt3));
}
@Test
@@ -141,17 +141,17 @@
// act/assert
checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, 0, 0)), 0, 0, 0);
- checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0.1, 0, 0)), 0.1, 0, Geometry.HALF_PI);
- checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(-0.1, 0, 0)), 0.1, Geometry.PI, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0.1, 0, 0)), 0.1, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(-0.1, 0, 0)), 0.1, PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
- checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, 0.1, 0)), 0.1, Geometry.HALF_PI, Geometry.HALF_PI);
- checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, -0.1, 0)), 0.1, Geometry.THREE_HALVES_PI, Geometry.HALF_PI);
+ checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, 0.1, 0)), 0.1, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, -0.1, 0)), 0.1, PlaneAngleRadians.THREE_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, 0, 0.1)), 0.1, 0, 0);
- checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, 0, -0.1)), 0.1, 0, Geometry.PI);
+ checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(0, 0, -0.1)), 0.1, 0, PlaneAngleRadians.PI);
checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(1, 1, 1)), sqrt3, QUARTER_PI, Math.acos(1 / sqrt3));
- checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(-1, -1, -1)), sqrt3, 1.25 * Geometry.PI, Math.acos(-1 / sqrt3));
+ checkSpherical(SphericalCoordinates.fromCartesian(Vector3D.of(-1, -1, -1)), sqrt3, 1.25 * PlaneAngleRadians.PI, Math.acos(-1 / sqrt3));
}
@Test
@@ -162,14 +162,14 @@
// act/assert
checkVector(SphericalCoordinates.of(0, 0, 0).toVector(), 0, 0, 0);
- checkVector(SphericalCoordinates.of(1, 0, Geometry.HALF_PI).toVector(), 1, 0, 0);
- checkVector(SphericalCoordinates.of(1, Geometry.PI, Geometry.HALF_PI).toVector(), -1, 0, 0);
+ checkVector(SphericalCoordinates.of(1, 0, PlaneAngleRadians.PI_OVER_TWO).toVector(), 1, 0, 0);
+ checkVector(SphericalCoordinates.of(1, PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO).toVector(), -1, 0, 0);
- checkVector(SphericalCoordinates.of(2, Geometry.HALF_PI, Geometry.HALF_PI).toVector(), 0, 2, 0);
- checkVector(SphericalCoordinates.of(2, Geometry.MINUS_HALF_PI, Geometry.HALF_PI).toVector(), 0, -2, 0);
+ checkVector(SphericalCoordinates.of(2, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO).toVector(), 0, 2, 0);
+ checkVector(SphericalCoordinates.of(2, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO).toVector(), 0, -2, 0);
checkVector(SphericalCoordinates.of(3, 0, 0).toVector(), 0, 0, 3);
- checkVector(SphericalCoordinates.of(3, 0, Geometry.PI).toVector(), 0, 0, -3);
+ checkVector(SphericalCoordinates.of(3, 0, PlaneAngleRadians.PI).toVector(), 0, 0, -3);
checkVector(SphericalCoordinates.of(sqrt3, QUARTER_PI, Math.acos(1 / sqrt3)).toVector(), 1, 1, 1);
checkVector(SphericalCoordinates.of(sqrt3, MINUS_THREE_QUARTER_PI, Math.acos(-1 / sqrt3)).toVector(), -1, -1, -1);
@@ -183,14 +183,14 @@
// act/assert
checkVector(SphericalCoordinates.toCartesian(0, 0, 0), 0, 0, 0);
- checkVector(SphericalCoordinates.toCartesian(1, 0, Geometry.HALF_PI), 1, 0, 0);
- checkVector(SphericalCoordinates.toCartesian(1, Geometry.PI, Geometry.HALF_PI), -1, 0, 0);
+ checkVector(SphericalCoordinates.toCartesian(1, 0, PlaneAngleRadians.PI_OVER_TWO), 1, 0, 0);
+ checkVector(SphericalCoordinates.toCartesian(1, PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO), -1, 0, 0);
- checkVector(SphericalCoordinates.toCartesian(2, Geometry.HALF_PI, Geometry.HALF_PI), 0, 2, 0);
- checkVector(SphericalCoordinates.toCartesian(2, Geometry.MINUS_HALF_PI, Geometry.HALF_PI), 0, -2, 0);
+ checkVector(SphericalCoordinates.toCartesian(2, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), 0, 2, 0);
+ checkVector(SphericalCoordinates.toCartesian(2, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), 0, -2, 0);
checkVector(SphericalCoordinates.toCartesian(3, 0, 0), 0, 0, 3);
- checkVector(SphericalCoordinates.toCartesian(3, 0, Geometry.PI), 0, 0, -3);
+ checkVector(SphericalCoordinates.toCartesian(3, 0, PlaneAngleRadians.PI), 0, 0, -3);
checkVector(SphericalCoordinates.toCartesian(Math.sqrt(3), QUARTER_PI, Math.acos(1 / sqrt3)), 1, 1, 1);
checkVector(SphericalCoordinates.toCartesian(Math.sqrt(3), MINUS_THREE_QUARTER_PI, Math.acos(-1 / sqrt3)), -1, -1, -1);
@@ -338,7 +338,7 @@
public void testParse() {
// act/assert
checkSpherical(SphericalCoordinates.parse("(1, 2, 3)"), 1, 2, 3);
- checkSpherical(SphericalCoordinates.parse("( -2.0 , 1 , -5e-1)"), 2, 1 + Geometry.PI, Geometry.PI - 0.5);
+ checkSpherical(SphericalCoordinates.parse("( -2.0 , 1 , -5e-1)"), 2, 1 + PlaneAngleRadians.PI, PlaneAngleRadians.PI - 0.5);
checkSpherical(SphericalCoordinates.parse("(NaN,Infinity,-Infinity)"), Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY);
}
@@ -353,15 +353,15 @@
// act/assert
Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(0), 0.0, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(Geometry.PI), Geometry.PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(Geometry.THREE_HALVES_PI), Geometry.THREE_HALVES_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(Geometry.TWO_PI), 0.0, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(PlaneAngleRadians.PI), PlaneAngleRadians.PI, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(PlaneAngleRadians.THREE_PI_OVER_TWO), PlaneAngleRadians.THREE_PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(PlaneAngleRadians.TWO_PI), 0.0, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(Geometry.MINUS_HALF_PI), Geometry.THREE_HALVES_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(-Geometry.PI), Geometry.PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(-Geometry.PI - Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(-Geometry.TWO_PI), 0.0, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(PlaneAngleRadians.MINUS_PI_OVER_TWO), PlaneAngleRadians.THREE_PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(-PlaneAngleRadians.PI), PlaneAngleRadians.PI, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(-PlaneAngleRadians.PI - PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizeAzimuth(-PlaneAngleRadians.TWO_PI), 0.0, EPS);
}
@Test
@@ -377,15 +377,15 @@
// act/assert
Assert.assertEquals(SphericalCoordinates.normalizePolar(0), 0.0, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(Geometry.PI), Geometry.PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(Geometry.PI + Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(Geometry.TWO_PI), 0.0, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(PlaneAngleRadians.PI), PlaneAngleRadians.PI, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(PlaneAngleRadians.PI + PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(PlaneAngleRadians.TWO_PI), 0.0, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(Geometry.MINUS_HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(-Geometry.PI), Geometry.PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(-Geometry.PI - Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(SphericalCoordinates.normalizePolar(-Geometry.TWO_PI), 0.0, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(PlaneAngleRadians.MINUS_PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(-PlaneAngleRadians.PI), PlaneAngleRadians.PI, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(-PlaneAngleRadians.PI - PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(SphericalCoordinates.normalizePolar(-PlaneAngleRadians.TWO_PI), 0.0, EPS);
}
@Test
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubLine3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubLine3DTest.java
index 19e939d..25e1ceb 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubLine3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubLine3DTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
@@ -93,7 +93,7 @@
Transform<Vector3D> transform = AffineTransformMatrix3D.identity()
.translate(Vector3D.of(1, 0, 0))
.scale(Vector3D.of(2, 1, 1))
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
SubLine3D result = sub.transform(transform);
@@ -123,7 +123,7 @@
Transform<Vector3D> transform = AffineTransformMatrix3D.identity()
.translate(Vector3D.of(1, 0, 0))
.scale(Vector3D.of(2, 1, 1))
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
SubLine3D result = sub.transform(transform);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java
index 0994af9..390afc0 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java
@@ -19,7 +19,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.Transform;
@@ -345,7 +345,7 @@
SubPlane sp = new SubPlane(plane, RegionBSPTree2D.from(area));
Transform<Vector3D> transform = AffineTransformMatrix3D.identity()
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI))
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO))
.translate(Vector3D.of(1, 0, 0));
// act
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java
index c67ce65..dda623b 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java
@@ -20,7 +20,7 @@
import java.util.Comparator;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -519,12 +519,12 @@
Assert.assertEquals(3.14159257373023116985197793156, v1.angle(Vector3D.of(-2, -4, -6.000001)), tolerance);
Assert.assertEquals(0.0, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.PLUS_X), tolerance);
- Assert.assertEquals(Geometry.PI, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.MINUS_X), tolerance);
+ Assert.assertEquals(PlaneAngleRadians.PI, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.MINUS_X), tolerance);
- Assert.assertEquals(Geometry.HALF_PI, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.PLUS_Y), tolerance);
- Assert.assertEquals(Geometry.HALF_PI, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.MINUS_Y), tolerance);
- Assert.assertEquals(Geometry.HALF_PI, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.PLUS_Z), tolerance);
- Assert.assertEquals(Geometry.HALF_PI, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.MINUS_Z), tolerance);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.PLUS_Y), tolerance);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.MINUS_Y), tolerance);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.PLUS_Z), tolerance);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, Vector3D.Unit.PLUS_X.angle(Vector3D.Unit.MINUS_Z), tolerance);
}
@Test
@@ -879,8 +879,8 @@
}
private void checkProjectAndRejectFullSphere(Vector3D vec, double baseMag, double eps) {
- for (double polar = 0.0; polar <= Geometry.PI; polar += 0.5) {
- for (double azimuth = 0.0; azimuth <= Geometry.TWO_PI; azimuth += 0.5) {
+ for (double polar = 0.0; polar <= PlaneAngleRadians.PI; polar += 0.5) {
+ for (double azimuth = 0.0; azimuth <= PlaneAngleRadians.TWO_PI; azimuth += 0.5) {
Vector3D base = SphericalCoordinates.toCartesian(baseMag, azimuth, polar);
Vector3D proj = vec.project(base);
@@ -894,18 +894,18 @@
// check the angle between the projection and the base; this will
// be undefined when the angle between the original vector and the
// base is pi/2 (which means that the projection is the zero vector)
- if (angle < Geometry.HALF_PI) {
+ if (angle < PlaneAngleRadians.PI_OVER_TWO) {
Assert.assertEquals(0.0, proj.angle(base), eps);
}
- else if (angle > Geometry.HALF_PI) {
- Assert.assertEquals(Geometry.PI, proj.angle(base), eps);
+ else if (angle > PlaneAngleRadians.PI_OVER_TWO) {
+ Assert.assertEquals(PlaneAngleRadians.PI, proj.angle(base), eps);
}
// check the angle between the rejection and the base; this should
// always be pi/2 except for when the angle between the original vector
// and the base is 0 or pi, in which case the rejection is the zero vector.
- if (angle > 0.0 && angle < Geometry.PI) {
- Assert.assertEquals(Geometry.HALF_PI, rej.angle(base), eps);
+ if (angle > 0.0 && angle < PlaneAngleRadians.PI) {
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, rej.angle(base), eps);
}
}
}
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
index 8a86425..a1eff71 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
@@ -21,7 +21,7 @@
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.GeometryValueException;
import org.apache.commons.geometry.core.exception.IllegalNormException;
@@ -55,7 +55,7 @@
private static final Vector3D PLUS_DIAGONAL = Vector3D.of(1, 1, 1);
private static final Vector3D MINUS_DIAGONAL = Vector3D.of(-1, -1, -1);
- private static final double TWO_THIRDS_PI = 2.0 * Geometry.PI / 3.0;
+ private static final double TWO_THIRDS_PI = 2.0 * PlaneAngleRadians.PI / 3.0;
private static final double MINUS_TWO_THIRDS_PI = -TWO_THIRDS_PI;
@Test
@@ -161,11 +161,11 @@
// positive angle results in the axis being the normalized input axis
EuclideanTestUtils.assertCoordinatesEqual(norm,
- QuaternionRotation.fromAxisAngle(vec, Geometry.HALF_PI).getAxis(), EPS);
+ QuaternionRotation.fromAxisAngle(vec, PlaneAngleRadians.PI_OVER_TWO).getAxis(), EPS);
// negative angle results in the axis being the negated normalized input axis
EuclideanTestUtils.assertCoordinatesEqual(norm,
- QuaternionRotation.fromAxisAngle(vec.negate(), Geometry.MINUS_HALF_PI).getAxis(), EPS);
+ QuaternionRotation.fromAxisAngle(vec.negate(), PlaneAngleRadians.MINUS_PI_OVER_TWO).getAxis(), EPS);
});
}
@@ -175,17 +175,17 @@
Assert.assertEquals(0.0, QuaternionRotation.of(1, 0, 0, 0).getAngle(), EPS);
Assert.assertEquals(0.0, QuaternionRotation.of(-1, 0, 0, 0).getAngle(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, QuaternionRotation.of(1, 0, 0, 1).getAngle(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, QuaternionRotation.of(-1, 0, 0, -1).getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, QuaternionRotation.of(1, 0, 0, 1).getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, QuaternionRotation.of(-1, 0, 0, -1).getAngle(), EPS);
- Assert.assertEquals(Geometry.PI * 2.0 / 3.0, QuaternionRotation.of(1, 1, 1, 1).getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI * 2.0 / 3.0, QuaternionRotation.of(1, 1, 1, 1).getAngle(), EPS);
- Assert.assertEquals(Geometry.PI, QuaternionRotation.of(0, 0, 0, 1).getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, QuaternionRotation.of(0, 0, 0, 1).getAngle(), EPS);
}
@Test
public void testGetAngle_matchesAxisAngleConstruction() {
- for (double theta = -2 * Geometry.PI; theta <= 2 * Geometry.PI; theta += 0.1) {
+ for (double theta = -2 * PlaneAngleRadians.PI; theta <= 2 * PlaneAngleRadians.PI; theta += 0.1) {
// arrange
QuaternionRotation rot = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, theta);
@@ -195,7 +195,7 @@
// assert
// make sure that we're in the [0, pi] range
Assert.assertTrue(angle >= 0.0);
- Assert.assertTrue(angle <= Geometry.PI);
+ Assert.assertTrue(angle <= PlaneAngleRadians.PI);
double expected = PlaneAngleRadians.normalizeBetweenMinusPiAndPi(theta);
if (PLUS_DIAGONAL.dot(rot.getAxis()) < 0) {
@@ -214,38 +214,38 @@
// --- x axes
assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, 0.0));
- assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.HALF_PI));
- assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.MINUS_HALF_PI));
+ assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.PI_OVER_TWO));
+ assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO));
- assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.HALF_PI));
- assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.MINUS_HALF_PI));
+ assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.PI_OVER_TWO));
+ assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO));
- assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.PI));
- assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.PI));
+ assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.PI));
+ assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.PI));
// --- y axes
assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, 0.0));
- assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.HALF_PI));
- assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.MINUS_HALF_PI));
+ assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.PI_OVER_TWO));
+ assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO));
- assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.HALF_PI));
- assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.MINUS_HALF_PI));
+ assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.PI_OVER_TWO));
+ assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO));
- assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.PI));
- assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.PI));
+ assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.PI));
+ assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.PI));
// --- z axes
assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, 0.0));
- assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.HALF_PI));
- assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.MINUS_HALF_PI));
+ assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.PI_OVER_TWO));
+ assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO));
- assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.HALF_PI));
- assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.MINUS_HALF_PI));
+ assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.PI_OVER_TWO));
+ assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO));
- assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.PI));
- assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.PI));
+ assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.PI));
+ assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.PI));
// --- diagonal
assertRotationEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, TWO_THIRDS_PI));
@@ -258,10 +258,10 @@
@Test
public void testFromAxisAngle_invalidAxisNorm() {
// act/assert
- GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.ZERO, Geometry.HALF_PI), IllegalNormException.class);
- GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.NaN, Geometry.HALF_PI), IllegalNormException.class);
- GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.POSITIVE_INFINITY, Geometry.HALF_PI), IllegalNormException.class);
- GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.NEGATIVE_INFINITY, Geometry.HALF_PI), IllegalNormException.class);
+ GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.ZERO, PlaneAngleRadians.PI_OVER_TWO), IllegalNormException.class);
+ GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.NaN, PlaneAngleRadians.PI_OVER_TWO), IllegalNormException.class);
+ GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.POSITIVE_INFINITY, PlaneAngleRadians.PI_OVER_TWO), IllegalNormException.class);
+ GeometryTestUtils.assertThrows(() -> QuaternionRotation.fromAxisAngle(Vector3D.NEGATIVE_INFINITY, PlaneAngleRadians.PI_OVER_TWO), IllegalNormException.class);
}
@Test
@@ -278,7 +278,7 @@
@Test
public void testApplyVector() {
// arrange
- QuaternionRotation q = QuaternionRotation.fromAxisAngle(Vector3D.of(1, 1, 1), Geometry.HALF_PI);
+ QuaternionRotation q = QuaternionRotation.fromAxisAngle(Vector3D.of(1, 1, 1), PlaneAngleRadians.PI_OVER_TWO);
EuclideanTestUtils.permute(-2, 2, 0.2, (x, y, z) -> {
Vector3D input = Vector3D.of(x, y, z);
@@ -313,38 +313,38 @@
// --- x axes
assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, 0.0).inverse());
- assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.MINUS_HALF_PI).inverse());
- assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.HALF_PI).inverse());
+ assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).inverse());
+ assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.PI_OVER_TWO).inverse());
- assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.MINUS_HALF_PI).inverse());
- assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.HALF_PI).inverse());
+ assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).inverse());
+ assertRotationEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.PI_OVER_TWO).inverse());
- assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.PI).inverse());
- assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.PI).inverse());
+ assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.PI).inverse());
+ assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.PI).inverse());
// --- y axes
assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, 0.0).inverse());
- assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.MINUS_HALF_PI).inverse());
- assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.HALF_PI).inverse());
+ assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).inverse());
+ assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.PI_OVER_TWO).inverse());
- assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.MINUS_HALF_PI).inverse());
- assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.HALF_PI).inverse());
+ assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).inverse());
+ assertRotationEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.PI_OVER_TWO).inverse());
- assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.PI).inverse());
- assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.PI).inverse());
+ assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.PI).inverse());
+ assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.PI).inverse());
// --- z axes
assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, 0.0).inverse());
- assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.MINUS_HALF_PI).inverse());
- assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.HALF_PI).inverse());
+ assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).inverse());
+ assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.PI_OVER_TWO).inverse());
- assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.MINUS_HALF_PI).inverse());
- assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.HALF_PI).inverse());
+ assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).inverse());
+ assertRotationEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.PI_OVER_TWO).inverse());
- assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.PI).inverse());
- assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.PI).inverse());
+ assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.PI).inverse());
+ assertRotationEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.PI).inverse());
// --- diagonal
assertRotationEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, MINUS_TWO_THIRDS_PI).inverse());
@@ -360,7 +360,7 @@
// arrange
Vector3D vec = Vector3D.of(x, y, z);
- QuaternionRotation rot = QuaternionRotation.fromAxisAngle(vec, 0.75 * Geometry.PI);
+ QuaternionRotation rot = QuaternionRotation.fromAxisAngle(vec, 0.75 * PlaneAngleRadians.PI);
QuaternionRotation neg = rot.inverse();
// act/assert
@@ -372,15 +372,15 @@
@Test
public void testMultiply_sameAxis_simple() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.1 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.4 * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.1 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.4 * PlaneAngleRadians.PI);
// act
QuaternionRotation result = q1.multiply(q2);
// assert
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_X, result.getAxis(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, result.getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, result.getAngle(), EPS);
assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, result);
}
@@ -389,18 +389,18 @@
public void testMultiply_sameAxis_multiple() {
// arrange
double oneThird = 1.0 / 3.0;
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.1 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, oneThird * Geometry.PI);
- QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, 0.4 * Geometry.PI);
- QuaternionRotation q4 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.3 * Geometry.PI);
- QuaternionRotation q5 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, - oneThird * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.1 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, oneThird * PlaneAngleRadians.PI);
+ QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, 0.4 * PlaneAngleRadians.PI);
+ QuaternionRotation q4 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.3 * PlaneAngleRadians.PI);
+ QuaternionRotation q5 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, - oneThird * PlaneAngleRadians.PI);
// act
QuaternionRotation result = q1.multiply(q2).multiply(q3).multiply(q4).multiply(q5);
// assert
EuclideanTestUtils.assertCoordinatesEqual(PLUS_DIAGONAL.normalize(), result.getAxis(), EPS);
- Assert.assertEquals(2.0 * Geometry.PI / 3.0, result.getAngle(), EPS);
+ Assert.assertEquals(2.0 * PlaneAngleRadians.PI / 3.0, result.getAngle(), EPS);
assertRotationEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, result);
}
@@ -408,15 +408,15 @@
@Test
public void testMultiply_differentAxes() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO);
// act
QuaternionRotation result = q1.multiply(q2);
// assert
EuclideanTestUtils.assertCoordinatesEqual(PLUS_DIAGONAL.normalize(), result.getAxis(), EPS);
- Assert.assertEquals(2.0 * Geometry.PI / 3.0, result.getAngle(), EPS);
+ Assert.assertEquals(2.0 * PlaneAngleRadians.PI / 3.0, result.getAngle(), EPS);
assertRotationEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, result);
@@ -429,9 +429,9 @@
@Test
public void testMultiply_orderOfOperations() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.PI);
- QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.HALF_PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI);
+ QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, PlaneAngleRadians.PI_OVER_TWO);
// act
QuaternionRotation result = q3.multiply(q2).multiply(q1);
@@ -448,7 +448,7 @@
public void testMultiply_numericalStability() {
// arrange
int slices = 1024;
- double delta = (8.0 * Geometry.PI / 3.0) / slices;
+ double delta = (8.0 * PlaneAngleRadians.PI / 3.0) / slices;
QuaternionRotation q = QuaternionRotation.identity();
@@ -473,15 +473,15 @@
@Test
public void testPremultiply_sameAxis_simple() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.1 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.4 * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.1 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.4 * PlaneAngleRadians.PI);
// act
QuaternionRotation result = q1.premultiply(q2);
// assert
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_X, result.getAxis(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, result.getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, result.getAngle(), EPS);
assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, result);
}
@@ -490,18 +490,18 @@
public void testPremultiply_sameAxis_multiple() {
// arrange
double oneThird = 1.0 / 3.0;
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.1 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, oneThird * Geometry.PI);
- QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, 0.4 * Geometry.PI);
- QuaternionRotation q4 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.3 * Geometry.PI);
- QuaternionRotation q5 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, - oneThird * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.1 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, oneThird * PlaneAngleRadians.PI);
+ QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, 0.4 * PlaneAngleRadians.PI);
+ QuaternionRotation q4 = QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, 0.3 * PlaneAngleRadians.PI);
+ QuaternionRotation q5 = QuaternionRotation.fromAxisAngle(MINUS_DIAGONAL, - oneThird * PlaneAngleRadians.PI);
// act
QuaternionRotation result = q1.premultiply(q2).premultiply(q3).premultiply(q4).premultiply(q5);
// assert
EuclideanTestUtils.assertCoordinatesEqual(PLUS_DIAGONAL.normalize(), result.getAxis(), EPS);
- Assert.assertEquals(2.0 * Geometry.PI / 3.0, result.getAngle(), EPS);
+ Assert.assertEquals(2.0 * PlaneAngleRadians.PI / 3.0, result.getAngle(), EPS);
assertRotationEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, result);
}
@@ -509,15 +509,15 @@
@Test
public void testPremultiply_differentAxes() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO);
// act
QuaternionRotation result = q2.premultiply(q1);
// assert
EuclideanTestUtils.assertCoordinatesEqual(PLUS_DIAGONAL.normalize(), result.getAxis(), EPS);
- Assert.assertEquals(2.0 * Geometry.PI / 3.0, result.getAngle(), EPS);
+ Assert.assertEquals(2.0 * PlaneAngleRadians.PI / 3.0, result.getAngle(), EPS);
assertRotationEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, result);
@@ -530,9 +530,9 @@
@Test
public void testPremultiply_orderOfOperations() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.PI);
- QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.HALF_PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI);
+ QuaternionRotation q3 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, PlaneAngleRadians.PI_OVER_TWO);
// act
QuaternionRotation result = q1.premultiply(q2).premultiply(q3);
@@ -549,7 +549,7 @@
public void testSlerp_simple() {
// arrange
QuaternionRotation q0 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.0);
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI);
final Slerp transform = q0.slerp(q1);
Vector3D v = Vector3D.of(2, 0, 1);
@@ -568,28 +568,28 @@
// arrange
QuaternionRotation[] rotations = {
QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.0),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.PI),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI),
QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, 0.0),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, Geometry.HALF_PI),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, Geometry.PI),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, PlaneAngleRadians.PI_OVER_TWO),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, PlaneAngleRadians.PI),
QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, 0.0),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.PI),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI),
QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, 0.0),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, Geometry.HALF_PI),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, Geometry.PI),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, PlaneAngleRadians.PI_OVER_TWO),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, PlaneAngleRadians.PI),
QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.0),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.PI),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI_OVER_TWO),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, PlaneAngleRadians.PI),
QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, 0.0),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.HALF_PI),
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.PI),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, PlaneAngleRadians.PI_OVER_TWO),
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, PlaneAngleRadians.PI),
};
// act/assert
@@ -636,8 +636,8 @@
@Test
public void testSlerp_followsShortestPath() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.75 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, -0.75 * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.75 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, -0.75 * PlaneAngleRadians.PI);
// act
QuaternionRotation result = QuaternionRotation.of(q1.slerp(q2).apply(0.5));
@@ -648,7 +648,7 @@
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.MINUS_X, result.apply(Vector3D.Unit.PLUS_X), EPS);
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_Z, result.getAxis(), EPS);
- Assert.assertEquals(Geometry.PI, result.getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, result.getAngle(), EPS);
}
@Test
@@ -663,15 +663,15 @@
// assert
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_Y, result.apply(Vector3D.Unit.PLUS_X), EPS);
- Assert.assertEquals(Geometry.HALF_PI, result.getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, result.getAngle(), EPS);
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_Z, result.getAxis(), EPS);
}
@Test
public void testSlerp_outputQuaternionIsNormalizedForAllT() {
// arrange
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.25 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.75 * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.25 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.75 * PlaneAngleRadians.PI);
final int numSteps = 200;
final double delta = 1d / numSteps;
@@ -691,8 +691,8 @@
// arrange
Vector3D vec = Vector3D.Unit.PLUS_X;
- QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.25 * Geometry.PI);
- QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.75 * Geometry.PI);
+ QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.25 * PlaneAngleRadians.PI);
+ QuaternionRotation q2 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.75 * PlaneAngleRadians.PI);
// act/assert
final Slerp slerp12 = q1.slerp(q2);
@@ -714,38 +714,38 @@
// --- x axes
assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, 0.0).toMatrix());
- assertTransformEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.HALF_PI).toMatrix());
- assertTransformEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.MINUS_HALF_PI).toMatrix());
+ assertTransformEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.PI_OVER_TWO).toMatrix());
+ assertTransformEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).toMatrix());
- assertTransformEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.HALF_PI).toMatrix());
- assertTransformEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.MINUS_HALF_PI).toMatrix());
+ assertTransformEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.PI_OVER_TWO).toMatrix());
+ assertTransformEquals(StandardRotations.MINUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).toMatrix());
- assertTransformEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.PI).toMatrix());
- assertTransformEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.PI).toMatrix());
+ assertTransformEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, PlaneAngleRadians.PI).toMatrix());
+ assertTransformEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, PlaneAngleRadians.PI).toMatrix());
// --- y axes
assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, 0.0).toMatrix());
- assertTransformEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.HALF_PI).toMatrix());
- assertTransformEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.MINUS_HALF_PI).toMatrix());
+ assertTransformEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.PI_OVER_TWO).toMatrix());
+ assertTransformEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).toMatrix());
- assertTransformEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.HALF_PI).toMatrix());
- assertTransformEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.MINUS_HALF_PI).toMatrix());
+ assertTransformEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.PI_OVER_TWO).toMatrix());
+ assertTransformEquals(StandardRotations.MINUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).toMatrix());
- assertTransformEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.PI).toMatrix());
- assertTransformEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.PI).toMatrix());
+ assertTransformEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, PlaneAngleRadians.PI).toMatrix());
+ assertTransformEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, PlaneAngleRadians.PI).toMatrix());
// --- z axes
assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, 0.0).toMatrix());
- assertTransformEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.HALF_PI).toMatrix());
- assertTransformEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.MINUS_HALF_PI).toMatrix());
+ assertTransformEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.PI_OVER_TWO).toMatrix());
+ assertTransformEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).toMatrix());
- assertTransformEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.HALF_PI).toMatrix());
- assertTransformEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.MINUS_HALF_PI).toMatrix());
+ assertTransformEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.PI_OVER_TWO).toMatrix());
+ assertTransformEquals(StandardRotations.MINUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.MINUS_PI_OVER_TWO).toMatrix());
- assertTransformEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.PI).toMatrix());
- assertTransformEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.PI).toMatrix());
+ assertTransformEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, PlaneAngleRadians.PI).toMatrix());
+ assertTransformEquals(StandardRotations.Z_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, PlaneAngleRadians.PI).toMatrix());
// --- diagonal
assertTransformEquals(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, QuaternionRotation.fromAxisAngle(PLUS_DIAGONAL, TWO_THIRDS_PI).toMatrix());
@@ -773,12 +773,12 @@
private void checkAxisAngleSequenceToQuaternionRoundtrip(AxisReferenceFrame frame, AxisSequence axes) {
double step = 0.3;
- double angle2Start = axes.getType() == AxisSequenceType.EULER ? 0.0 + 0.1 : Geometry.MINUS_HALF_PI + 0.1;
- double angle2Stop = angle2Start + Geometry.PI;
+ double angle2Start = axes.getType() == AxisSequenceType.EULER ? 0.0 + 0.1 : PlaneAngleRadians.MINUS_PI_OVER_TWO + 0.1;
+ double angle2Stop = angle2Start + PlaneAngleRadians.PI;
- for (double angle1 = 0.0; angle1 <= Geometry.TWO_PI; angle1 += step) {
+ for (double angle1 = 0.0; angle1 <= PlaneAngleRadians.TWO_PI; angle1 += step) {
for (double angle2 = angle2Start; angle2 < angle2Stop; angle2 += step) {
- for (double angle3 = 0.0; angle3 <= Geometry.TWO_PI; angle3 += 0.3) {
+ for (double angle3 = 0.0; angle3 <= PlaneAngleRadians.TWO_PI; angle3 += 0.3) {
// arrange
AxisAngleSequence angles = new AxisAngleSequence(frame, axes, angle1, angle2, angle3);
@@ -804,7 +804,7 @@
EuclideanTestUtils.permuteSkipZero(-1, 1, 0.5, (x, y, z) -> {
Vector3D axis = Vector3D.of(x, y, z);
- for (double angle = -Geometry.TWO_PI; angle <= Geometry.TWO_PI; angle += step) {
+ for (double angle = -PlaneAngleRadians.TWO_PI; angle <= PlaneAngleRadians.TWO_PI; angle += step) {
// arrange
QuaternionRotation q = QuaternionRotation.fromAxisAngle(axis, angle);
@@ -823,7 +823,7 @@
// arrange
double[] eulerSingularities = {
0.0,
- Geometry.PI
+ PlaneAngleRadians.PI
};
double angle1 = 0.1;
@@ -860,7 +860,7 @@
// arrange
double[] eulerSingularities = {
0.0,
- Geometry.PI
+ PlaneAngleRadians.PI
};
double angle1 = 0.1;
@@ -896,8 +896,8 @@
public void testAxisAngleSequenceConversion_relative_taitBryanSingularities() {
// arrange
double[] taitBryanSingularities = {
- Geometry.MINUS_HALF_PI,
- Geometry.HALF_PI
+ PlaneAngleRadians.MINUS_PI_OVER_TWO,
+ PlaneAngleRadians.PI_OVER_TWO
};
double angle1 = 0.1;
@@ -933,8 +933,8 @@
public void testAxisAngleSequenceConversion_absolute_taitBryanSingularities() {
// arrange
double[] taitBryanSingularities = {
- Geometry.MINUS_HALF_PI,
- Geometry.HALF_PI
+ PlaneAngleRadians.MINUS_PI_OVER_TWO,
+ PlaneAngleRadians.PI_OVER_TWO
};
double angle1 = 0.1;
@@ -993,8 +993,8 @@
// assert
Assert.assertEquals(AxisReferenceFrame.RELATIVE, seq.getReferenceFrame());
Assert.assertEquals(AxisSequence.YZX, seq.getAxisSequence());
- Assert.assertEquals(Geometry.HALF_PI, seq.getAngle1(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, seq.getAngle2(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, seq.getAngle1(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, seq.getAngle2(), EPS);
Assert.assertEquals(0, seq.getAngle3(), EPS);
}
@@ -1009,9 +1009,9 @@
// assert
Assert.assertEquals(AxisReferenceFrame.ABSOLUTE, seq.getReferenceFrame());
Assert.assertEquals(AxisSequence.YZX, seq.getAxisSequence());
- Assert.assertEquals(Geometry.HALF_PI, seq.getAngle1(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, seq.getAngle1(), EPS);
Assert.assertEquals(0, seq.getAngle2(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, seq.getAngle3(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, seq.getAngle3(), EPS);
}
@Test
@@ -1078,7 +1078,7 @@
checkQuaternion(q, val, 0, 0, val);
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_Z, q.getAxis(), EPS);
- Assert.assertEquals(Geometry.HALF_PI, q.getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, q.getAngle(), EPS);
EuclideanTestUtils.assertCoordinatesEqual(u2, q.apply(u1), EPS);
EuclideanTestUtils.assertCoordinatesEqual(u1, q.inverse().apply(u2), EPS);
@@ -1135,7 +1135,7 @@
Vector3D axis = q.getAxis();
Assert.assertEquals(0.0, axis.dot(u1), EPS);
Assert.assertEquals(0.0, axis.dot(u2), EPS);
- Assert.assertEquals(Geometry.PI, q.getAngle(), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, q.getAngle(), EPS);
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, -2, 0), q.apply(u1), EPS);
EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 3, 0), q.inverse().apply(u2), EPS);
@@ -1157,7 +1157,7 @@
double angle = q.getAngle();
Assert.assertTrue(angle >= 0.0);
- Assert.assertTrue(angle <= Geometry.PI);
+ Assert.assertTrue(angle <= PlaneAngleRadians.PI);
});
}
@@ -1327,7 +1327,7 @@
double angle = q.getAngle();
Assert.assertTrue(angle >= 0.0);
- Assert.assertTrue(angle <= Geometry.PI);
+ Assert.assertTrue(angle <= PlaneAngleRadians.PI);
Vector3D transformedX = q.apply(Vector3D.Unit.PLUS_X);
Vector3D transformedY = q.apply(Vector3D.Unit.PLUS_Y);
@@ -1381,12 +1381,12 @@
assertRotationEquals(StandardRotations.IDENTITY,
QuaternionRotation.fromAxisAngleSequence(AxisAngleSequence.createRelative(axes, 0, 0, 0)));
assertRotationEquals(StandardRotations.IDENTITY,
- QuaternionRotation.fromAxisAngleSequence(AxisAngleSequence.createRelative(axes, Geometry.TWO_PI, Geometry.TWO_PI, Geometry.TWO_PI)));
+ QuaternionRotation.fromAxisAngleSequence(AxisAngleSequence.createRelative(axes, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.TWO_PI)));
assertRotationEquals(StandardRotations.IDENTITY,
QuaternionRotation.fromAxisAngleSequence(AxisAngleSequence.createAbsolute(axes, 0, 0, 0)));
assertRotationEquals(StandardRotations.IDENTITY,
- QuaternionRotation.fromAxisAngleSequence(AxisAngleSequence.createAbsolute(axes, Geometry.TWO_PI, Geometry.TWO_PI, Geometry.TWO_PI)));
+ QuaternionRotation.fromAxisAngleSequence(AxisAngleSequence.createAbsolute(axes, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.TWO_PI)));
}
}
@@ -1396,76 +1396,76 @@
// --- act/assert
// XYZ
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYZ, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYZ, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYZ, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// XZY
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZY, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZY, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZY, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZY, Geometry.HALF_PI, 0, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZY, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZY, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZY, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZY, PlaneAngleRadians.PI_OVER_TWO, 0, PlaneAngleRadians.PI_OVER_TWO);
// YXZ
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXZ, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXZ, Geometry.HALF_PI, 0, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXZ, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXZ, PlaneAngleRadians.PI_OVER_TWO, 0, PlaneAngleRadians.PI_OVER_TWO);
// YZX
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// ZXY
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// ZYX
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYX, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYX, Geometry.HALF_PI, 0, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYX, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYX, PlaneAngleRadians.PI_OVER_TWO, 0, PlaneAngleRadians.PI_OVER_TWO);
// XYX
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYX, Geometry.HALF_PI, Geometry.HALF_PI, Geometry.MINUS_HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYX, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// XZX
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZX, Geometry.MINUS_HALF_PI, Geometry.HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZX, 0, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZX, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZX, 0, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
// YXY
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXY, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXY, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXY, Geometry.MINUS_HALF_PI, Geometry.HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXY, 0, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXY, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXY, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXY, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXY, 0, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
// YZY
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZY, Geometry.MINUS_HALF_PI, Geometry.MINUS_HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZY, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZY, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZY, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZY, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZY, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZY, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZY, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// ZXZ
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZXZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZXZ, Geometry.HALF_PI, Geometry.HALF_PI, Geometry.MINUS_HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZXZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZXZ, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZXZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZXZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZXZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZXZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// ZYZ
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYZ, Geometry.HALF_PI, Geometry.MINUS_HALF_PI, Geometry.MINUS_HALF_PI);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYZ, 0, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceRelative(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYZ, 0, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
}
/** Helper method for verifying that a {@link RelativeEulerAngles} instance constructed with the given arguments
@@ -1488,76 +1488,76 @@
// --- act/assert
// XYZ
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYZ, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYZ, Geometry.HALF_PI, 0, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYZ, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYZ, PlaneAngleRadians.PI_OVER_TWO, 0, PlaneAngleRadians.PI_OVER_TWO);
// XZY
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZY, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZY, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZY, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZY, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZY, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZY, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZY, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZY, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// YXZ
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXZ, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXZ, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXZ, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// YZX
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, Geometry.HALF_PI, 0, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, 0, PlaneAngleRadians.PI_OVER_TWO);
// ZXY
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, Geometry.HALF_PI, 0, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZX, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZX, PlaneAngleRadians.PI_OVER_TWO, 0, PlaneAngleRadians.PI_OVER_TWO);
// ZYX
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYX, 0, 0, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYX, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYX, 0, 0, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// XYX
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYX, Geometry.HALF_PI, Geometry.MINUS_HALF_PI, Geometry.MINUS_HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYX, 0, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XYX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XYX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XYX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XYX, 0, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
// XZX
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZX, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZX, Geometry.MINUS_HALF_PI, Geometry.MINUS_HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZX, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZX, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.XZX, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.XZX, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.XZX, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.XZX, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// YXY
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXY, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXY, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXY, Geometry.MINUS_HALF_PI, Geometry.MINUS_HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXY, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YXY, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YXY, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YXY, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YXY, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
// YZY
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZY, Geometry.MINUS_HALF_PI, Geometry.HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZY, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZY, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZY, 0, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.YZY, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.YZY, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.YZY, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.YZY, 0, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
// ZXZ
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZXZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZXZ, Geometry.MINUS_HALF_PI, Geometry.HALF_PI, Geometry.HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZXZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZXZ, 0, Geometry.HALF_PI, Geometry.HALF_PI);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZXZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZXZ, PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZXZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZXZ, 0, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
// ZYZ
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYZ, Geometry.HALF_PI, Geometry.HALF_PI, Geometry.MINUS_HALF_PI);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYZ, 0, Geometry.HALF_PI, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYZ, Geometry.HALF_PI, 0, 0);
- checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYZ, Geometry.HALF_PI, Geometry.HALF_PI, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_X_HALF_PI, AxisSequence.ZYZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Y_HALF_PI, AxisSequence.ZYZ, 0, PlaneAngleRadians.PI_OVER_TWO, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_Z_HALF_PI, AxisSequence.ZYZ, PlaneAngleRadians.PI_OVER_TWO, 0, 0);
+ checkFromAxisAngleSequenceAbsolute(StandardRotations.PLUS_DIAGONAL_TWO_THIRDS_PI, AxisSequence.ZYZ, PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, 0);
}
/** Helper method for verifying that an {@link AbsoluteEulerAngles} instance constructed with the given arguments
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java
index fbc036f..8d3f9df 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java
@@ -22,7 +22,7 @@
import java.util.List;
import java.util.Random;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
@@ -36,7 +36,7 @@
private static final DoublePrecisionContext TEST_PRECISION =
new EpsilonDoublePrecisionContext(TEST_EPS);
- private static final Line Y_AXIS = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI,
+ private static final Line Y_AXIS = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO,
TEST_PRECISION);
private TestConnector connector = new TestConnector();
@@ -264,11 +264,11 @@
Polyline input = Polyline.builder(TEST_PRECISION)
.appendVertices(p0, p1)
- .append(Line.fromPointAndAngle(p1, 0.25 * Geometry.PI, TEST_PRECISION).segment(p1, p1))
- .append(Line.fromPointAndAngle(p1, -0.25 * Geometry.PI, TEST_PRECISION).segment(almostP1, almostP1))
+ .append(Line.fromPointAndAngle(p1, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION).segment(p1, p1))
+ .append(Line.fromPointAndAngle(p1, -0.25 * PlaneAngleRadians.PI, TEST_PRECISION).segment(almostP1, almostP1))
.append(p2)
.append(p0)
- .append(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.MINUS_HALF_PI, TEST_PRECISION)
+ .append(Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION)
.segment(almostP0, almostP0))
.build();
@@ -292,8 +292,8 @@
Segment seg0 = Segment.fromPoints(p0, p1, TEST_PRECISION);
Segment seg1 = Segment.fromPoints(p1, p0, TEST_PRECISION);
- Segment seg2 = Line.fromPointAndAngle(p1, Geometry.HALF_PI, TEST_PRECISION).segment(p1, p1);
- Segment seg3 = Line.fromPointAndAngle(p0, Geometry.MINUS_HALF_PI, TEST_PRECISION).segment(p0, p0);
+ Segment seg2 = Line.fromPointAndAngle(p1, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).segment(p1, p1);
+ Segment seg3 = Line.fromPointAndAngle(p0, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION).segment(p0, p0);
List<Segment> segments = new ArrayList<>(Arrays.asList(seg0, seg1, seg2, seg3));
shuffle(segments);
@@ -317,9 +317,9 @@
Vector2D p0 = Vector2D.of(1, 0);
Segment seg0 = Line.fromPointAndAngle(p0, 0.0, TEST_PRECISION).segment(p0, p0);
- Segment seg1 = Line.fromPointAndAngle(p0, Geometry.HALF_PI, TEST_PRECISION).segment(p0, p0);
- Segment seg2 = Line.fromPointAndAngle(p0, Geometry.PI, TEST_PRECISION).segment(p0, p0);
- Segment seg3 = Line.fromPointAndAngle(p0, Geometry.MINUS_HALF_PI, TEST_PRECISION).segment(p0, p0);
+ Segment seg1 = Line.fromPointAndAngle(p0, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).segment(p0, p0);
+ Segment seg2 = Line.fromPointAndAngle(p0, PlaneAngleRadians.PI, TEST_PRECISION).segment(p0, p0);
+ Segment seg3 = Line.fromPointAndAngle(p0, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION).segment(p0, p0);
List<Segment> segments = new ArrayList<>(Arrays.asList(seg0, seg1, seg2, seg3));
shuffle(segments);
@@ -344,7 +344,7 @@
Vector2D p1 = Vector2D.of(1, 0);
Segment seg0 = Line.fromPointAndAngle(p1, 0.0, TEST_PRECISION).segment(p1, p1);
- Segment seg1 = Line.fromPointAndAngle(p1, 0.25 * Geometry.PI, TEST_PRECISION).segment(p1, p1);
+ Segment seg1 = Line.fromPointAndAngle(p1, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION).segment(p1, p1);
Segment seg2 = Line.fromPointAndAngle(p0, 0, TEST_PRECISION).segment(p0, p0);
List<Segment> segments = new ArrayList<>(Arrays.asList(seg0, seg1, seg2));
@@ -374,7 +374,7 @@
Vector2D p1 = Vector2D.of(1, 0);
Vector2D p2 = Vector2D.of(1, 1);
- Segment seg0 = Line.fromPointAndAngle(p0, Geometry.PI, TEST_PRECISION).segment(p0, p0);
+ Segment seg0 = Line.fromPointAndAngle(p0, PlaneAngleRadians.PI, TEST_PRECISION).segment(p0, p0);
Segment seg1 = Segment.fromPoints(p0, p1, TEST_PRECISION);
Segment seg2 = Segment.fromPoints(p1, p2, TEST_PRECISION);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2DTest.java
index 76445e0..2121e15 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2DTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.twod;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
@@ -261,7 +261,7 @@
@Test
public void testCreateRotation() {
// act
- double angle = Geometry.PI * 2.0 / 3.0;
+ double angle = PlaneAngleRadians.PI * 2.0 / 3.0;
AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(angle);
// assert
@@ -279,7 +279,7 @@
public void testCreateRotation_aroundCenter() {
// act
Vector2D center = Vector2D.of(1, 2);
- double angle = Geometry.PI * 2.0 / 3.0;
+ double angle = PlaneAngleRadians.PI * 2.0 / 3.0;
AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(center, angle);
// assert
@@ -302,7 +302,7 @@
);
// act
- AffineTransformMatrix2D result = a.rotate(Geometry.HALF_PI);
+ AffineTransformMatrix2D result = a.rotate(PlaneAngleRadians.PI_OVER_TWO);
// assert
double[] expected = {
@@ -323,7 +323,7 @@
);
// act
- AffineTransformMatrix2D result = a.rotate(center, Geometry.HALF_PI);
+ AffineTransformMatrix2D result = a.rotate(center, PlaneAngleRadians.PI_OVER_TWO);
// assert
double[] expected = {
@@ -349,7 +349,7 @@
@Test
public void testApply_translate() {
// arrange
- Vector2D translation = Vector2D.of(1.1, -Geometry.PI);
+ Vector2D translation = Vector2D.of(1.1, -PlaneAngleRadians.PI);
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.translate(translation);
@@ -386,7 +386,7 @@
public void testApply_rotate() {
// arrange
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
- .rotate(Geometry.MINUS_HALF_PI);
+ .rotate(PlaneAngleRadians.MINUS_PI_OVER_TWO);
// act/assert
runWithCoordinates((x, y) -> {
@@ -403,7 +403,7 @@
// arrange
Vector2D center = Vector2D.of(1, 2);
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
- .rotate(center, Geometry.MINUS_HALF_PI);
+ .rotate(center, PlaneAngleRadians.MINUS_PI_OVER_TWO);
// act/assert
runWithCoordinates((x, y) -> {
@@ -421,7 +421,7 @@
// arrange
Vector2D center = Vector2D.of(1, 2);
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
- .rotate(center, Geometry.PI);
+ .rotate(center, PlaneAngleRadians.PI);
// act/assert
runWithCoordinates((x, y) -> {
@@ -443,7 +443,7 @@
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.translate(translation)
.scale(scale)
- .rotate(Geometry.HALF_PI);
+ .rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
EuclideanTestUtils.assertCoordinatesEqual(Vector2D.of(12, -5), transform.apply(Vector2D.of(1, 1)), EPS);
@@ -470,7 +470,7 @@
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.scale(scale)
.translate(translation)
- .rotate(Geometry.MINUS_HALF_PI);
+ .rotate(PlaneAngleRadians.MINUS_PI_OVER_TWO);
// act/assert
runWithCoordinates((x, y) -> {
@@ -502,7 +502,7 @@
@Test
public void testApplyVector_translate() {
// arrange
- Vector2D translation = Vector2D.of(1.1, -Geometry.PI);
+ Vector2D translation = Vector2D.of(1.1, -PlaneAngleRadians.PI);
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.translate(translation);
@@ -541,7 +541,7 @@
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.scale(1.5)
.translate(4, 6)
- .rotate(Geometry.HALF_PI);
+ .rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
runWithCoordinates((x, y) -> {
@@ -570,7 +570,7 @@
@Test
public void testApplyDirection_translate() {
// arrange
- Vector2D translation = Vector2D.of(1.1, -Geometry.PI);
+ Vector2D translation = Vector2D.of(1.1, -PlaneAngleRadians.PI);
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.translate(translation);
@@ -609,7 +609,7 @@
AffineTransformMatrix2D transform = AffineTransformMatrix2D.identity()
.scale(1.5)
.translate(4, 6)
- .rotate(Geometry.HALF_PI);
+ .rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
EuclideanTestUtils.permute(-5, 5, 0.5, (x, y) -> {
@@ -856,7 +856,7 @@
@Test
public void testInverse_rotate() {
// arrange
- AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
// act
AffineTransformMatrix2D inverse = transform.inverse();
@@ -873,7 +873,7 @@
public void testInverse_rotate_aroundCenter() {
// arrange
Vector2D center = Vector2D.of(1, 2);
- AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(center, Geometry.HALF_PI);
+ AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(center, PlaneAngleRadians.PI_OVER_TWO);
// act
AffineTransformMatrix2D inverse = transform.inverse();
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java
index b4bd85c..d1c5dad 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java
@@ -21,7 +21,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.exception.GeometryException;
@@ -59,9 +59,9 @@
// arrange
ConvexArea area = ConvexArea.fromBounds(
Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.of(1, 1), Geometry.PI, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.MINUS_HALF_PI, TEST_PRECISION)
+ Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.of(1, 1), PlaneAngleRadians.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION)
);
// act
@@ -89,12 +89,12 @@
public void testTransform_infinite() {
// arrange
AffineTransformMatrix2D mat = AffineTransformMatrix2D
- .createRotation(Vector2D.of(0, 1), Geometry.HALF_PI)
+ .createRotation(Vector2D.of(0, 1), PlaneAngleRadians.PI_OVER_TWO)
.scale(Vector2D.of(3, 2));
ConvexArea area = ConvexArea.fromBounds(
- Line.fromPointAndAngle(Vector2D.ZERO, 0.25 * Geometry.PI, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.ZERO, -0.25 * Geometry.PI, TEST_PRECISION));
+ Line.fromPointAndAngle(Vector2D.ZERO, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.ZERO, -0.25 * PlaneAngleRadians.PI, TEST_PRECISION));
// act
ConvexArea transformed = area.transform(mat);
@@ -216,7 +216,7 @@
public void testGetVertices_twoParallelLines() {
// arrange
ConvexArea area = ConvexArea.fromBounds(
- Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION)
);
@@ -228,9 +228,9 @@
public void testGetVertices_infiniteWithVertices() {
// arrange
ConvexArea area = ConvexArea.fromBounds(
- Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION)
+ Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)
);
// act
@@ -278,7 +278,7 @@
public void testProject_halfSpace() {
// arrange
ConvexArea area = ConvexArea.fromBounds(
- Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION));
+ Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
// act/assert
EuclideanTestUtils.assertCoordinatesEqual(Vector2D.of(0, 1), area.project(Vector2D.of(1, 1)), TEST_EPS);
@@ -414,7 +414,7 @@
public void testSplit_halfSpace_split() {
// arrange
ConvexArea area = ConvexArea.fromBounds(Line.fromPoints(Vector2D.ZERO, Vector2D.Unit.PLUS_X, TEST_PRECISION));
- Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, 0.25 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<ConvexArea> split = area.split(splitter);
@@ -479,7 +479,7 @@
public void testSplit_square_split() {
// arrange
ConvexArea area = ConvexArea.fromBounds(createSquareBoundingLines(Vector2D.of(1, 1), 2, 1));
- Line splitter = Line.fromPointAndAngle(Vector2D.of(2, 1), Geometry.HALF_PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(2, 1), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
Split<ConvexArea> split = area.split(splitter);
@@ -996,8 +996,8 @@
@Test
public void testFromBounds_twoLines() {
// arrange
- Line a = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION);
- Line b = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.PI, TEST_PRECISION);
+ Line a = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
+ Line b = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI, TEST_PRECISION);
// act
ConvexArea area = ConvexArea.fromBounds(a, b);
@@ -1023,9 +1023,9 @@
@Test
public void testFromBounds_triangle() {
// arrange
- Line a = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION);
- Line b = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.PI, TEST_PRECISION);
- Line c = Line.fromPointAndAngle(Vector2D.of(-2, 0), -0.25 * Geometry.PI, TEST_PRECISION);
+ Line a = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
+ Line b = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI, TEST_PRECISION);
+ Line c = Line.fromPointAndAngle(Vector2D.of(-2, 0), -0.25 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
ConvexArea area = ConvexArea.fromBounds(a, b, c);
@@ -1168,7 +1168,7 @@
public void testFromBounds_duplicateLines_differentOrientation() {
// arrange
Line a = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION);
- Line b = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION);
+ Line b = Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION);
Line c = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION);
// act/assert
@@ -1183,8 +1183,8 @@
GeometryTestUtils.assertThrows(() -> {
ConvexArea.fromBounds(Arrays.asList(
Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.PI, TEST_PRECISION),
- Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION)
+ Line.fromPointAndAngle(Vector2D.of(0, -1), PlaneAngleRadians.PI, TEST_PRECISION),
+ Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)
));
}, GeometryException.class);
}
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java
index cebf1ad..88f4783 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java
@@ -23,7 +23,7 @@
import java.util.Random;
import java.util.function.Consumer;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
@@ -118,7 +118,7 @@
Vector2D pt = Vector2D.of(0, 2);
Segment a = Line.fromPointAndAngle(pt, 0.0, TEST_PRECISION).segmentTo(pt);
- Segment b = Line.fromPointAndAngle(pt, Geometry.HALF_PI, TEST_PRECISION).segmentFrom(pt);
+ Segment b = Line.fromPointAndAngle(pt, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).segmentFrom(pt);
segments.add(a);
segments.add(b);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java
index 207f037..275064b 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.euclidean.twod;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.GeometryValueException;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -94,13 +94,13 @@
// act/assert
checkLine(Line.fromPointAndAngle(Vector2D.ZERO, 0, TEST_PRECISION),
Vector2D.ZERO, Vector2D.Unit.PLUS_X);
- checkLine(Line.fromPointAndAngle(Vector2D.of(1, 1), Geometry.HALF_PI, TEST_PRECISION),
+ checkLine(Line.fromPointAndAngle(Vector2D.of(1, 1), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION),
Vector2D.of(1, 0), Vector2D.Unit.PLUS_Y);
- checkLine(Line.fromPointAndAngle(Vector2D.of(-1, -1), Geometry.PI, TEST_PRECISION),
+ checkLine(Line.fromPointAndAngle(Vector2D.of(-1, -1), PlaneAngleRadians.PI, TEST_PRECISION),
Vector2D.of(0, -1), Vector2D.Unit.MINUS_X);
- checkLine(Line.fromPointAndAngle(Vector2D.of(1, -1), Geometry.MINUS_HALF_PI, TEST_PRECISION),
+ checkLine(Line.fromPointAndAngle(Vector2D.of(1, -1), PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION),
Vector2D.of(1, 0), Vector2D.Unit.MINUS_Y);
- checkLine(Line.fromPointAndAngle(Vector2D.of(-1, 1), Geometry.TWO_PI, TEST_PRECISION),
+ checkLine(Line.fromPointAndAngle(Vector2D.of(-1, 1), PlaneAngleRadians.TWO_PI, TEST_PRECISION),
Vector2D.of(0, 1), Vector2D.Unit.PLUS_X);
}
@@ -109,7 +109,7 @@
// arrange
Vector2D vec = Vector2D.of(1, 2);
- for (double theta = -4 * Geometry.PI; theta < 2 * Geometry.PI; theta += 0.1) {
+ for (double theta = -4 * PlaneAngleRadians.PI; theta < 2 * PlaneAngleRadians.PI; theta += 0.1) {
Line line = Line.fromPointAndAngle(vec, theta, TEST_PRECISION);
// act/assert
@@ -125,12 +125,12 @@
// act/assert
Assert.assertEquals(0, Line.fromPointAndAngle(vec, 0.0, TEST_PRECISION).getAngle(), TEST_EPS);
- Assert.assertEquals(Geometry.PI, Line.fromPointAndAngle(vec, Geometry.PI, TEST_PRECISION).getAngle(), TEST_EPS);
- Assert.assertEquals(0, Line.fromPointAndAngle(vec, Geometry.TWO_PI, TEST_PRECISION).getAngle(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, Line.fromPointAndAngle(vec, PlaneAngleRadians.PI, TEST_PRECISION).getAngle(), TEST_EPS);
+ Assert.assertEquals(0, Line.fromPointAndAngle(vec, PlaneAngleRadians.TWO_PI, TEST_PRECISION).getAngle(), TEST_EPS);
- Assert.assertEquals(0, Line.fromPointAndAngle(vec, -2 * Geometry.PI, TEST_PRECISION).getAngle(), TEST_EPS);
- Assert.assertEquals(Geometry.PI, Line.fromPointAndAngle(vec, -3 * Geometry.PI, TEST_PRECISION).getAngle(), TEST_EPS);
- Assert.assertEquals(0, Line.fromPointAndAngle(vec, -4 * Geometry.TWO_PI, TEST_PRECISION).getAngle(), TEST_EPS);
+ Assert.assertEquals(0, Line.fromPointAndAngle(vec, -2 * PlaneAngleRadians.PI, TEST_PRECISION).getAngle(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, Line.fromPointAndAngle(vec, -3 * PlaneAngleRadians.PI, TEST_PRECISION).getAngle(), TEST_EPS);
+ Assert.assertEquals(0, Line.fromPointAndAngle(vec, -4 * PlaneAngleRadians.TWO_PI, TEST_PRECISION).getAngle(), TEST_EPS);
}
@Test
@@ -298,7 +298,7 @@
@Test
public void testToSpace_offsetFromOrigin() {
// arrange
- double angle = Geometry.PI / 6;
+ double angle = PlaneAngleRadians.PI / 6;
double cos = Math.cos(angle);
double sin = Math.sin(angle);
Vector2D pt = Vector2D.of(-5, 0);
@@ -388,21 +388,21 @@
public void testAngle() {
// arrange
Line a = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
- Line b = Line.fromPointAndAngle(Vector2D.of(1, 4), Geometry.PI, TEST_PRECISION);
+ Line b = Line.fromPointAndAngle(Vector2D.of(1, 4), PlaneAngleRadians.PI, TEST_PRECISION);
Line c = Line.fromPointAndDirection(Vector2D.of(1, 1), Vector2D.of(2, 2), TEST_PRECISION);
// act/assert
Assert.assertEquals(0.0, a.angle(a), TEST_EPS);
- Assert.assertEquals(-Geometry.PI, a.angle(b), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, a.angle(c), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI, a.angle(b), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, a.angle(c), TEST_EPS);
Assert.assertEquals(0.0, b.angle(b), TEST_EPS);
- Assert.assertEquals(-Geometry.PI, b.angle(a), TEST_EPS);
- Assert.assertEquals(-0.75 * Geometry.PI, b.angle(c), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI, b.angle(a), TEST_EPS);
+ Assert.assertEquals(-0.75 * PlaneAngleRadians.PI, b.angle(c), TEST_EPS);
Assert.assertEquals(0.0, c.angle(c), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, c.angle(a), TEST_EPS);
- Assert.assertEquals(0.75 * Geometry.PI, c.angle(b), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, c.angle(a), TEST_EPS);
+ Assert.assertEquals(0.75 * PlaneAngleRadians.PI, c.angle(b), TEST_EPS);
}
@Test
@@ -504,7 +504,7 @@
@Test
public void testSegmentTo_pointOnLine() {
// arrange
- Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION);
+ Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION);
// act
Segment segment = line.segmentTo(Vector2D.of(-3, 1));
@@ -522,7 +522,7 @@
@Test
public void testSegmentTo_pointProjectedOnLine() {
// arrange
- Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION);
+ Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION);
// act
Segment segment = line.segmentTo(Vector2D.of(-3, 5));
@@ -540,7 +540,7 @@
@Test
public void testSegmentFrom_pointOnLine() {
// arrange
- Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION);
+ Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION);
// act
Segment segment = line.segmentFrom(Vector2D.of(-3, 1));
@@ -558,7 +558,7 @@
@Test
public void testSegmentFrom_pointProjectedOnLine() {
// arrange
- Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION);
+ Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION);
// act
Segment segment = line.segmentFrom(Vector2D.of(-3, 5));
@@ -689,12 +689,12 @@
// arrange
Line a = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
Line b = Line.fromPointAndAngle(Vector2D.of(4, 5), 0.0, TEST_PRECISION);
- Line c = Line.fromPointAndAngle(Vector2D.of(-1, -3), 0.4 * Geometry.PI, TEST_PRECISION);
- Line d = Line.fromPointAndAngle(Vector2D.of(1, 0), -0.4 * Geometry.PI, TEST_PRECISION);
+ Line c = Line.fromPointAndAngle(Vector2D.of(-1, -3), 0.4 * PlaneAngleRadians.PI, TEST_PRECISION);
+ Line d = Line.fromPointAndAngle(Vector2D.of(1, 0), -0.4 * PlaneAngleRadians.PI, TEST_PRECISION);
- Line e = Line.fromPointAndAngle(Vector2D.of(6, -3), Geometry.PI, TEST_PRECISION);
- Line f = Line.fromPointAndAngle(Vector2D.of(8, 5), 0.8 * Geometry.PI, TEST_PRECISION);
- Line g = Line.fromPointAndAngle(Vector2D.of(6, -3), -0.8 * Geometry.PI, TEST_PRECISION);
+ Line e = Line.fromPointAndAngle(Vector2D.of(6, -3), PlaneAngleRadians.PI, TEST_PRECISION);
+ Line f = Line.fromPointAndAngle(Vector2D.of(8, 5), 0.8 * PlaneAngleRadians.PI, TEST_PRECISION);
+ Line g = Line.fromPointAndAngle(Vector2D.of(6, -3), -0.8 * PlaneAngleRadians.PI, TEST_PRECISION);
// act/assert
Assert.assertTrue(a.similarOrientation(a));
@@ -1017,8 +1017,8 @@
AffineTransformMatrix2D scale = AffineTransformMatrix2D.createScale(2, 3);
AffineTransformMatrix2D reflect = AffineTransformMatrix2D.createScale(-1, 1);
AffineTransformMatrix2D translate = AffineTransformMatrix2D.createTranslation(3, 4);
- AffineTransformMatrix2D rotate = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
- AffineTransformMatrix2D rotateAroundPt = AffineTransformMatrix2D.createRotation(Vector2D.of(0, 1), Geometry.HALF_PI);
+ AffineTransformMatrix2D rotate = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
+ AffineTransformMatrix2D rotateAroundPt = AffineTransformMatrix2D.createRotation(Vector2D.of(0, 1), PlaneAngleRadians.PI_OVER_TWO);
Vector2D p1 = Vector2D.of(0, 1);
Vector2D p2 = Vector2D.of(1, 0);
@@ -1077,7 +1077,7 @@
Vector2D.of(3, 0), Vector2D.Unit.PLUS_Y,
Vector2D.of(3, 3), Vector2D.of(3, 4));
- checkSubspaceTransform(line.subspaceTransform(AffineTransformMatrix2D.createRotation(Geometry.HALF_PI)),
+ checkSubspaceTransform(line.subspaceTransform(AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO)),
Vector2D.of(0, 1), Vector2D.Unit.MINUS_X,
Vector2D.of(0, 1), Vector2D.of(-1, 1));
}
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinatesTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinatesTest.java
index 4f22f1c..c08fb76 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinatesTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinatesTest.java
@@ -18,7 +18,7 @@
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.junit.Assert;
import org.junit.Test;
@@ -32,18 +32,18 @@
checkPolar(PolarCoordinates.of(0, 0), 0, 0);
checkPolar(PolarCoordinates.of(2, 0), 2, 0);
- checkPolar(PolarCoordinates.of(2, Geometry.HALF_PI), 2, Geometry.HALF_PI);
- checkPolar(PolarCoordinates.of(2, Geometry.PI), 2, Geometry.PI);
- checkPolar(PolarCoordinates.of(2, Geometry.MINUS_HALF_PI), 2, Geometry.THREE_HALVES_PI);
+ checkPolar(PolarCoordinates.of(2, PlaneAngleRadians.PI_OVER_TWO), 2, PlaneAngleRadians.PI_OVER_TWO);
+ checkPolar(PolarCoordinates.of(2, PlaneAngleRadians.PI), 2, PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.of(2, PlaneAngleRadians.MINUS_PI_OVER_TWO), 2, PlaneAngleRadians.THREE_PI_OVER_TWO);
}
@Test
public void testOf_unnormalizedAngles() {
// act/assert
- checkPolar(PolarCoordinates.of(2, Geometry.TWO_PI), 2, 0);
- checkPolar(PolarCoordinates.of(2, Geometry.HALF_PI + Geometry.TWO_PI), 2, Geometry.HALF_PI);
- checkPolar(PolarCoordinates.of(2, -Geometry.PI), 2, Geometry.PI);
- checkPolar(PolarCoordinates.of(2, -Geometry.PI * 1.5), 2, Geometry.HALF_PI);
+ checkPolar(PolarCoordinates.of(2, PlaneAngleRadians.TWO_PI), 2, 0);
+ checkPolar(PolarCoordinates.of(2, PlaneAngleRadians.PI_OVER_TWO + PlaneAngleRadians.TWO_PI), 2, PlaneAngleRadians.PI_OVER_TWO);
+ checkPolar(PolarCoordinates.of(2, -PlaneAngleRadians.PI), 2, PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.of(2, -PlaneAngleRadians.PI * 1.5), 2, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
@@ -54,39 +54,39 @@
// act/assert
checkAzimuthWrapAround(2, 0);
checkAzimuthWrapAround(2, delta);
- checkAzimuthWrapAround(2, Geometry.PI - delta);
- checkAzimuthWrapAround(2, Geometry.PI);
+ checkAzimuthWrapAround(2, PlaneAngleRadians.PI - delta);
+ checkAzimuthWrapAround(2, PlaneAngleRadians.PI);
- checkAzimuthWrapAround(2, Geometry.THREE_HALVES_PI);
- checkAzimuthWrapAround(2, Geometry.TWO_PI - delta);
+ checkAzimuthWrapAround(2, PlaneAngleRadians.THREE_PI_OVER_TWO);
+ checkAzimuthWrapAround(2, PlaneAngleRadians.TWO_PI - delta);
}
private void checkAzimuthWrapAround(double radius, double azimuth) {
checkPolar(PolarCoordinates.of(radius, azimuth), radius, azimuth);
- checkPolar(PolarCoordinates.of(radius, azimuth - Geometry.TWO_PI), radius, azimuth);
- checkPolar(PolarCoordinates.of(radius, azimuth - (2 * Geometry.TWO_PI)), radius, azimuth);
- checkPolar(PolarCoordinates.of(radius, azimuth - (3 * Geometry.TWO_PI)), radius, azimuth);
+ checkPolar(PolarCoordinates.of(radius, azimuth - PlaneAngleRadians.TWO_PI), radius, azimuth);
+ checkPolar(PolarCoordinates.of(radius, azimuth - (2 * PlaneAngleRadians.TWO_PI)), radius, azimuth);
+ checkPolar(PolarCoordinates.of(radius, azimuth - (3 * PlaneAngleRadians.TWO_PI)), radius, azimuth);
- checkPolar(PolarCoordinates.of(radius, azimuth + Geometry.TWO_PI), radius, azimuth);
- checkPolar(PolarCoordinates.of(radius, azimuth + (2 * Geometry.TWO_PI)), radius, azimuth);
- checkPolar(PolarCoordinates.of(radius, azimuth + (3 * Geometry.TWO_PI)), radius, azimuth);
+ checkPolar(PolarCoordinates.of(radius, azimuth + PlaneAngleRadians.TWO_PI), radius, azimuth);
+ checkPolar(PolarCoordinates.of(radius, azimuth + (2 * PlaneAngleRadians.TWO_PI)), radius, azimuth);
+ checkPolar(PolarCoordinates.of(radius, azimuth + (3 * PlaneAngleRadians.TWO_PI)), radius, azimuth);
}
@Test
public void testOf_negativeRadius() {
// act/assert
- checkPolar(PolarCoordinates.of(-1, 0), 1, Geometry.PI);
- checkPolar(PolarCoordinates.of(-1e-6, Geometry.HALF_PI), 1e-6, Geometry.THREE_HALVES_PI);
- checkPolar(PolarCoordinates.of(-2, Geometry.PI), 2, 0);
- checkPolar(PolarCoordinates.of(-3, Geometry.MINUS_HALF_PI), 3, Geometry.HALF_PI);
+ checkPolar(PolarCoordinates.of(-1, 0), 1, PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.of(-1e-6, PlaneAngleRadians.PI_OVER_TWO), 1e-6, PlaneAngleRadians.THREE_PI_OVER_TWO);
+ checkPolar(PolarCoordinates.of(-2, PlaneAngleRadians.PI), 2, 0);
+ checkPolar(PolarCoordinates.of(-3, PlaneAngleRadians.MINUS_PI_OVER_TWO), 3, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testOf_NaNAndInfinite() {
// act/assert
checkPolar(PolarCoordinates.of(Double.NaN, 0), Double.NaN, 0);
- checkPolar(PolarCoordinates.of(Double.NEGATIVE_INFINITY, 0), Double.POSITIVE_INFINITY, Geometry.PI);
+ checkPolar(PolarCoordinates.of(Double.NEGATIVE_INFINITY, 0), Double.POSITIVE_INFINITY, PlaneAngleRadians.PI);
checkPolar(PolarCoordinates.of(Double.POSITIVE_INFINITY, 0), Double.POSITIVE_INFINITY, 0);
checkPolar(PolarCoordinates.of(0, Double.NaN), 0, Double.NaN);
@@ -103,15 +103,15 @@
checkPolar(PolarCoordinates.fromCartesian(0, 0), 0, 0);
checkPolar(PolarCoordinates.fromCartesian(1, 0), 1, 0);
- checkPolar(PolarCoordinates.fromCartesian(1, 1), sqrt2, 0.25 * Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(0, 1), 1, Geometry.HALF_PI);
+ checkPolar(PolarCoordinates.fromCartesian(1, 1), sqrt2, 0.25 * PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(0, 1), 1, PlaneAngleRadians.PI_OVER_TWO);
- checkPolar(PolarCoordinates.fromCartesian(-1, 1), sqrt2, 0.75 * Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(-1, 0), 1, Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(-1, -1), sqrt2, 1.25 * Geometry.PI);
+ checkPolar(PolarCoordinates.fromCartesian(-1, 1), sqrt2, 0.75 * PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(-1, 0), 1, PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(-1, -1), sqrt2, 1.25 * PlaneAngleRadians.PI);
- checkPolar(PolarCoordinates.fromCartesian(0, -1), 1, 1.5 * Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(1, -1), sqrt2, 1.75 * Geometry.PI);
+ checkPolar(PolarCoordinates.fromCartesian(0, -1), 1, 1.5 * PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(1, -1), sqrt2, 1.75 * PlaneAngleRadians.PI);
}
@Test
@@ -123,15 +123,15 @@
checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(0, 0)), 0, 0);
checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(1, 0)), 1, 0);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(1, 1)), sqrt2, 0.25 * Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(0, 1)), 1, Geometry.HALF_PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(1, 1)), sqrt2, 0.25 * PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(0, 1)), 1, PlaneAngleRadians.PI_OVER_TWO);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(-1, 1)), sqrt2, 0.75 * Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(-1, 0)), 1, Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(-1, -1)), sqrt2, 1.25 * Geometry.PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(-1, 1)), sqrt2, 0.75 * PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(-1, 0)), 1, PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(-1, -1)), sqrt2, 1.25 * PlaneAngleRadians.PI);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(0, -1)), 1, 1.5 * Geometry.PI);
- checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(1, -1)), sqrt2, 1.75 * Geometry.PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(0, -1)), 1, 1.5 * PlaneAngleRadians.PI);
+ checkPolar(PolarCoordinates.fromCartesian(Vector2D.of(1, -1)), sqrt2, 1.75 * PlaneAngleRadians.PI);
}
@Test
@@ -176,7 +176,7 @@
public void testIsFinite() {
// act/assert
Assert.assertTrue(PolarCoordinates.of(1, 0).isFinite());
- Assert.assertTrue(PolarCoordinates.of(1, Geometry.PI).isFinite());
+ Assert.assertTrue(PolarCoordinates.of(1, PlaneAngleRadians.PI).isFinite());
Assert.assertFalse(PolarCoordinates.of(Double.NaN, Double.NaN).isFinite());
@@ -262,15 +262,15 @@
checkVector(PolarCoordinates.of(0, 0).toCartesian(), 0, 0);
checkVector(PolarCoordinates.of(1, 0).toCartesian(), 1, 0);
- checkVector(PolarCoordinates.of(sqrt2, 0.25 * Geometry.PI).toCartesian(), 1, 1);
- checkVector(PolarCoordinates.of(1, Geometry.HALF_PI).toCartesian(), 0, 1);
+ checkVector(PolarCoordinates.of(sqrt2, 0.25 * PlaneAngleRadians.PI).toCartesian(), 1, 1);
+ checkVector(PolarCoordinates.of(1, PlaneAngleRadians.PI_OVER_TWO).toCartesian(), 0, 1);
- checkVector(PolarCoordinates.of(sqrt2, 0.75 * Geometry.PI).toCartesian(), -1, 1);
- checkVector(PolarCoordinates.of(1, Geometry.PI).toCartesian(), -1, 0);
- checkVector(PolarCoordinates.of(sqrt2, -0.75 * Geometry.PI).toCartesian(), -1, -1);
+ checkVector(PolarCoordinates.of(sqrt2, 0.75 * PlaneAngleRadians.PI).toCartesian(), -1, 1);
+ checkVector(PolarCoordinates.of(1, PlaneAngleRadians.PI).toCartesian(), -1, 0);
+ checkVector(PolarCoordinates.of(sqrt2, -0.75 * PlaneAngleRadians.PI).toCartesian(), -1, -1);
- checkVector(PolarCoordinates.of(1, Geometry.MINUS_HALF_PI).toCartesian(), 0, -1);
- checkVector(PolarCoordinates.of(sqrt2, -0.25 * Geometry.PI).toCartesian(), 1, -1);
+ checkVector(PolarCoordinates.of(1, PlaneAngleRadians.MINUS_PI_OVER_TWO).toCartesian(), 0, -1);
+ checkVector(PolarCoordinates.of(sqrt2, -0.25 * PlaneAngleRadians.PI).toCartesian(), 1, -1);
}
@Test
@@ -282,15 +282,15 @@
checkVector(PolarCoordinates.toCartesian(0, 0), 0, 0);
checkPoint(PolarCoordinates.toCartesian(1, 0), 1, 0);
- checkPoint(PolarCoordinates.toCartesian(sqrt2, 0.25 * Geometry.PI), 1, 1);
- checkPoint(PolarCoordinates.toCartesian(1, Geometry.HALF_PI), 0, 1);
+ checkPoint(PolarCoordinates.toCartesian(sqrt2, 0.25 * PlaneAngleRadians.PI), 1, 1);
+ checkPoint(PolarCoordinates.toCartesian(1, PlaneAngleRadians.PI_OVER_TWO), 0, 1);
- checkPoint(PolarCoordinates.toCartesian(sqrt2, 0.75 * Geometry.PI), -1, 1);
- checkPoint(PolarCoordinates.toCartesian(1, Geometry.PI), -1, 0);
- checkPoint(PolarCoordinates.toCartesian(sqrt2, -0.75 * Geometry.PI), -1, -1);
+ checkPoint(PolarCoordinates.toCartesian(sqrt2, 0.75 * PlaneAngleRadians.PI), -1, 1);
+ checkPoint(PolarCoordinates.toCartesian(1, PlaneAngleRadians.PI), -1, 0);
+ checkPoint(PolarCoordinates.toCartesian(sqrt2, -0.75 * PlaneAngleRadians.PI), -1, -1);
- checkPoint(PolarCoordinates.toCartesian(1, Geometry.MINUS_HALF_PI), 0, -1);
- checkPoint(PolarCoordinates.toCartesian(sqrt2, -0.25 * Geometry.PI), 1, -1);
+ checkPoint(PolarCoordinates.toCartesian(1, PlaneAngleRadians.MINUS_PI_OVER_TWO), 0, -1);
+ checkPoint(PolarCoordinates.toCartesian(sqrt2, -0.25 * PlaneAngleRadians.PI), 1, -1);
}
@Test
@@ -326,7 +326,7 @@
public void testParse() {
// act/assert
checkPolar(PolarCoordinates.parse("(1, 2)"), 1, 2);
- checkPolar(PolarCoordinates.parse("( -1 , 0.5 )"), 1, 0.5 + Geometry.PI);
+ checkPolar(PolarCoordinates.parse("( -1 , 0.5 )"), 1, 0.5 + PlaneAngleRadians.PI);
checkPolar(PolarCoordinates.parse("(NaN,-Infinity)"), Double.NaN, Double.NEGATIVE_INFINITY);
}
@@ -341,15 +341,15 @@
// act/assert
Assert.assertEquals(PolarCoordinates.normalizeAzimuth(0), 0.0, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(Geometry.PI), Geometry.PI, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(Geometry.THREE_HALVES_PI), Geometry.THREE_HALVES_PI, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(Geometry.TWO_PI), 0.0, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(PlaneAngleRadians.PI), PlaneAngleRadians.PI, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(PlaneAngleRadians.THREE_PI_OVER_TWO), PlaneAngleRadians.THREE_PI_OVER_TWO, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(PlaneAngleRadians.TWO_PI), 0.0, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(Geometry.MINUS_HALF_PI), Geometry.THREE_HALVES_PI, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(-Geometry.PI), Geometry.PI, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(-Geometry.PI - Geometry.HALF_PI), Geometry.HALF_PI, EPS);
- Assert.assertEquals(PolarCoordinates.normalizeAzimuth(-Geometry.TWO_PI), 0.0, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(PlaneAngleRadians.MINUS_PI_OVER_TWO), PlaneAngleRadians.THREE_PI_OVER_TWO, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(-PlaneAngleRadians.PI), PlaneAngleRadians.PI, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(-PlaneAngleRadians.PI - PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO, EPS);
+ Assert.assertEquals(PolarCoordinates.normalizeAzimuth(-PlaneAngleRadians.TWO_PI), 0.0, EPS);
}
@Test
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java
index 8c43afa..c3d05fd 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java
@@ -20,7 +20,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.partitioning.Split;
@@ -186,7 +186,7 @@
public void testFromSegments_infiniteSegments() {
// arrange
Segment a = Line.fromPointAndAngle(Vector2D.ZERO, 0, TEST_PRECISION).segment(Double.NEGATIVE_INFINITY, 1.0);
- Segment b = Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION).segment(0.0, Double.POSITIVE_INFINITY);
+ Segment b = Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).segment(0.0, Double.POSITIVE_INFINITY);
// act
Polyline path = Polyline.fromSegments(Arrays.asList(a, b));
@@ -244,7 +244,7 @@
public void testFromSegments_finiteAndInfiniteSegments_endInfinite() {
// arrange
Segment a = Segment.fromPoints(Vector2D.ZERO, Vector2D.of(1, 0), TEST_PRECISION);
- Segment b = Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION).segment(0.0, Double.POSITIVE_INFINITY);
+ Segment b = Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).segment(0.0, Double.POSITIVE_INFINITY);
// act
Polyline path = Polyline.fromSegments(Arrays.asList(a, b));
@@ -276,7 +276,7 @@
Segment b = Segment.fromPoints(Vector2D.of(1.01, 0), Vector2D.of(1, 0), TEST_PRECISION);
Segment c = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION).span();
- Segment d = Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION).span();
+ Segment d = Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).span();
// act/assert
GeometryTestUtils.assertThrows(() -> {
@@ -581,7 +581,7 @@
.close();
AffineTransformMatrix2D t =
- AffineTransformMatrix2D.createRotation(Vector2D.of(1, 1), Geometry.HALF_PI);
+ AffineTransformMatrix2D.createRotation(Vector2D.of(1, 1), PlaneAngleRadians.PI_OVER_TWO);
// act
Polyline result = path.transform(t);
@@ -840,7 +840,7 @@
public void testSimplify_combinedInfiniteSegment() {
// arrange
Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
- Split<Segment> split = line.span().split(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION));
+ Split<Segment> split = line.span().split(Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
Builder builder = Polyline.builder(TEST_PRECISION);
Polyline path = builder
@@ -1259,7 +1259,7 @@
builder
.append(Vector2D.ZERO)
.append(Vector2D.Unit.PLUS_X)
- .append(Line.fromPointAndAngle(Vector2D.Unit.PLUS_X, Geometry.HALF_PI, TEST_PRECISION)
+ .append(Line.fromPointAndAngle(Vector2D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)
.segment(0, Double.POSITIVE_INFINITY));
// act/assert
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java
index f5d04f8..206209b 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java
@@ -22,7 +22,7 @@
import java.util.Comparator;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.Region;
import org.apache.commons.geometry.core.RegionLocation;
@@ -267,8 +267,8 @@
public void testToConvex_quadrantComplement() {
// arrange
RegionBSPTree2D tree = RegionBSPTree2D.full();
- tree.getRoot().cut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.PI, TEST_PRECISION))
- .getPlus().cut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION));
+ tree.getRoot().cut(Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI, TEST_PRECISION))
+ .getPlus().cut(Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
tree.complement();
@@ -373,7 +373,7 @@
root.cut(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION));
RegionNode2D minus = root.getMinus();
- minus.cut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION));
+ minus.cut(Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
Vector2D origin = Vector2D.ZERO;
@@ -401,7 +401,7 @@
// arrange
RegionBSPTree2D tree = RegionBSPTree2D.full();
- Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.25 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.25 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<RegionBSPTree2D> split = tree.split(splitter);
@@ -437,7 +437,7 @@
// arrange
RegionBSPTree2D tree = RegionBSPTree2D.empty();
- Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.25 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.25 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<RegionBSPTree2D> split = tree.split(splitter);
@@ -456,7 +456,7 @@
.addRect(Vector2D.ZERO, 2, 1)
.build();
- Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, 0.25 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<RegionBSPTree2D> split = tree.split(splitter);
@@ -482,7 +482,7 @@
.addRect(Vector2D.ZERO, 2, 1)
.build();
- Line splitter = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.25 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.25 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<RegionBSPTree2D> split = tree.split(splitter);
@@ -505,7 +505,7 @@
.addRect(Vector2D.ZERO, 2, 1)
.build();
- Line splitter = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.25 * Geometry.PI, TEST_PRECISION)
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.25 * PlaneAngleRadians.PI, TEST_PRECISION)
.reverse();
// act
@@ -960,7 +960,7 @@
@Test
public void testBuilder_mixedArguments() {
// arrange
- Line minusYAxis = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.MINUS_HALF_PI, TEST_PRECISION);
+ Line minusYAxis = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
Polyline path = Polyline.builder(TEST_PRECISION)
.append(Vector2D.Unit.PLUS_X)
@@ -1037,7 +1037,7 @@
.build();
AffineTransformMatrix2D transform = AffineTransformMatrix2D.createScale(0.5, 2)
- .rotate(Geometry.HALF_PI)
+ .rotate(PlaneAngleRadians.PI_OVER_TWO)
.translate(Vector2D.of(0, -1));
// act
@@ -1062,7 +1062,7 @@
tree.getRoot().insertCut(Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION));
AffineTransformMatrix2D transform = AffineTransformMatrix2D.createScale(0.5, 2)
- .rotate(Geometry.HALF_PI)
+ .rotate(PlaneAngleRadians.PI_OVER_TWO)
.translate(Vector2D.of(1, 0));
// act
@@ -1078,7 +1078,7 @@
Assert.assertNull(segment.getStartPoint());
Assert.assertNull(segment.getEndPoint());
- Line expectedLine = Line.fromPointAndAngle(Vector2D.of(-1, 0), Geometry.HALF_PI, TEST_PRECISION);
+ Line expectedLine = Line.fromPointAndAngle(Vector2D.of(-1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
Assert.assertTrue(expectedLine.eq(segment.getLine()));
}
@@ -1088,7 +1088,7 @@
RegionBSPTree2D full = RegionBSPTree2D.full();
RegionBSPTree2D empty = RegionBSPTree2D.empty();
- AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ AffineTransformMatrix2D transform = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
// act
full.transform(transform);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java
index 92ddd06..8e82edf 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.exception.GeometryValueException;
@@ -411,7 +411,7 @@
Segment segment = Segment.fromPoints(Vector2D.of(0, 1), Vector2D.of(2, 3), TEST_PRECISION);
Transform2D translation = AffineTransformMatrix2D.createTranslation(-1, 1);
- Transform2D rotation = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ Transform2D rotation = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
Transform2D scale = AffineTransformMatrix2D.createScale(2, 3);
Transform2D reflect = FunctionTransform2D.from((pt) -> Vector2D.of(pt.getX(), -pt.getY()));
@@ -429,7 +429,7 @@
Interval.point(0, TEST_PRECISION));
Transform2D translation = AffineTransformMatrix2D.createTranslation(-1, 1);
- Transform2D rotation = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ Transform2D rotation = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
Transform2D scale = AffineTransformMatrix2D.createScale(2, 3);
Transform2D reflect = FunctionTransform2D.from((pt) -> Vector2D.of(pt.getX(), -pt.getY()));
@@ -447,7 +447,7 @@
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
Transform2D translation = AffineTransformMatrix2D.createTranslation(-1, 1);
- Transform2D rotation = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ Transform2D rotation = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
Transform2D scale = AffineTransformMatrix2D.createScale(2, 3);
Transform2D reflect = FunctionTransform2D.from((pt) -> Vector2D.of(pt.getX(), -pt.getY()));
@@ -488,7 +488,7 @@
0.0, Double.POSITIVE_INFINITY);
Transform2D translation = AffineTransformMatrix2D.createTranslation(-1, 1);
- Transform2D rotation = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ Transform2D rotation = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
Transform2D scale = AffineTransformMatrix2D.createScale(2, 3);
Transform2D reflect = FunctionTransform2D.from((pt) -> Vector2D.of(pt.getX(), -pt.getY()));
@@ -529,7 +529,7 @@
Double.NEGATIVE_INFINITY, 0.0);
Transform2D translation = AffineTransformMatrix2D.createTranslation(-1, 1);
- Transform2D rotation = AffineTransformMatrix2D.createRotation(Geometry.HALF_PI);
+ Transform2D rotation = AffineTransformMatrix2D.createRotation(PlaneAngleRadians.PI_OVER_TWO);
Transform2D scale = AffineTransformMatrix2D.createScale(2, 3);
Transform2D reflect = FunctionTransform2D.from((pt) -> Vector2D.of(pt.getX(), -pt.getY()));
@@ -570,7 +570,7 @@
Segment bSeg = Segment.fromPoints(Vector2D.of(-1, -1), Vector2D.of(1, 1), TEST_PRECISION);
Line xAxis = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
- Line yAxis = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION);
+ Line yAxis = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
Line angledLine = Line.fromPoints(Vector2D.of(1, 1), Vector2D.of(2, 0), TEST_PRECISION);
// act/assert
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java
index 5a42865..c7455da 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.exception.GeometryException;
@@ -240,7 +240,7 @@
Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
SubLine subline = new SubLine(line, subRegion);
- Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.1 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.1 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<SubLine> split = subline.split(splitter);
@@ -268,7 +268,7 @@
Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
SubLine subline = new SubLine(line, subRegion);
- Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), -0.9 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), -0.9 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<SubLine> split = subline.split(splitter);
@@ -296,7 +296,7 @@
Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
SubLine subline = new SubLine(line, subRegion);
- Line splitter = Line.fromPointAndAngle(Vector2D.of(-1, 0), 0.1 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(-1, 0), 0.1 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<SubLine> split = subline.split(splitter);
@@ -318,7 +318,7 @@
Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
SubLine subline = new SubLine(line, subRegion);
- Line splitter = Line.fromPointAndAngle(Vector2D.of(10, 0), 0.1 * Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.of(10, 0), 0.1 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<SubLine> split = subline.split(splitter);
@@ -406,7 +406,7 @@
Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION);
SubLine subline = new SubLine(line, subRegion);
- Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.PI, TEST_PRECISION);
+ Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<SubLine> split = subline.split(splitter);
@@ -422,7 +422,7 @@
public void testTransform() {
// arrange
AffineTransformMatrix2D mat = AffineTransformMatrix2D
- .createRotation(Vector2D.of(0, 1), Geometry.HALF_PI)
+ .createRotation(Vector2D.of(0, 1), PlaneAngleRadians.PI_OVER_TWO)
.scale(Vector2D.of(3, 2));
SubLine subline = new SubLine(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION));
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java
index 0bd84fb..16ab97d 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java
@@ -19,7 +19,7 @@
import java.util.Comparator;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.IllegalNormException;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -468,7 +468,7 @@
@Test
public void testOrthogonal_fullCircle() {
- for (double az = 0.0; az<=Geometry.TWO_PI; az += 0.25) {
+ for (double az = 0.0; az<=PlaneAngleRadians.TWO_PI; az += 0.25) {
// arrange
Vector2D v = PolarCoordinates.toCartesian(Math.PI, az);
@@ -547,12 +547,12 @@
// act/assert
Assert.assertEquals(0, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.PLUS_X), EPS);
- Assert.assertEquals(Geometry.PI, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.MINUS_X), EPS);
- Assert.assertEquals(Geometry.HALF_PI, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.PLUS_Y), EPS);
- Assert.assertEquals(Geometry.HALF_PI, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.MINUS_Y), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.MINUS_X), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.PLUS_Y), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, Vector2D.Unit.PLUS_X.angle(Vector2D.Unit.MINUS_Y), EPS);
- Assert.assertEquals(Geometry.PI / 4, Vector2D.of(1, 1).angle(Vector2D.of(1, 0)), EPS);
- Assert.assertEquals(Geometry.PI / 4, Vector2D.of(1, 0).angle(Vector2D.of(1, 1)), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI / 4, Vector2D.of(1, 1).angle(Vector2D.of(1, 0)), EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI / 4, Vector2D.of(1, 0).angle(Vector2D.of(1, 1)), EPS);
Assert.assertEquals(0.004999958333958323, Vector2D.of(20.0, 0.0).angle(Vector2D.of(20.0, 0.1)), EPS);
}
@@ -597,11 +597,11 @@
Assert.assertEquals(1.0, a.signedArea(b), eps);
Assert.assertEquals(-1.0, b.signedArea(a), eps);
- double xAxisAndCArea = 2 * Math.cos(0.25 * Geometry.PI);
+ double xAxisAndCArea = 2 * Math.cos(0.25 * PlaneAngleRadians.PI);
Assert.assertEquals(xAxisAndCArea, a.signedArea(c), eps);
Assert.assertEquals(-xAxisAndCArea, c.signedArea(a), eps);
- double xAxisAndDArea = 3 * Math.cos(0.25 * Geometry.PI);
+ double xAxisAndDArea = 3 * Math.cos(0.25 * PlaneAngleRadians.PI);
Assert.assertEquals(xAxisAndDArea, a.signedArea(d), eps);
Assert.assertEquals(-xAxisAndDArea, d.signedArea(a), eps);
@@ -716,7 +716,7 @@
}
private void checkProjectAndRejectFullCircle(Vector2D vec, double baseMag, double eps) {
- for (double theta = 0.0; theta <= Geometry.TWO_PI; theta += 0.5) {
+ for (double theta = 0.0; theta <= PlaneAngleRadians.TWO_PI; theta += 0.5) {
Vector2D base = PolarCoordinates.toCartesian(baseMag, theta);
Vector2D proj = vec.project(base);
@@ -730,18 +730,18 @@
// check the angle between the projection and the base; this will
// be undefined when the angle between the original vector and the
// base is pi/2 (which means that the projection is the zero vector)
- if (angle < Geometry.HALF_PI) {
+ if (angle < PlaneAngleRadians.PI_OVER_TWO) {
Assert.assertEquals(0.0, proj.angle(base), eps);
}
- else if (angle > Geometry.HALF_PI) {
- Assert.assertEquals(Geometry.PI, proj.angle(base), eps);
+ else if (angle > PlaneAngleRadians.PI_OVER_TWO) {
+ Assert.assertEquals(PlaneAngleRadians.PI, proj.angle(base), eps);
}
// check the angle between the rejection and the base; this should
// always be pi/2 except for when the angle between the original vector
// and the base is 0 or pi, in which case the rejection is the zero vector.
- if (angle > 0.0 && angle < Geometry.PI) {
- Assert.assertEquals(Geometry.HALF_PI, rej.angle(base), eps);
+ if (angle > 0.0 && angle < PlaneAngleRadians.PI) {
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, rej.angle(base), eps);
}
}
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java
index 74113e5..79dfd82 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java
@@ -22,7 +22,7 @@
import java.util.List;
import java.util.function.BiFunction;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.exception.GeometryException;
@@ -93,7 +93,7 @@
public double getMax() {
return (maxBoundary != null) ?
maxBoundary.getAzimuth() :
- Geometry.TWO_PI;
+ PlaneAngleRadians.TWO_PI;
}
/** Get the maximum point for the interval. This will be null if the
@@ -414,7 +414,7 @@
if (min != null && max != null) {
final double dist = max.getAzimuth() - min.getAzimuth();
final DoublePrecisionContext precision = min.getPrecision();
- return precision.lte(dist, Geometry.PI);
+ return precision.lte(dist, PlaneAngleRadians.PI);
}
return true;
@@ -503,11 +503,11 @@
final CutAngle minBoundary = getMinBoundary();
final CutAngle maxBoundary = getMaxBoundary();
- final Point1S posPole = Point1S.of(splitter.getPoint().getAzimuth() + Geometry.HALF_PI);
+ final Point1S posPole = Point1S.of(splitter.getPoint().getAzimuth() + PlaneAngleRadians.PI_OVER_TWO);
- final int minLoc = minBoundary.getPrecision().compare(Geometry.HALF_PI,
+ final int minLoc = minBoundary.getPrecision().compare(PlaneAngleRadians.PI_OVER_TWO,
posPole.distance(minBoundary.getPoint()));
- final int maxLoc = maxBoundary.getPrecision().compare(Geometry.HALF_PI,
+ final int maxLoc = maxBoundary.getPrecision().compare(PlaneAngleRadians.PI_OVER_TWO,
posPole.distance(maxBoundary.getPoint()));
final boolean positiveFacingSplit = splitter.isPositiveFacing();
@@ -556,7 +556,7 @@
} else {
// min is directly on the splitter; determine whether it was on the main split
// point or its antipodal point
- if (splitter.getPoint().distance(minBoundary.getPoint()) < Geometry.HALF_PI) {
+ if (splitter.getPoint().distance(minBoundary.getPoint()) < PlaneAngleRadians.PI_OVER_TWO) {
// on main splitter; interval will be located on pos side of split
pos = this;
} else {
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
index 3fc8912..1fea863 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
@@ -19,7 +19,7 @@
import java.util.Comparator;
import java.util.Objects;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Point;
import org.apache.commons.geometry.core.exception.GeometryValueException;
import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
@@ -46,7 +46,7 @@
public static final Point1S ZERO = Point1S.of(0.0);
/** A point with coordinates set to {@code pi}. */
- public static final Point1S PI = Point1S.of(Geometry.PI);
+ public static final Point1S PI = Point1S.of(PlaneAngleRadians.PI);
// CHECKSTYLE: stop ConstantName
/** A point with all coordinates set to NaN. */
@@ -169,7 +169,7 @@
* cannot be normalized
*/
public Point1S above(final Point1S base) {
- return normalize(base.getAzimuth() + Geometry.PI);
+ return normalize(base.getAzimuth() + PlaneAngleRadians.PI);
}
/** Return an equivalent point with an azimuth value strictly below the given base.
@@ -181,7 +181,7 @@
* cannot be normalized
*/
public Point1S below(final Point1S base) {
- return normalize(base.getAzimuth() - Geometry.PI);
+ return normalize(base.getAzimuth() - PlaneAngleRadians.PI);
}
/** Normalize this point around the given center point. The azimuth value of
@@ -218,9 +218,9 @@
* @return the point exactly opposite this point on the circle
*/
public Point1S antipodal() {
- double az = normalizedAzimuth + Geometry.PI;
- if (az >= Geometry.TWO_PI) {
- az -= Geometry.TWO_PI;
+ double az = normalizedAzimuth + PlaneAngleRadians.PI;
+ if (az >= PlaneAngleRadians.TWO_PI) {
+ az -= PlaneAngleRadians.TWO_PI;
}
return Point1S.of(az);
@@ -366,11 +366,11 @@
*/
public static double signedDistance(final Point1S p1, final Point1S p2) {
double dist = p2.normalizedAzimuth - p1.normalizedAzimuth;
- if (dist < -Geometry.PI) {
- dist += Geometry.TWO_PI;
+ if (dist < -PlaneAngleRadians.PI) {
+ dist += PlaneAngleRadians.TWO_PI;
}
- if (dist >= Geometry.PI) {
- dist -= Geometry.TWO_PI;
+ if (dist >= PlaneAngleRadians.PI) {
+ dist -= PlaneAngleRadians.TWO_PI;
}
return dist;
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
index 072f0ea..cec325e 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
@@ -22,7 +22,7 @@
import java.util.List;
import java.util.Objects;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.partitioning.Hyperplane;
import org.apache.commons.geometry.core.partitioning.HyperplaneLocation;
@@ -154,12 +154,12 @@
splitter.getPrecision());
final double plusPoleOffset = splitter.isPositiveFacing() ?
- +Geometry.HALF_PI :
- -Geometry.HALF_PI;
+ +PlaneAngleRadians.PI_OVER_TWO :
+ -PlaneAngleRadians.PI_OVER_TWO;
final Point1S plusPole = Point1S.of(splitter.getAzimuth() + plusPoleOffset);
final boolean zeroOnPlusSide = splitter.getPrecision()
- .lte(plusPole.distance(Point1S.ZERO), Geometry.HALF_PI);
+ .lte(plusPole.distance(Point1S.ZERO), PlaneAngleRadians.PI_OVER_TWO);
Split<RegionBSPTree1S> firstSplit = split(splitter);
Split<RegionBSPTree1S> secondSplit = split(opposite);
@@ -296,7 +296,7 @@
max = max.reverse();
}
} else {
- max = CutAngle.createPositiveFacing(Geometry.TWO_PI, precision);
+ max = CutAngle.createPositiveFacing(PlaneAngleRadians.TWO_PI, precision);
}
return AngularInterval.of(min, max);
@@ -337,7 +337,7 @@
@Override
protected RegionSizeProperties<Point1S> computeRegionSizeProperties() {
if (isFull()) {
- return new RegionSizeProperties<>(Geometry.TWO_PI, null);
+ return new RegionSizeProperties<>(PlaneAngleRadians.TWO_PI, null);
}
double size = 0;
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java
index dde64aa..36f3241 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java
@@ -23,7 +23,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.partitioning.AbstractConvexHyperplaneBoundedRegion;
import org.apache.commons.geometry.core.partitioning.ConvexSubHyperplane;
@@ -40,10 +40,10 @@
private static final ConvexArea2S FULL = new ConvexArea2S(Collections.emptyList());
/** Constant containing the area of the full spherical space. */
- private static final double FULL_SIZE = 4 * Geometry.PI;
+ private static final double FULL_SIZE = 4 * PlaneAngleRadians.PI;
/** Constant containing the area of half of the spherical space. */
- private static final double HALF_SIZE = Geometry.TWO_PI;
+ private static final double HALF_SIZE = PlaneAngleRadians.TWO_PI;
/** Construct an instance from its boundaries. Callers are responsible for ensuring
* that the given path represents the boundary of a convex area. No validation is
@@ -91,7 +91,7 @@
current = arcs.get(i);
next = arcs.get((i + 1) % numSides);
- angles[i] = Geometry.PI - current.getCircle()
+ angles[i] = PlaneAngleRadians.PI - current.getCircle()
.angle(next.getCircle(), current.getEndPoint());
}
@@ -113,7 +113,7 @@
final double[] angles = getInteriorAngles();
final double sum = Arrays.stream(angles).sum();
- return sum - ((angles.length - 2) * Geometry.PI);
+ return sum - ((angles.length - 2) * PlaneAngleRadians.PI);
}
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/GreatCircle.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/GreatCircle.java
index 676943c..3b791f1 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/GreatCircle.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/GreatCircle.java
@@ -18,7 +18,7 @@
import java.util.Objects;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Transform;
import org.apache.commons.geometry.core.exception.GeometryException;
import org.apache.commons.geometry.core.internal.Equivalency;
@@ -129,7 +129,7 @@
* @return the offset (oriented distance) of a direction
*/
public double offset(final Vector3D vec) {
- return pole.angle(vec) - Geometry.HALF_PI;
+ return pole.angle(vec) - PlaneAngleRadians.PI_OVER_TWO;
}
/** Get the azimuth angle of a point relative to this great circle instance,
@@ -158,7 +158,7 @@
// adjust range
if (az < 0) {
- az += Geometry.TWO_PI;
+ az += PlaneAngleRadians.TWO_PI;
}
return az;
@@ -424,7 +424,7 @@
final double dist = a.distance(b);
if (precision.eqZero(dist)) {
err = "equal";
- } else if (precision.eq(dist, Geometry.PI)) {
+ } else if (precision.eq(dist, PlaneAngleRadians.PI)) {
err = "antipodal";
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/InteriorAngleGreatArcConnector.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/InteriorAngleGreatArcConnector.java
index 446646a..d33828b 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/InteriorAngleGreatArcConnector.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/InteriorAngleGreatArcConnector.java
@@ -19,7 +19,7 @@
import java.util.Collection;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
/** Great arc connector that selects between multiple connection options
* based on the resulting interior angle. An interior angle in this
@@ -46,7 +46,7 @@
ConnectableGreatArc selected = null;
for (ConnectableGreatArc candidate : outgoing) {
- double interiorAngle = Geometry.PI - circle.angle(candidate.getArc().getCircle(),
+ double interiorAngle = PlaneAngleRadians.PI - circle.angle(candidate.getArc().getCircle(),
incoming.getArc().getEndPoint());
if (selected == null || isBetterAngle(interiorAngle, selectedInteriorAngle)) {
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Point2S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Point2S.java
index 25f1aea..80a6999 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Point2S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Point2S.java
@@ -18,7 +18,7 @@
import java.util.Comparator;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Point;
import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -152,7 +152,7 @@
* @return the point exactly opposite this point on the sphere
*/
public Point2S antipodal() {
- return new Point2S(-azimuth, Geometry.PI - polar, vector.negate());
+ return new Point2S(-azimuth, PlaneAngleRadians.PI - polar, vector.negate());
}
/** {@inheritDoc} */
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2S.java
index baea410..e723ba9 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2S.java
@@ -20,7 +20,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.partitioning.Hyperplane;
import org.apache.commons.geometry.core.partitioning.Split;
import org.apache.commons.geometry.core.partitioning.bsp.AbstractBSPTree;
@@ -32,7 +32,7 @@
*/
public class RegionBSPTree2S extends AbstractRegionBSPTree<Point2S, RegionBSPTree2S.RegionNode2S> {
/** Constant containing the area of the full spherical space. */
- private static final double FULL_SIZE = 4 * Geometry.PI;
+ private static final double FULL_SIZE = 4 * PlaneAngleRadians.PI;
/** List of great arc path comprising the region boundary. */
private List<GreatArcPath> boundaryPaths;
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java
index b110eba..48c32ad 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.Region;
import org.apache.commons.geometry.core.RegionLocation;
@@ -41,14 +41,14 @@
public void testOf_doubles() {
// act/assert
checkInterval(AngularInterval.of(0, 1, TEST_PRECISION), 0, 1);
- checkInterval(AngularInterval.of(1, 0, TEST_PRECISION), 1, Geometry.TWO_PI);
+ checkInterval(AngularInterval.of(1, 0, TEST_PRECISION), 1, PlaneAngleRadians.TWO_PI);
checkInterval(AngularInterval.of(-2, -1.5, TEST_PRECISION), -2, -1.5);
- checkInterval(AngularInterval.of(-2, -2.5, TEST_PRECISION), -2, Geometry.TWO_PI - 2.5);
+ checkInterval(AngularInterval.of(-2, -2.5, TEST_PRECISION), -2, PlaneAngleRadians.TWO_PI - 2.5);
checkFull(AngularInterval.of(1, 1, TEST_PRECISION));
checkFull(AngularInterval.of(0, 1e-11, TEST_PRECISION));
checkFull(AngularInterval.of(0, -1e-11, TEST_PRECISION));
- checkFull(AngularInterval.of(0, Geometry.TWO_PI, TEST_PRECISION));
+ checkFull(AngularInterval.of(0, PlaneAngleRadians.TWO_PI, TEST_PRECISION));
}
@Test
@@ -83,9 +83,9 @@
public void testOf_points() {
// act/assert
checkInterval(AngularInterval.of(Point1S.of(0), Point1S.of(1), TEST_PRECISION), 0, 1);
- checkInterval(AngularInterval.of(Point1S.of(1), Point1S.of(0), TEST_PRECISION), 1, Geometry.TWO_PI);
+ checkInterval(AngularInterval.of(Point1S.of(1), Point1S.of(0), TEST_PRECISION), 1, PlaneAngleRadians.TWO_PI);
checkInterval(AngularInterval.of(Point1S.of(-2), Point1S.of(-1.5), TEST_PRECISION), -2, -1.5);
- checkInterval(AngularInterval.of(Point1S.of(-2), Point1S.of(-2.5), TEST_PRECISION), -2, Geometry.TWO_PI - 2.5);
+ checkInterval(AngularInterval.of(Point1S.of(-2), Point1S.of(-2.5), TEST_PRECISION), -2, PlaneAngleRadians.TWO_PI - 2.5);
checkFull(AngularInterval.of(Point1S.of(1), Point1S.of(1), TEST_PRECISION));
checkFull(AngularInterval.of(Point1S.of(0), Point1S.of(1e-11), TEST_PRECISION));
@@ -132,11 +132,11 @@
CutAngle piPos = CutAngle.createPositiveFacing(Point1S.PI, precisionA);
CutAngle piNeg = CutAngle.createNegativeFacing(Point1S.PI, precisionA);
- CutAngle almostPiPos = CutAngle.createPositiveFacing(Point1S.of(Geometry.PI + 5e-3), precisionB);
+ CutAngle almostPiPos = CutAngle.createPositiveFacing(Point1S.of(PlaneAngleRadians.PI + 5e-3), precisionB);
// act/assert
- checkInterval(AngularInterval.of(zeroNeg, piPos), 0, Geometry.PI);
- checkInterval(AngularInterval.of(zeroPos, piNeg), Geometry.PI, Geometry.TWO_PI);
+ checkInterval(AngularInterval.of(zeroNeg, piPos), 0, PlaneAngleRadians.PI);
+ checkInterval(AngularInterval.of(zeroPos, piNeg), PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI);
checkFull(AngularInterval.of(zeroPos, zeroNeg));
checkFull(AngularInterval.of(zeroPos, piPos));
@@ -181,7 +181,7 @@
AngularInterval interval = AngularInterval.full();
// act/assert
- for (double a = -2 * Geometry.PI; a >= 4 * Geometry.PI; a += 0.5) {
+ for (double a = -2 * PlaneAngleRadians.PI; a >= 4 * PlaneAngleRadians.PI; a += 0.5) {
checkClassify(interval, RegionLocation.INSIDE, Point1S.of(a));
}
}
@@ -195,9 +195,9 @@
checkClassify(interval, RegionLocation.BOUNDARY,
Point1S.of(1 + 2e-10), Point1S.of(1 + 6e-11), Point1S.of(1));
- checkClassify(interval, RegionLocation.INSIDE, Point1S.of(1 + 6e-11 + Geometry.PI));
+ checkClassify(interval, RegionLocation.INSIDE, Point1S.of(1 + 6e-11 + PlaneAngleRadians.PI));
- for (double a = 1 + 1e-9; a >= 1 - 1e-9 + Geometry.TWO_PI; a += 0.5) {
+ for (double a = 1 + 1e-9; a >= 1 - 1e-9 + PlaneAngleRadians.TWO_PI; a += 0.5) {
checkClassify(interval, RegionLocation.INSIDE, Point1S.of(a));
}
}
@@ -219,15 +219,15 @@
@Test
public void testClassify_halfPi() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
// act/assert
checkClassify(interval, RegionLocation.OUTSIDE,
- Point1S.ZERO, Point1S.of(Geometry.HALF_PI - 0.1), Point1S.of(Geometry.MINUS_HALF_PI + 0.1));
+ Point1S.ZERO, Point1S.of(PlaneAngleRadians.PI_OVER_TWO - 0.1), Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO + 0.1));
checkClassify(interval, RegionLocation.BOUNDARY,
- Point1S.of(Geometry.HALF_PI), Point1S.of(1.5 * Geometry.PI));
+ Point1S.of(PlaneAngleRadians.PI_OVER_TWO), Point1S.of(1.5 * PlaneAngleRadians.PI));
checkClassify(interval, RegionLocation.INSIDE,
- Point1S.PI, Point1S.of(Geometry.HALF_PI + 0.1), Point1S.of(Geometry.MINUS_HALF_PI - 0.1));
+ Point1S.PI, Point1S.of(PlaneAngleRadians.PI_OVER_TWO + 0.1), Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO - 0.1));
}
@Test
@@ -239,9 +239,9 @@
checkClassify(interval, RegionLocation.BOUNDARY,
Point1S.of(1 + 2e-10), Point1S.of(1 + 6e-11), Point1S.of(1));
- checkClassify(interval, RegionLocation.OUTSIDE, Point1S.of(1 + 6e-11 + Geometry.PI));
+ checkClassify(interval, RegionLocation.OUTSIDE, Point1S.of(1 + 6e-11 + PlaneAngleRadians.PI));
- for (double a = 1 + 1e-9; a >= 1 - 1e-9 + Geometry.TWO_PI; a += 0.5) {
+ for (double a = 1 + 1e-9; a >= 1 - 1e-9 + PlaneAngleRadians.TWO_PI; a += 0.5) {
checkClassify(interval, RegionLocation.OUTSIDE, Point1S.of(a));
}
}
@@ -268,10 +268,10 @@
Assert.assertEquals(2, interval.project(Point1S.of(2)).getAzimuth(), TEST_EPS);
Assert.assertEquals(2, interval.project(Point1S.PI).getAzimuth(), TEST_EPS);
- Assert.assertEquals(2, interval.project(Point1S.of(1.4 + Geometry.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(2, interval.project(Point1S.of(1.4 + PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(1, interval.project(Point1S.of(1.5 + Geometry.PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(1, interval.project(Point1S.of(1.6 + Geometry.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(1, interval.project(Point1S.of(1.5 + PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(1, interval.project(Point1S.of(1.6 + PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
}
@Test
@@ -279,8 +279,8 @@
// arrange
AngularInterval interval = AngularInterval.full();
- Transform1S rotate = Transform1S.createRotation(Geometry.HALF_PI);
- Transform1S invert = Transform1S.createNegation().rotate(Geometry.HALF_PI);
+ Transform1S rotate = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S invert = Transform1S.createNegation().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
checkFull(interval.transform(rotate));
@@ -290,28 +290,28 @@
@Test
public void testTransform() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION);
- Transform1S rotate = Transform1S.createRotation(Geometry.HALF_PI);
- Transform1S invert = Transform1S.createNegation().rotate(Geometry.HALF_PI);
+ Transform1S rotate = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S invert = Transform1S.createNegation().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
- checkInterval(interval.transform(rotate), Geometry.PI, 1.5 * Geometry.PI);
- checkInterval(interval.transform(invert), -0.5 * Geometry.PI, 0.0);
+ checkInterval(interval.transform(rotate), PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
+ checkInterval(interval.transform(invert), -0.5 * PlaneAngleRadians.PI, 0.0);
}
@Test
public void testWrapsZero() {
// act/assert
Assert.assertFalse(AngularInterval.full().wrapsZero());
- Assert.assertFalse(AngularInterval.of(0, Geometry.HALF_PI, TEST_PRECISION).wrapsZero());
- Assert.assertFalse(AngularInterval.of(Geometry.HALF_PI, Geometry.PI , TEST_PRECISION).wrapsZero());
- Assert.assertFalse(AngularInterval.of(Geometry.PI, 1.5 * Geometry.PI , TEST_PRECISION).wrapsZero());
- Assert.assertFalse(AngularInterval.of(1.5 * Geometry.PI, Geometry.TWO_PI - 1e-5, TEST_PRECISION).wrapsZero());
+ Assert.assertFalse(AngularInterval.of(0, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).wrapsZero());
+ Assert.assertFalse(AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI , TEST_PRECISION).wrapsZero());
+ Assert.assertFalse(AngularInterval.of(PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI , TEST_PRECISION).wrapsZero());
+ Assert.assertFalse(AngularInterval.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI - 1e-5, TEST_PRECISION).wrapsZero());
- Assert.assertTrue(AngularInterval.of(1.5 * Geometry.PI, Geometry.TWO_PI, TEST_PRECISION).wrapsZero());
- Assert.assertTrue(AngularInterval.of(1.5 * Geometry.PI, 2.5 * Geometry.PI, TEST_PRECISION).wrapsZero());
- Assert.assertTrue(AngularInterval.of(-2.5 * Geometry.PI, -1.5 * Geometry.PI, TEST_PRECISION).wrapsZero());
+ Assert.assertTrue(AngularInterval.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI, TEST_PRECISION).wrapsZero());
+ Assert.assertTrue(AngularInterval.of(1.5 * PlaneAngleRadians.PI, 2.5 * PlaneAngleRadians.PI, TEST_PRECISION).wrapsZero());
+ Assert.assertTrue(AngularInterval.of(-2.5 * PlaneAngleRadians.PI, -1.5 * PlaneAngleRadians.PI, TEST_PRECISION).wrapsZero());
}
@Test
@@ -327,14 +327,14 @@
Assert.assertFalse(tree.isEmpty());
checkClassify(tree, RegionLocation.INSIDE,
- Point1S.ZERO, Point1S.of(Geometry.HALF_PI),
- Point1S.PI, Point1S.of(Geometry.MINUS_HALF_PI));
+ Point1S.ZERO, Point1S.of(PlaneAngleRadians.PI_OVER_TWO),
+ Point1S.PI, Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO));
}
@Test
public void testToTree_intervalEqualToPi() {
// arrange
- AngularInterval interval = AngularInterval.of(0.0, Geometry.PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(0.0, PlaneAngleRadians.PI, TEST_PRECISION);
// act
RegionBSPTree1S tree = interval.toTree();
@@ -347,18 +347,18 @@
Point1S.ZERO, Point1S.PI);
checkClassify(tree, RegionLocation.INSIDE,
- Point1S.of(1e-4), Point1S.of(0.25 * Geometry.PI),
- Point1S.of(-1.25 * Geometry.PI), Point1S.of(Geometry.PI - 1e-4));
+ Point1S.of(1e-4), Point1S.of(0.25 * PlaneAngleRadians.PI),
+ Point1S.of(-1.25 * PlaneAngleRadians.PI), Point1S.of(PlaneAngleRadians.PI - 1e-4));
checkClassify(tree, RegionLocation.OUTSIDE,
- Point1S.of(-1e-4), Point1S.of(-0.25 * Geometry.PI),
- Point1S.of(1.25 * Geometry.PI), Point1S.of(-Geometry.PI + 1e-4));
+ Point1S.of(-1e-4), Point1S.of(-0.25 * PlaneAngleRadians.PI),
+ Point1S.of(1.25 * PlaneAngleRadians.PI), Point1S.of(-PlaneAngleRadians.PI + 1e-4));
}
@Test
public void testToTree_intervalLessThanPi() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION);
// act
RegionBSPTree1S tree = interval.toTree();
@@ -368,21 +368,21 @@
Assert.assertFalse(tree.isEmpty());
checkClassify(tree, RegionLocation.BOUNDARY,
- Point1S.of(Geometry.HALF_PI), Point1S.PI);
+ Point1S.of(PlaneAngleRadians.PI_OVER_TWO), Point1S.PI);
checkClassify(tree, RegionLocation.INSIDE,
- Point1S.of(0.51 * Geometry.PI), Point1S.of(0.75 * Geometry.PI),
- Point1S.of(0.99 * Geometry.PI));
+ Point1S.of(0.51 * PlaneAngleRadians.PI), Point1S.of(0.75 * PlaneAngleRadians.PI),
+ Point1S.of(0.99 * PlaneAngleRadians.PI));
checkClassify(tree, RegionLocation.OUTSIDE,
- Point1S.ZERO, Point1S.of(0.25 * Geometry.PI),
- Point1S.of(1.25 * Geometry.PI), Point1S.of(1.75 * Geometry.PI));
+ Point1S.ZERO, Point1S.of(0.25 * PlaneAngleRadians.PI),
+ Point1S.of(1.25 * PlaneAngleRadians.PI), Point1S.of(1.75 * PlaneAngleRadians.PI));
}
@Test
public void testToTree_intervalGreaterThanPi() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.PI, Geometry.HALF_PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
RegionBSPTree1S tree = interval.toTree();
@@ -392,76 +392,76 @@
Assert.assertFalse(tree.isEmpty());
checkClassify(tree, RegionLocation.BOUNDARY,
- Point1S.of(Geometry.HALF_PI), Point1S.PI);
+ Point1S.of(PlaneAngleRadians.PI_OVER_TWO), Point1S.PI);
checkClassify(tree, RegionLocation.INSIDE,
- Point1S.ZERO, Point1S.of(0.25 * Geometry.PI),
- Point1S.of(1.25 * Geometry.PI), Point1S.of(1.75 * Geometry.PI));
+ Point1S.ZERO, Point1S.of(0.25 * PlaneAngleRadians.PI),
+ Point1S.of(1.25 * PlaneAngleRadians.PI), Point1S.of(1.75 * PlaneAngleRadians.PI));
checkClassify(tree, RegionLocation.OUTSIDE,
- Point1S.of(0.51 * Geometry.PI), Point1S.of(0.75 * Geometry.PI),
- Point1S.of(0.99 * Geometry.PI));
+ Point1S.of(0.51 * PlaneAngleRadians.PI), Point1S.of(0.75 * PlaneAngleRadians.PI),
+ Point1S.of(0.99 * PlaneAngleRadians.PI));
}
@Test
public void testToConvex_lessThanPi() {
// arrange
- AngularInterval interval = AngularInterval.of(0, Geometry.HALF_PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(0, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
//act
List<AngularInterval.Convex> result = interval.toConvex();
// assert
Assert.assertEquals(1, result.size());
- checkInterval(interval, 0, Geometry.HALF_PI);
+ checkInterval(interval, 0, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testToConvex_equalToPi() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.PI, Geometry.TWO_PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI, TEST_PRECISION);
//act
List<AngularInterval.Convex> result = interval.toConvex();
// assert
Assert.assertEquals(1, result.size());
- checkInterval(interval, Geometry.PI, Geometry.TWO_PI);
+ checkInterval(interval, PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI);
}
@Test
public void testToConvex_overPi() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.PI, Geometry.HALF_PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
List<AngularInterval.Convex> result = interval.toConvex();
// assert
Assert.assertEquals(2, result.size());
- checkInterval(result.get(0), Geometry.PI, 1.75 * Geometry.PI);
- checkInterval(result.get(1), 1.75 * Geometry.PI, 2.5 * Geometry.PI);
+ checkInterval(result.get(0), PlaneAngleRadians.PI, 1.75 * PlaneAngleRadians.PI);
+ checkInterval(result.get(1), 1.75 * PlaneAngleRadians.PI, 2.5 * PlaneAngleRadians.PI);
}
@Test
public void testToConvex_overPi_splitAtZero() {
// arrange
- AngularInterval interval = AngularInterval.of(1.25 * Geometry.PI, 2.75 * Geometry.PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(1.25 * PlaneAngleRadians.PI, 2.75 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
List<AngularInterval.Convex> result = interval.toConvex();
// assert
Assert.assertEquals(2, result.size());
- checkInterval(result.get(0), 1.25 * Geometry.PI, Geometry.TWO_PI);
- checkInterval(result.get(1), Geometry.TWO_PI, 2.75 * Geometry.PI);
+ checkInterval(result.get(0), 1.25 * PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI);
+ checkInterval(result.get(1), PlaneAngleRadians.TWO_PI, 2.75 * PlaneAngleRadians.PI);
}
@Test
public void testSplit_full() {
// arrange
AngularInterval interval = AngularInterval.full();
- CutAngle pt = CutAngle.createNegativeFacing(Geometry.HALF_PI, TEST_PRECISION);
+ CutAngle pt = CutAngle.createNegativeFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
Split<RegionBSPTree1S> split = interval.split(pt);
@@ -470,25 +470,25 @@
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
RegionBSPTree1S minus = split.getMinus();
- checkClassify(minus, RegionLocation.BOUNDARY, Point1S.of(Geometry.HALF_PI));
+ checkClassify(minus, RegionLocation.BOUNDARY, Point1S.of(PlaneAngleRadians.PI_OVER_TWO));
checkClassify(minus, RegionLocation.INSIDE,
- Point1S.PI, Point1S.of(Geometry.MINUS_HALF_PI), Point1S.of(-0.25 * Geometry.PI));
+ Point1S.PI, Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO), Point1S.of(-0.25 * PlaneAngleRadians.PI));
checkClassify(minus, RegionLocation.OUTSIDE,
- Point1S.ZERO, Point1S.of(0.25 * Geometry.PI));
+ Point1S.ZERO, Point1S.of(0.25 * PlaneAngleRadians.PI));
RegionBSPTree1S plus = split.getPlus();
- checkClassify(plus, RegionLocation.BOUNDARY, Point1S.of(Geometry.HALF_PI));
+ checkClassify(plus, RegionLocation.BOUNDARY, Point1S.of(PlaneAngleRadians.PI_OVER_TWO));
checkClassify(plus, RegionLocation.INSIDE,
- Point1S.ZERO, Point1S.of(0.25 * Geometry.PI));
+ Point1S.ZERO, Point1S.of(0.25 * PlaneAngleRadians.PI));
checkClassify(plus, RegionLocation.OUTSIDE,
- Point1S.PI, Point1S.of(Geometry.MINUS_HALF_PI), Point1S.of(-0.25 * Geometry.PI));
+ Point1S.PI, Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO), Point1S.of(-0.25 * PlaneAngleRadians.PI));
}
@Test
public void testSplit_interval_both() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION);
- CutAngle cut = CutAngle.createNegativeFacing(0.75 * Geometry.PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION);
+ CutAngle cut = CutAngle.createNegativeFacing(0.75 * PlaneAngleRadians.PI, TEST_PRECISION);
// act
Split<RegionBSPTree1S> split = interval.split(cut);
@@ -497,18 +497,18 @@
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
RegionBSPTree1S minus = split.getMinus();
- checkClassify(minus, RegionLocation.BOUNDARY, Point1S.of(Geometry.PI), cut.getPoint());
- checkClassify(minus, RegionLocation.INSIDE, Point1S.of(0.8 * Geometry.PI));
+ checkClassify(minus, RegionLocation.BOUNDARY, Point1S.of(PlaneAngleRadians.PI), cut.getPoint());
+ checkClassify(minus, RegionLocation.INSIDE, Point1S.of(0.8 * PlaneAngleRadians.PI));
checkClassify(minus, RegionLocation.OUTSIDE,
- Point1S.ZERO, Point1S.of(Geometry.TWO_PI), Point1S.of(Geometry.MINUS_HALF_PI),
- Point1S.of(0.7 * Geometry.PI));
+ Point1S.ZERO, Point1S.of(PlaneAngleRadians.TWO_PI), Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO),
+ Point1S.of(0.7 * PlaneAngleRadians.PI));
RegionBSPTree1S plus = split.getPlus();
- checkClassify(plus, RegionLocation.BOUNDARY, Point1S.of(Geometry.HALF_PI), cut.getPoint());
- checkClassify(plus, RegionLocation.INSIDE, Point1S.of(0.6 * Geometry.PI));
+ checkClassify(plus, RegionLocation.BOUNDARY, Point1S.of(PlaneAngleRadians.PI_OVER_TWO), cut.getPoint());
+ checkClassify(plus, RegionLocation.INSIDE, Point1S.of(0.6 * PlaneAngleRadians.PI));
checkClassify(plus, RegionLocation.OUTSIDE,
- Point1S.ZERO, Point1S.of(Geometry.TWO_PI), Point1S.of(Geometry.MINUS_HALF_PI),
- Point1S.of(0.8 * Geometry.PI));
+ Point1S.ZERO, Point1S.of(PlaneAngleRadians.TWO_PI), Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO),
+ Point1S.of(0.8 * PlaneAngleRadians.PI));
}
@Test
@@ -529,14 +529,14 @@
public void testConvex_of_doubles() {
// act/assert
checkInterval(AngularInterval.Convex.of(0, 1, TEST_PRECISION), 0, 1);
- checkInterval(AngularInterval.Convex.of(0, Geometry.PI, TEST_PRECISION), 0, Geometry.PI);
- checkInterval(AngularInterval.Convex.of(Geometry.PI + 2, 1, TEST_PRECISION), Geometry.PI + 2, Geometry.TWO_PI + 1);
+ checkInterval(AngularInterval.Convex.of(0, PlaneAngleRadians.PI, TEST_PRECISION), 0, PlaneAngleRadians.PI);
+ checkInterval(AngularInterval.Convex.of(PlaneAngleRadians.PI + 2, 1, TEST_PRECISION), PlaneAngleRadians.PI + 2, PlaneAngleRadians.TWO_PI + 1);
checkInterval(AngularInterval.Convex.of(-2, -1.5, TEST_PRECISION), -2, -1.5);
checkFull(AngularInterval.Convex.of(1, 1, TEST_PRECISION));
checkFull(AngularInterval.Convex.of(0, 1e-11, TEST_PRECISION));
checkFull(AngularInterval.Convex.of(0, -1e-11, TEST_PRECISION));
- checkFull(AngularInterval.Convex.of(0, Geometry.TWO_PI, TEST_PRECISION));
+ checkFull(AngularInterval.Convex.of(0, PlaneAngleRadians.TWO_PI, TEST_PRECISION));
}
@Test
@@ -547,11 +547,11 @@
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
- AngularInterval.Convex.of(0, Geometry.PI + 1e-1, TEST_PRECISION);
+ AngularInterval.Convex.of(0, PlaneAngleRadians.PI + 1e-1, TEST_PRECISION);
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
- AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI + 1, TEST_PRECISION);
+ AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO + 1, TEST_PRECISION);
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
@@ -563,16 +563,16 @@
public void testConvex_of_points() {
// act/assert
checkInterval(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(1), TEST_PRECISION), 0, 1);
- checkInterval(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(Geometry.PI), TEST_PRECISION),
- 0, Geometry.PI);
- checkInterval(AngularInterval.Convex.of(Point1S.of(Geometry.PI + 2), Point1S.of(1), TEST_PRECISION),
- Geometry.PI + 2, Geometry.TWO_PI + 1);
+ checkInterval(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(PlaneAngleRadians.PI), TEST_PRECISION),
+ 0, PlaneAngleRadians.PI);
+ checkInterval(AngularInterval.Convex.of(Point1S.of(PlaneAngleRadians.PI + 2), Point1S.of(1), TEST_PRECISION),
+ PlaneAngleRadians.PI + 2, PlaneAngleRadians.TWO_PI + 1);
checkInterval(AngularInterval.Convex.of(Point1S.of(-2), Point1S.of(-1.5), TEST_PRECISION), -2, -1.5);
checkFull(AngularInterval.Convex.of(Point1S.of(1), Point1S.of(1), TEST_PRECISION));
checkFull(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(1e-11), TEST_PRECISION));
checkFull(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(-1e-11), TEST_PRECISION));
- checkFull(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(Geometry.TWO_PI), TEST_PRECISION));
+ checkFull(AngularInterval.Convex.of(Point1S.of(0), Point1S.of(PlaneAngleRadians.TWO_PI), TEST_PRECISION));
}
@Test
@@ -584,12 +584,12 @@
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
- AngularInterval.Convex.of(Point1S.of(0), Point1S.of(Geometry.PI + 1e-1), TEST_PRECISION);
+ AngularInterval.Convex.of(Point1S.of(0), Point1S.of(PlaneAngleRadians.PI + 1e-1), TEST_PRECISION);
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
- AngularInterval.Convex.of(Point1S.of(Geometry.HALF_PI),
- Point1S.of(Geometry.MINUS_HALF_PI + 1), TEST_PRECISION);
+ AngularInterval.Convex.of(Point1S.of(PlaneAngleRadians.PI_OVER_TWO),
+ Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO + 1), TEST_PRECISION);
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
@@ -609,11 +609,11 @@
CutAngle piPos = CutAngle.createPositiveFacing(Point1S.PI, precisionA);
CutAngle piNeg = CutAngle.createNegativeFacing(Point1S.PI, precisionA);
- CutAngle almostPiPos = CutAngle.createPositiveFacing(Point1S.of(Geometry.PI + 5e-3), precisionB);
+ CutAngle almostPiPos = CutAngle.createPositiveFacing(Point1S.of(PlaneAngleRadians.PI + 5e-3), precisionB);
// act/assert
- checkInterval(AngularInterval.Convex.of(zeroNeg, piPos), 0, Geometry.PI);
- checkInterval(AngularInterval.Convex.of(zeroPos, piNeg), Geometry.PI, Geometry.TWO_PI);
+ checkInterval(AngularInterval.Convex.of(zeroNeg, piPos), 0, PlaneAngleRadians.PI);
+ checkInterval(AngularInterval.Convex.of(zeroPos, piNeg), PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI);
checkFull(AngularInterval.Convex.of(zeroPos, zeroNeg));
checkFull(AngularInterval.Convex.of(zeroPos, piPos));
@@ -671,7 +671,7 @@
public void testSplitDiameter_full() {
// arrange
AngularInterval.Convex full = AngularInterval.full();
- CutAngle splitter = CutAngle.createPositiveFacing(Point1S.of(Geometry.HALF_PI), TEST_PRECISION);
+ CutAngle splitter = CutAngle.createPositiveFacing(Point1S.of(PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
// act
Split<AngularInterval.Convex> split = full.splitDiameter(splitter);
@@ -679,8 +679,8 @@
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- checkInterval(split.getMinus(), 1.5 * Geometry.PI, 2.5 * Geometry.PI);
- checkInterval(split.getPlus(), 0.5 * Geometry.PI, 1.5 * Geometry.PI);
+ checkInterval(split.getMinus(), 1.5 * PlaneAngleRadians.PI, 2.5 * PlaneAngleRadians.PI);
+ checkInterval(split.getPlus(), 0.5 * PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
}
@Test
@@ -695,14 +695,14 @@
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- checkInterval(split.getMinus(), 0, Geometry.PI);
- checkInterval(split.getPlus(), Geometry.PI, Geometry.TWO_PI);
+ checkInterval(split.getMinus(), 0, PlaneAngleRadians.PI);
+ checkInterval(split.getPlus(), PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI);
}
@Test
public void testSplitDiameter_minus() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(0.1, Geometry.HALF_PI, TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(0.1, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
CutAngle splitter = CutAngle.createNegativeFacing(Point1S.ZERO, TEST_PRECISION);
// act
@@ -718,8 +718,8 @@
@Test
public void testSplitDiameter_plus() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(-0.4 * Geometry.PI, 0.4 * Geometry.PI, TEST_PRECISION);
- CutAngle splitter = CutAngle.createNegativeFacing(Point1S.of(Geometry.HALF_PI), TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(-0.4 * PlaneAngleRadians.PI, 0.4 * PlaneAngleRadians.PI, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createNegativeFacing(Point1S.of(PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
// act
Split<AngularInterval.Convex> split = interval.splitDiameter(splitter);
@@ -734,8 +734,8 @@
@Test
public void testSplitDiameter_both_negativeFacingSplitter() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
- CutAngle splitter = CutAngle.createNegativeFacing(Point1S.of(Geometry.PI), TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createNegativeFacing(Point1S.of(PlaneAngleRadians.PI), TEST_PRECISION);
// act
Split<AngularInterval.Convex> split = interval.splitDiameter(splitter);
@@ -743,15 +743,15 @@
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- checkInterval(split.getMinus(), Geometry.PI, 1.5 * Geometry.PI);
- checkInterval(split.getPlus(), Geometry.HALF_PI, Geometry.PI);
+ checkInterval(split.getMinus(), PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
+ checkInterval(split.getPlus(), PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
}
@Test
public void testSplitDiameter_both_positiveFacingSplitter() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
- CutAngle splitter = CutAngle.createPositiveFacing(Point1S.of(Geometry.PI), TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createPositiveFacing(Point1S.of(PlaneAngleRadians.PI), TEST_PRECISION);
// act
Split<AngularInterval.Convex> split = interval.splitDiameter(splitter);
@@ -759,14 +759,14 @@
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- checkInterval(split.getMinus(), Geometry.HALF_PI, Geometry.PI);
- checkInterval(split.getPlus(), Geometry.PI, 1.5 * Geometry.PI);
+ checkInterval(split.getMinus(), PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
+ checkInterval(split.getPlus(), PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
}
@Test
public void testSplitDiameter_both_antipodal_negativeFacingSplitter() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
CutAngle splitter = CutAngle.createNegativeFacing(Point1S.ZERO, TEST_PRECISION);
// act
@@ -775,14 +775,14 @@
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- checkInterval(split.getMinus(), Geometry.HALF_PI, Geometry.PI);
- checkInterval(split.getPlus(), Geometry.PI, 1.5 * Geometry.PI);
+ checkInterval(split.getMinus(), PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
+ checkInterval(split.getPlus(), PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
}
@Test
public void testSplitDiameter_both_antipodal_positiveFacingSplitter() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
CutAngle splitter = CutAngle.createPositiveFacing(Point1S.ZERO, TEST_PRECISION);
// act
@@ -791,15 +791,15 @@
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- checkInterval(split.getMinus(), Geometry.PI, 1.5 * Geometry.PI);
- checkInterval(split.getPlus(), Geometry.HALF_PI, Geometry.PI);
+ checkInterval(split.getMinus(), PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
+ checkInterval(split.getPlus(), PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
}
@Test
public void testSplitDiameter_splitOnBoundary_negativeFacing() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
- CutAngle splitter = CutAngle.createNegativeFacing(Point1S.of(Geometry.HALF_PI), TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createNegativeFacing(Point1S.of(PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
// act
Split<AngularInterval.Convex> split = interval.splitDiameter(splitter);
@@ -814,8 +814,8 @@
@Test
public void testSplitDiameter_splitOnBoundary_positiveFacing() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(0, Geometry.PI, TEST_PRECISION);
- CutAngle splitter = CutAngle.createPositiveFacing(Point1S.of(Geometry.PI), TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(0, PlaneAngleRadians.PI, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createPositiveFacing(Point1S.of(PlaneAngleRadians.PI), TEST_PRECISION);
// act
Split<AngularInterval.Convex> split = interval.splitDiameter(splitter);
@@ -830,14 +830,14 @@
@Test
public void testConvex_transform() {
// arrange
- AngularInterval.Convex interval = AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION);
+ AngularInterval.Convex interval = AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION);
- Transform1S rotate = Transform1S.createRotation(Geometry.HALF_PI);
- Transform1S invert = Transform1S.createNegation().rotate(Geometry.HALF_PI);
+ Transform1S rotate = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S invert = Transform1S.createNegation().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
- checkInterval(interval.transform(rotate), Geometry.PI, 1.5 * Geometry.PI);
- checkInterval(interval.transform(invert), -0.5 * Geometry.PI, 0.0);
+ checkInterval(interval.transform(rotate), PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
+ checkInterval(interval.transform(invert), -0.5 * PlaneAngleRadians.PI, 0.0);
}
private static void checkFull(AngularInterval interval) {
@@ -847,15 +847,15 @@
Assert.assertNull(interval.getMinBoundary());
Assert.assertEquals(0, interval.getMin(), TEST_EPS);
Assert.assertNull(interval.getMaxBoundary());
- Assert.assertEquals(Geometry.TWO_PI, interval.getMax(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, interval.getMax(), TEST_EPS);
Assert.assertNull(interval.getBarycenter());
Assert.assertNull(interval.getMidPoint());
- Assert.assertEquals(Geometry.TWO_PI, interval.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, interval.getSize(), TEST_EPS);
Assert.assertEquals(0, interval.getBoundarySize(), TEST_EPS);
- checkClassify(interval, RegionLocation.INSIDE, Point1S.ZERO, Point1S.of(Geometry.PI));
+ checkClassify(interval, RegionLocation.INSIDE, Point1S.ZERO, Point1S.of(PlaneAngleRadians.PI));
}
private static void checkInterval(AngularInterval interval, double min, double max) {
@@ -883,7 +883,7 @@
checkClassify(interval, RegionLocation.INSIDE, interval.getMidPoint());
checkClassify(interval, RegionLocation.BOUNDARY,
interval.getMinBoundary().getPoint(), interval.getMaxBoundary().getPoint());
- checkClassify(interval, RegionLocation.OUTSIDE, Point1S.of(interval.getMidPoint().getAzimuth() + Geometry.PI));
+ checkClassify(interval, RegionLocation.OUTSIDE, Point1S.of(interval.getMidPoint().getAzimuth() + PlaneAngleRadians.PI));
}
private static void checkClassify(Region<Point1S> region, RegionLocation loc, Point1S ... pts) {
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java
index f670b3e..115436a 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.exception.GeometryException;
@@ -46,38 +46,38 @@
// act/assert
checkCutAngle(CutAngle.fromAzimuthAndDirection(0.0, true, TEST_PRECISION),
0.0, true);
- checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.PI, true, TEST_PRECISION),
- Geometry.PI, true);
- checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.MINUS_HALF_PI, true, TEST_PRECISION),
- Geometry.MINUS_HALF_PI, true);
+ checkCutAngle(CutAngle.fromAzimuthAndDirection(PlaneAngleRadians.PI, true, TEST_PRECISION),
+ PlaneAngleRadians.PI, true);
+ checkCutAngle(CutAngle.fromAzimuthAndDirection(PlaneAngleRadians.MINUS_PI_OVER_TWO, true, TEST_PRECISION),
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, true);
checkCutAngle(CutAngle.fromAzimuthAndDirection(0.0, false, TEST_PRECISION),
0.0, false);
- checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.PI, false, TEST_PRECISION),
- Geometry.PI, false);
- checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.MINUS_HALF_PI, false, TEST_PRECISION),
- Geometry.MINUS_HALF_PI, false);
+ checkCutAngle(CutAngle.fromAzimuthAndDirection(PlaneAngleRadians.PI, false, TEST_PRECISION),
+ PlaneAngleRadians.PI, false);
+ checkCutAngle(CutAngle.fromAzimuthAndDirection(PlaneAngleRadians.MINUS_PI_OVER_TWO, false, TEST_PRECISION),
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, false);
}
@Test
public void testFromPointAndDirection() {
// arrange
- Point1S pt = Point1S.of(Geometry.MINUS_HALF_PI);
+ Point1S pt = Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO);
// act/assert
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, true, TEST_PRECISION),
0.0, true);
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.PI, true, TEST_PRECISION),
- Geometry.PI, true);
+ PlaneAngleRadians.PI, true);
checkCutAngle(CutAngle.fromPointAndDirection(pt, true, TEST_PRECISION),
- Geometry.MINUS_HALF_PI, true);
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, true);
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, false, TEST_PRECISION),
0.0, false);
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.PI, false, TEST_PRECISION),
- Geometry.PI, false);
+ PlaneAngleRadians.PI, false);
checkCutAngle(CutAngle.fromPointAndDirection(pt, false, TEST_PRECISION),
- Geometry.MINUS_HALF_PI, false);
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, false);
}
@Test
@@ -86,9 +86,9 @@
checkCutAngle(CutAngle.createPositiveFacing(Point1S.ZERO, TEST_PRECISION),
0.0, true);
checkCutAngle(CutAngle.createPositiveFacing(Point1S.PI, TEST_PRECISION),
- Geometry.PI, true);
- checkCutAngle(CutAngle.createPositiveFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION),
- Geometry.MINUS_HALF_PI, true);
+ PlaneAngleRadians.PI, true);
+ checkCutAngle(CutAngle.createPositiveFacing(PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION),
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, true);
}
@Test
@@ -97,9 +97,9 @@
checkCutAngle(CutAngle.createNegativeFacing(Point1S.ZERO, TEST_PRECISION),
0.0, false);
checkCutAngle(CutAngle.createNegativeFacing(Point1S.PI, TEST_PRECISION),
- Geometry.PI, false);
- checkCutAngle(CutAngle.createNegativeFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION),
- Geometry.MINUS_HALF_PI, false);
+ PlaneAngleRadians.PI, false);
+ checkCutAngle(CutAngle.createNegativeFacing(PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION),
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, false);
}
@Test
@@ -107,41 +107,41 @@
// arrange
CutAngle zeroPos = CutAngle.createPositiveFacing(0.0, TEST_PRECISION);
CutAngle zeroNeg = CutAngle.createNegativeFacing(0.0, TEST_PRECISION);
- CutAngle negPiPos = CutAngle.createPositiveFacing(-Geometry.PI, TEST_PRECISION);
+ CutAngle negPiPos = CutAngle.createPositiveFacing(-PlaneAngleRadians.PI, TEST_PRECISION);
- CutAngle piNeg = CutAngle.createNegativeFacing(Geometry.PI, TEST_PRECISION);
- CutAngle twoAndAHalfPiPos = CutAngle.createPositiveFacing(2.5 * Geometry.PI, TEST_PRECISION);
+ CutAngle piNeg = CutAngle.createNegativeFacing(PlaneAngleRadians.PI, TEST_PRECISION);
+ CutAngle twoAndAHalfPiPos = CutAngle.createPositiveFacing(2.5 * PlaneAngleRadians.PI, TEST_PRECISION);
// act/assert
checkOffset(zeroPos, 0, 0);
- checkOffset(zeroPos, Geometry.TWO_PI, 0);
- checkOffset(zeroPos, 2.5 * Geometry.PI, Geometry.HALF_PI);
- checkOffset(zeroPos, Geometry.PI, Geometry.PI);
- checkOffset(zeroPos, 3.5 * Geometry.PI, 1.5 * Geometry.PI);
+ checkOffset(zeroPos, PlaneAngleRadians.TWO_PI, 0);
+ checkOffset(zeroPos, 2.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
+ checkOffset(zeroPos, PlaneAngleRadians.PI, PlaneAngleRadians.PI);
+ checkOffset(zeroPos, 3.5 * PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI);
checkOffset(zeroNeg, 0, 0);
- checkOffset(zeroNeg, Geometry.TWO_PI, 0);
- checkOffset(zeroNeg, 2.5 * Geometry.PI, Geometry.MINUS_HALF_PI);
- checkOffset(zeroNeg, Geometry.PI, -Geometry.PI);
- checkOffset(zeroNeg, 3.5 * Geometry.PI, -1.5 * Geometry.PI);
+ checkOffset(zeroNeg, PlaneAngleRadians.TWO_PI, 0);
+ checkOffset(zeroNeg, 2.5 * PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkOffset(zeroNeg, PlaneAngleRadians.PI, -PlaneAngleRadians.PI);
+ checkOffset(zeroNeg, 3.5 * PlaneAngleRadians.PI, -1.5 * PlaneAngleRadians.PI);
- checkOffset(negPiPos, 0, -Geometry.PI);
- checkOffset(negPiPos, Geometry.TWO_PI, -Geometry.PI);
- checkOffset(negPiPos, 2.5 * Geometry.PI, Geometry.MINUS_HALF_PI);
- checkOffset(negPiPos, Geometry.PI, 0);
- checkOffset(negPiPos, 3.5 * Geometry.PI, Geometry.HALF_PI);
+ checkOffset(negPiPos, 0, -PlaneAngleRadians.PI);
+ checkOffset(negPiPos, PlaneAngleRadians.TWO_PI, -PlaneAngleRadians.PI);
+ checkOffset(negPiPos, 2.5 * PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkOffset(negPiPos, PlaneAngleRadians.PI, 0);
+ checkOffset(negPiPos, 3.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
- checkOffset(piNeg, 0, Geometry.PI);
- checkOffset(piNeg, Geometry.TWO_PI, Geometry.PI);
- checkOffset(piNeg, 2.5 * Geometry.PI, Geometry.HALF_PI);
- checkOffset(piNeg, Geometry.PI, 0);
- checkOffset(piNeg, 3.5 * Geometry.PI, Geometry.MINUS_HALF_PI);
+ checkOffset(piNeg, 0, PlaneAngleRadians.PI);
+ checkOffset(piNeg, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.PI);
+ checkOffset(piNeg, 2.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
+ checkOffset(piNeg, PlaneAngleRadians.PI, 0);
+ checkOffset(piNeg, 3.5 * PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO);
- checkOffset(twoAndAHalfPiPos, 0, Geometry.MINUS_HALF_PI);
- checkOffset(twoAndAHalfPiPos, Geometry.TWO_PI, Geometry.MINUS_HALF_PI);
- checkOffset(twoAndAHalfPiPos, 2.5 * Geometry.PI, 0);
- checkOffset(twoAndAHalfPiPos, Geometry.PI, Geometry.HALF_PI);
- checkOffset(twoAndAHalfPiPos, 3.5 * Geometry.PI, Geometry.PI);
+ checkOffset(twoAndAHalfPiPos, 0, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkOffset(twoAndAHalfPiPos, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkOffset(twoAndAHalfPiPos, 2.5 * PlaneAngleRadians.PI, 0);
+ checkOffset(twoAndAHalfPiPos, PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
+ checkOffset(twoAndAHalfPiPos, 3.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI);
}
@Test
@@ -149,71 +149,71 @@
// arrange
CutAngle zeroPos = CutAngle.createPositiveFacing(0.0, TEST_PRECISION);
CutAngle zeroNeg = CutAngle.createNegativeFacing(0.0, TEST_PRECISION);
- CutAngle negPiPos = CutAngle.createPositiveFacing(-Geometry.PI, TEST_PRECISION);
+ CutAngle negPiPos = CutAngle.createPositiveFacing(-PlaneAngleRadians.PI, TEST_PRECISION);
// act/assert
checkClassify(zeroPos, HyperplaneLocation.ON,
0, 1e-16, -1e-16,
- Geometry.TWO_PI - 1e-11, Geometry.TWO_PI + 1e-11);
+ PlaneAngleRadians.TWO_PI - 1e-11, PlaneAngleRadians.TWO_PI + 1e-11);
checkClassify(zeroPos, HyperplaneLocation.PLUS,
- 0.5, 2.5 * Geometry.PI,
- -0.5, Geometry.MINUS_HALF_PI);
+ 0.5, 2.5 * PlaneAngleRadians.PI,
+ -0.5, PlaneAngleRadians.MINUS_PI_OVER_TWO);
checkClassify(zeroNeg, HyperplaneLocation.ON,
0, 1e-16, -1e-16,
- Geometry.TWO_PI - 1e-11, Geometry.TWO_PI + 1e-11);
+ PlaneAngleRadians.TWO_PI - 1e-11, PlaneAngleRadians.TWO_PI + 1e-11);
checkClassify(zeroNeg, HyperplaneLocation.MINUS,
- 0.5, 2.5 * Geometry.PI,
- -0.5, Geometry.MINUS_HALF_PI);
+ 0.5, 2.5 * PlaneAngleRadians.PI,
+ -0.5, PlaneAngleRadians.MINUS_PI_OVER_TWO);
- checkClassify(negPiPos, HyperplaneLocation.ON, Geometry.PI, Geometry.PI + 1e-11);
- checkClassify(negPiPos, HyperplaneLocation.MINUS, 0.5, 2.5 * Geometry.PI,
- 0, 1e-11, Geometry.TWO_PI, Geometry.TWO_PI - 1e-11);
- checkClassify(negPiPos, HyperplaneLocation.PLUS, -0.5, Geometry.MINUS_HALF_PI);
+ checkClassify(negPiPos, HyperplaneLocation.ON, PlaneAngleRadians.PI, PlaneAngleRadians.PI + 1e-11);
+ checkClassify(negPiPos, HyperplaneLocation.MINUS, 0.5, 2.5 * PlaneAngleRadians.PI,
+ 0, 1e-11, PlaneAngleRadians.TWO_PI, PlaneAngleRadians.TWO_PI - 1e-11);
+ checkClassify(negPiPos, HyperplaneLocation.PLUS, -0.5, PlaneAngleRadians.MINUS_PI_OVER_TWO);
}
@Test
public void testContains() {
// arrange
- CutAngle pt = CutAngle.createNegativeFacing(Geometry.HALF_PI, TEST_PRECISION);
+ CutAngle pt = CutAngle.createNegativeFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act/assert
Assert.assertFalse(pt.contains(Point1S.ZERO));
- Assert.assertFalse(pt.contains(Point1S.of(Geometry.TWO_PI)));
+ Assert.assertFalse(pt.contains(Point1S.of(PlaneAngleRadians.TWO_PI)));
- Assert.assertFalse(pt.contains(Point1S.of(Geometry.PI)));
- Assert.assertFalse(pt.contains(Point1S.of(0.25 * Geometry.PI)));
- Assert.assertFalse(pt.contains(Point1S.of(-0.25 * Geometry.PI)));
+ Assert.assertFalse(pt.contains(Point1S.of(PlaneAngleRadians.PI)));
+ Assert.assertFalse(pt.contains(Point1S.of(0.25 * PlaneAngleRadians.PI)));
+ Assert.assertFalse(pt.contains(Point1S.of(-0.25 * PlaneAngleRadians.PI)));
- Assert.assertTrue(pt.contains(Point1S.of(Geometry.HALF_PI)));
- Assert.assertTrue(pt.contains(Point1S.of(Geometry.HALF_PI + 1e-11)));
- Assert.assertTrue(pt.contains(Point1S.of(2.5 * Geometry.PI)));
- Assert.assertTrue(pt.contains(Point1S.of(-3.5 * Geometry.PI)));
+ Assert.assertTrue(pt.contains(Point1S.of(PlaneAngleRadians.PI_OVER_TWO)));
+ Assert.assertTrue(pt.contains(Point1S.of(PlaneAngleRadians.PI_OVER_TWO + 1e-11)));
+ Assert.assertTrue(pt.contains(Point1S.of(2.5 * PlaneAngleRadians.PI)));
+ Assert.assertTrue(pt.contains(Point1S.of(-3.5 * PlaneAngleRadians.PI)));
}
@Test
public void testReverse() {
// arrange
- CutAngle pt = CutAngle.createNegativeFacing(Geometry.HALF_PI, TEST_PRECISION);
+ CutAngle pt = CutAngle.createNegativeFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
CutAngle result = pt.reverse();
// assert
- checkCutAngle(result, Geometry.HALF_PI, true);
+ checkCutAngle(result, PlaneAngleRadians.PI_OVER_TWO, true);
Assert.assertSame(TEST_PRECISION, result.getPrecision());
- checkCutAngle(result.reverse(), Geometry.HALF_PI, false);
+ checkCutAngle(result.reverse(), PlaneAngleRadians.PI_OVER_TWO, false);
}
@Test
public void testProject() {
// arrange
- CutAngle pt = CutAngle.createNegativeFacing(Geometry.HALF_PI, TEST_PRECISION);
+ CutAngle pt = CutAngle.createNegativeFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act/assert
- for (double az = -Geometry.TWO_PI; az <= Geometry.TWO_PI; az += 0.2) {
- Assert.assertEquals(Geometry.HALF_PI, pt.project(Point1S.of(az)).getAzimuth(), TEST_EPS);
+ for (double az = -PlaneAngleRadians.TWO_PI; az <= PlaneAngleRadians.TWO_PI; az += 0.2) {
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, pt.project(Point1S.of(az)).getAzimuth(), TEST_EPS);
}
}
@@ -222,7 +222,7 @@
// arrange
CutAngle a = CutAngle.createPositiveFacing(0.0, TEST_PRECISION);
CutAngle b = CutAngle.createNegativeFacing(0.0, TEST_PRECISION);
- CutAngle c = CutAngle.createPositiveFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION);
+ CutAngle c = CutAngle.createPositiveFacing(PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
// act/assert
Assert.assertTrue(a.similarOrientation(a));
@@ -233,17 +233,17 @@
@Test
public void testTransform_rotate() {
// arrange
- Transform1S transform = Transform1S.createRotation(Geometry.HALF_PI);
+ Transform1S transform = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO);
// act
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, true, TEST_PRECISION).transform(transform),
- Geometry.HALF_PI, true);
+ PlaneAngleRadians.PI_OVER_TWO, true);
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, false, TEST_PRECISION).transform(transform),
- Geometry.HALF_PI, false);
+ PlaneAngleRadians.PI_OVER_TWO, false);
- checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(1.5 * Geometry.PI), true, TEST_PRECISION).transform(transform),
- Geometry.TWO_PI, true);
- checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(Geometry.MINUS_HALF_PI), false, TEST_PRECISION).transform(transform),
+ checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(1.5 * PlaneAngleRadians.PI), true, TEST_PRECISION).transform(transform),
+ PlaneAngleRadians.TWO_PI, true);
+ checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO), false, TEST_PRECISION).transform(transform),
0.0, false);
}
@@ -258,10 +258,10 @@
checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, false, TEST_PRECISION).transform(transform),
0.0, true);
- checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(1.5 * Geometry.PI), true, TEST_PRECISION).transform(transform),
- -1.5 * Geometry.PI, false);
- checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(Geometry.MINUS_HALF_PI), false, TEST_PRECISION).transform(transform),
- Geometry.HALF_PI, true);
+ checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(1.5 * PlaneAngleRadians.PI), true, TEST_PRECISION).transform(transform),
+ -1.5 * PlaneAngleRadians.PI, false);
+ checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO), false, TEST_PRECISION).transform(transform),
+ PlaneAngleRadians.PI_OVER_TWO, true);
}
@Test
@@ -288,7 +288,7 @@
CutAngle d = CutAngle.fromPointAndDirection(Point1S.ZERO, true, TEST_PRECISION);
CutAngle e = CutAngle.fromPointAndDirection(Point1S.ZERO, true, precision);
- CutAngle f = CutAngle.fromPointAndDirection(Point1S.of(Geometry.TWO_PI), true, precision);
+ CutAngle f = CutAngle.fromPointAndDirection(Point1S.of(PlaneAngleRadians.TWO_PI), true, precision);
CutAngle g = CutAngle.fromPointAndDirection(Point1S.of(1e-4), true, precision);
CutAngle h = CutAngle.fromPointAndDirection(Point1S.of(-1e-4), true, precision);
@@ -460,24 +460,24 @@
// act/assert
Assert.assertEquals(expected, sub.closest(Point1S.ZERO));
- Assert.assertEquals(expected, sub.closest(Point1S.of(Geometry.HALF_PI)));
+ Assert.assertEquals(expected, sub.closest(Point1S.of(PlaneAngleRadians.PI_OVER_TWO)));
Assert.assertEquals(expected, sub.closest(Point1S.PI));
- Assert.assertEquals(expected, sub.closest(Point1S.of(Geometry.MINUS_HALF_PI)));
- Assert.assertEquals(expected, sub.closest(Point1S.of(Geometry.TWO_PI)));
+ Assert.assertEquals(expected, sub.closest(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO)));
+ Assert.assertEquals(expected, sub.closest(Point1S.of(PlaneAngleRadians.TWO_PI)));
}
@Test
public void testSubHyperplane_transform() {
// arrange
- CutAngle pt = CutAngle.fromPointAndDirection(Point1S.of(Geometry.HALF_PI), true, TEST_PRECISION);
+ CutAngle pt = CutAngle.fromPointAndDirection(Point1S.of(PlaneAngleRadians.PI_OVER_TWO), true, TEST_PRECISION);
- Transform1S transform = Transform1S.createNegation().rotate(Geometry.PI);
+ Transform1S transform = Transform1S.createNegation().rotate(PlaneAngleRadians.PI);
// act
SubCutAngle result = pt.span().transform(transform);
// assert
- checkCutAngle(result.getHyperplane(), Geometry.HALF_PI, false);
+ checkCutAngle(result.getHyperplane(), PlaneAngleRadians.PI_OVER_TWO, false);
}
@Test
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java
index da46a11..3db21eb 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java
@@ -18,7 +18,7 @@
import java.util.Comparator;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.GeometryValueException;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -50,7 +50,7 @@
Assert.assertEquals(0, comp.compare(Point1S.of(1), Point1S.of(1)));
Assert.assertEquals(-1, comp.compare(Point1S.of(0), Point1S.of(1)));
Assert.assertEquals(1, comp.compare(Point1S.of(1), Point1S.of(0)));
- Assert.assertEquals(1, comp.compare(Point1S.of(1), Point1S.of(0.1 + Geometry.TWO_PI)));
+ Assert.assertEquals(1, comp.compare(Point1S.of(1), Point1S.of(0.1 + PlaneAngleRadians.TWO_PI)));
Assert.assertEquals(1, comp.compare(null, Point1S.of(0)));
Assert.assertEquals(-1, comp.compare(Point1S.of(0), null));
@@ -62,15 +62,15 @@
// act/assert
checkPoint(Point1S.of(0), 0, 0);
checkPoint(Point1S.of(1), 1, 1);
- checkPoint(Point1S.of(-1), -1, Geometry.TWO_PI - 1);
+ checkPoint(Point1S.of(-1), -1, PlaneAngleRadians.TWO_PI - 1);
- checkPoint(Point1S.of(PlaneAngle.ofDegrees(90)), Geometry.HALF_PI, Geometry.HALF_PI);
- checkPoint(Point1S.of(PlaneAngle.ofTurns(0.5)), Geometry.PI, Geometry.PI);
- checkPoint(Point1S.of(Geometry.MINUS_HALF_PI), Geometry.MINUS_HALF_PI, 1.5 * Geometry.PI);
+ checkPoint(Point1S.of(PlaneAngle.ofDegrees(90)), PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
+ checkPoint(Point1S.of(PlaneAngle.ofTurns(0.5)), PlaneAngleRadians.PI, PlaneAngleRadians.PI);
+ checkPoint(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO), PlaneAngleRadians.MINUS_PI_OVER_TWO, 1.5 * PlaneAngleRadians.PI);
- double base = Geometry.HALF_PI;
+ double base = PlaneAngleRadians.PI_OVER_TWO;
for (int k = -3; k <= 3; ++k) {
- double az = base + (k * Geometry.TWO_PI);
+ double az = base + (k * PlaneAngleRadians.TWO_PI);
checkPoint(Point1S.of(az), az, base);
}
}
@@ -79,18 +79,18 @@
public void testFrom_vector() {
// act/assert
checkPoint(Point1S.from(Vector2D.of(2, 0)), 0.0);
- checkPoint(Point1S.from(Vector2D.of(0, 0.1)), Geometry.HALF_PI);
- checkPoint(Point1S.from(Vector2D.of(-0.5, 0)), Geometry.PI);
- checkPoint(Point1S.from(Vector2D.of(0, -100)), 1.5 * Geometry.PI);
+ checkPoint(Point1S.from(Vector2D.of(0, 0.1)), PlaneAngleRadians.PI_OVER_TWO);
+ checkPoint(Point1S.from(Vector2D.of(-0.5, 0)), PlaneAngleRadians.PI);
+ checkPoint(Point1S.from(Vector2D.of(0, -100)), 1.5 * PlaneAngleRadians.PI);
}
@Test
public void testFrom_polar() {
// act/assert
checkPoint(Point1S.from(PolarCoordinates.of(100, 0)), 0.0);
- checkPoint(Point1S.from(PolarCoordinates.of(1, Geometry.HALF_PI)), Geometry.HALF_PI);
- checkPoint(Point1S.from(PolarCoordinates.of(0.5, Geometry.PI)), Geometry.PI);
- checkPoint(Point1S.from(PolarCoordinates.of(1e-4, Geometry.MINUS_HALF_PI)), 1.5 * Geometry.PI);
+ checkPoint(Point1S.from(PolarCoordinates.of(1, PlaneAngleRadians.PI_OVER_TWO)), PlaneAngleRadians.PI_OVER_TWO);
+ checkPoint(Point1S.from(PolarCoordinates.of(0.5, PlaneAngleRadians.PI)), PlaneAngleRadians.PI);
+ checkPoint(Point1S.from(PolarCoordinates.of(1e-4, PlaneAngleRadians.MINUS_PI_OVER_TWO)), 1.5 * PlaneAngleRadians.PI);
}
@Test
@@ -150,7 +150,7 @@
@Test
public void testAntipodal() {
- for (double az = -6 * Geometry.PI; az <= 6 * Geometry.PI; az += 0.1) {
+ for (double az = -6 * PlaneAngleRadians.PI; az <= 6 * PlaneAngleRadians.PI; az += 0.1) {
// arrange
Point1S pt = Point1S.of(az);
@@ -158,8 +158,8 @@
Point1S result = pt.antipodal();
// assert
- Assert.assertTrue(result.getAzimuth() >= 0 && result.getAzimuth() < Geometry.TWO_PI);
- Assert.assertEquals(Geometry.PI, pt.distance(result), TEST_EPS);
+ Assert.assertTrue(result.getAzimuth() >= 0 && result.getAzimuth() < PlaneAngleRadians.TWO_PI);
+ Assert.assertEquals(PlaneAngleRadians.PI, pt.distance(result), TEST_EPS);
}
}
@@ -169,7 +169,7 @@
Point1S a = Point1S.of(1.0);
Point1S b = Point1S.of(2.0);
Point1S c = Point1S.of(1.0);
- Point1S d = Point1S.of(1.0 + Geometry.PI);
+ Point1S d = Point1S.of(1.0 + PlaneAngleRadians.PI);
int hash = a.hashCode();
@@ -187,7 +187,7 @@
// act
Point1S a = Point1S.of(1.0);
Point1S b = Point1S.of(2.0);
- Point1S c = Point1S.of(1.0 + Geometry.PI);
+ Point1S c = Point1S.of(1.0 + PlaneAngleRadians.PI);
Point1S d = Point1S.of(1.0);
Point1S e = Point1S.of(Double.NaN);
@@ -219,7 +219,7 @@
Point1S a = Point1S.of(1);
Point1S b = Point1S.of(0.9999);
Point1S c = Point1S.of(1.00001);
- Point1S d = Point1S.of(1 + (3 * Geometry.TWO_PI));
+ Point1S d = Point1S.of(1 + (3 * PlaneAngleRadians.TWO_PI));
// act/assert
Assert.assertTrue(a.eq(a, highPrecision));
@@ -258,71 +258,71 @@
public void testDistance() {
// arrange
Point1S a = Point1S.of(0.0);
- Point1S b = Point1S.of(Geometry.PI - 0.5);
- Point1S c = Point1S.of(Geometry.PI);
- Point1S d = Point1S.of(Geometry.PI + 0.5);
+ Point1S b = Point1S.of(PlaneAngleRadians.PI - 0.5);
+ Point1S c = Point1S.of(PlaneAngleRadians.PI);
+ Point1S d = Point1S.of(PlaneAngleRadians.PI + 0.5);
Point1S e = Point1S.of(4.0);
// act/assert
Assert.assertEquals(0.0, a.distance(a), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 0.5, a.distance(b), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 0.5, b.distance(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 0.5, a.distance(b), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 0.5, b.distance(a), TEST_EPS);
- Assert.assertEquals(Geometry.PI, a.distance(c), TEST_EPS);
- Assert.assertEquals(Geometry.PI, c.distance(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, a.distance(c), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, c.distance(a), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 0.5, a.distance(d), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 0.5, d.distance(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 0.5, a.distance(d), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 0.5, d.distance(a), TEST_EPS);
- Assert.assertEquals(Geometry.TWO_PI - 4, a.distance(e), TEST_EPS);
- Assert.assertEquals(Geometry.TWO_PI - 4, e.distance(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI - 4, a.distance(e), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI - 4, e.distance(a), TEST_EPS);
}
@Test
public void testSignedDistance() {
// arrange
Point1S a = Point1S.of(0.0);
- Point1S b = Point1S.of(Geometry.PI - 0.5);
- Point1S c = Point1S.of(Geometry.PI);
- Point1S d = Point1S.of(Geometry.PI + 0.5);
+ Point1S b = Point1S.of(PlaneAngleRadians.PI - 0.5);
+ Point1S c = Point1S.of(PlaneAngleRadians.PI);
+ Point1S d = Point1S.of(PlaneAngleRadians.PI + 0.5);
Point1S e = Point1S.of(4.0);
// act/assert
Assert.assertEquals(0.0, a.signedDistance(a), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 0.5, a.signedDistance(b), TEST_EPS);
- Assert.assertEquals(-Geometry.PI + 0.5, b.signedDistance(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 0.5, a.signedDistance(b), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI + 0.5, b.signedDistance(a), TEST_EPS);
- Assert.assertEquals(-Geometry.PI, a.signedDistance(c), TEST_EPS);
- Assert.assertEquals(-Geometry.PI, c.signedDistance(a), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI, a.signedDistance(c), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI, c.signedDistance(a), TEST_EPS);
- Assert.assertEquals(-Geometry.PI + 0.5, a.signedDistance(d), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 0.5, d.signedDistance(a), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI + 0.5, a.signedDistance(d), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 0.5, d.signedDistance(a), TEST_EPS);
- Assert.assertEquals(-Geometry.TWO_PI + 4, a.signedDistance(e), TEST_EPS);
- Assert.assertEquals(Geometry.TWO_PI - 4, e.signedDistance(a), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.TWO_PI + 4, a.signedDistance(e), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI - 4, e.signedDistance(a), TEST_EPS);
}
@Test
public void testDistance_inRangeZeroToPi() {
- for (double a = -4 * Geometry.PI; a < 4 * Geometry.PI; a += 0.1) {
- for (double b = -4 * Geometry.PI; b < 4 * Geometry.PI; b += 0.1) {
+ for (double a = -4 * PlaneAngleRadians.PI; a < 4 * PlaneAngleRadians.PI; a += 0.1) {
+ for (double b = -4 * PlaneAngleRadians.PI; b < 4 * PlaneAngleRadians.PI; b += 0.1) {
// arrange
Point1S p1 = Point1S.of(a);
Point1S p2 = Point1S.of(b);
// act/assert
double d1 = p1.distance(p2);
- Assert.assertTrue(d1 >= 0 && d1 <= Geometry.PI);
+ Assert.assertTrue(d1 >= 0 && d1 <= PlaneAngleRadians.PI);
double d2 = p2.distance(p1);
- Assert.assertTrue(d2 >= 0 && d2 <= Geometry.PI);
+ Assert.assertTrue(d2 >= 0 && d2 <= PlaneAngleRadians.PI);
}
}
}
@Test
public void testNormalize() {
- for (double az = -Geometry.TWO_PI; az < 2 * Geometry.TWO_PI; az += 0.2) {
+ for (double az = -PlaneAngleRadians.TWO_PI; az < 2 * PlaneAngleRadians.TWO_PI; az += 0.2) {
// arrange
Point1S pt = Point1S.of(az);
@@ -365,20 +365,20 @@
Point1S p2 = Point1S.of(PlaneAngle.ofDegrees(90));
Point1S p3 = Point1S.PI;
Point1S p4 = Point1S.of(PlaneAngle.ofDegrees(-90));
- Point1S p5 = Point1S.of(Geometry.TWO_PI);
+ Point1S p5 = Point1S.of(PlaneAngleRadians.TWO_PI);
// act/assert
checkPoint(p1.above(p1), 0);
- checkPoint(p2.above(p1), Geometry.HALF_PI);
- checkPoint(p3.above(p1), Geometry.PI);
- checkPoint(p4.above(p1), 1.5 * Geometry.PI);
+ checkPoint(p2.above(p1), PlaneAngleRadians.PI_OVER_TWO);
+ checkPoint(p3.above(p1), PlaneAngleRadians.PI);
+ checkPoint(p4.above(p1), 1.5 * PlaneAngleRadians.PI);
checkPoint(p5.above(p1), 0);
- checkPoint(p1.above(p3), Geometry.TWO_PI);
- checkPoint(p2.above(p3), 2.5 * Geometry.PI);
- checkPoint(p3.above(p3), Geometry.PI);
- checkPoint(p4.above(p3), 1.5 * Geometry.PI);
- checkPoint(p5.above(p3), Geometry.TWO_PI);
+ checkPoint(p1.above(p3), PlaneAngleRadians.TWO_PI);
+ checkPoint(p2.above(p3), 2.5 * PlaneAngleRadians.PI);
+ checkPoint(p3.above(p3), PlaneAngleRadians.PI);
+ checkPoint(p4.above(p3), 1.5 * PlaneAngleRadians.PI);
+ checkPoint(p5.above(p3), PlaneAngleRadians.TWO_PI);
}
@Test
@@ -404,19 +404,19 @@
Point1S p2 = Point1S.of(PlaneAngle.ofDegrees(90));
Point1S p3 = Point1S.PI;
Point1S p4 = Point1S.of(PlaneAngle.ofDegrees(-90));
- Point1S p5 = Point1S.of(Geometry.TWO_PI);
+ Point1S p5 = Point1S.of(PlaneAngleRadians.TWO_PI);
// act/assert
- checkPoint(p1.below(p1), -Geometry.TWO_PI);
- checkPoint(p2.below(p1), -1.5 * Geometry.PI);
- checkPoint(p3.below(p1), -Geometry.PI);
- checkPoint(p4.below(p1), Geometry.MINUS_HALF_PI);
- checkPoint(p5.below(p1), -Geometry.TWO_PI);
+ checkPoint(p1.below(p1), -PlaneAngleRadians.TWO_PI);
+ checkPoint(p2.below(p1), -1.5 * PlaneAngleRadians.PI);
+ checkPoint(p3.below(p1), -PlaneAngleRadians.PI);
+ checkPoint(p4.below(p1), PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkPoint(p5.below(p1), -PlaneAngleRadians.TWO_PI);
checkPoint(p1.below(p3), 0.0);
- checkPoint(p2.below(p3), Geometry.HALF_PI);
- checkPoint(p3.below(p3), -Geometry.PI);
- checkPoint(p4.below(p3), Geometry.MINUS_HALF_PI);
+ checkPoint(p2.below(p3), PlaneAngleRadians.PI_OVER_TWO);
+ checkPoint(p3.below(p3), -PlaneAngleRadians.PI);
+ checkPoint(p4.below(p3), PlaneAngleRadians.MINUS_PI_OVER_TWO);
checkPoint(p5.below(p3), 0.0);
}
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
index b501706..c42f8a6 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.Region;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.partitioning.Split;
@@ -36,9 +36,9 @@
private static final DoublePrecisionContext TEST_PRECISION =
new EpsilonDoublePrecisionContext(TEST_EPS);
- private static final Transform1S HALF_PI_PLUS_AZ = Transform1S.createRotation(Geometry.HALF_PI);
+ private static final Transform1S HALF_PI_PLUS_AZ = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO);
- private static final Transform1S PI_MINUS_AZ = Transform1S.createNegation().rotate(Geometry.PI);
+ private static final Transform1S PI_MINUS_AZ = Transform1S.createNegation().rotate(PlaneAngleRadians.PI);
@Test
public void testConstructor_default() {
@@ -63,7 +63,7 @@
Assert.assertTrue(tree.isFull());
Assert.assertFalse(tree.isEmpty());
- Assert.assertEquals(Geometry.TWO_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, tree.getSize(), TEST_EPS);
Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);
Assert.assertNull(tree.getBarycenter());
}
@@ -91,7 +91,7 @@
Assert.assertTrue(tree.isFull());
Assert.assertFalse(tree.isEmpty());
- Assert.assertEquals(Geometry.TWO_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, tree.getSize(), TEST_EPS);
Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);
Assert.assertNull(tree.getBarycenter());
}
@@ -113,7 +113,7 @@
@Test
public void testCopy() {
// arrange
- RegionBSPTree1S orig = RegionBSPTree1S.fromInterval(AngularInterval.of(0, Geometry.PI, TEST_PRECISION));
+ RegionBSPTree1S orig = RegionBSPTree1S.fromInterval(AngularInterval.of(0, PlaneAngleRadians.PI, TEST_PRECISION));
// act
RegionBSPTree1S copy = orig.copy();
@@ -123,7 +123,7 @@
orig.setEmpty();
- checkSingleInterval(copy, 0, Geometry.PI);
+ checkSingleInterval(copy, 0, PlaneAngleRadians.PI);
}
@Test
@@ -137,19 +137,19 @@
@Test
public void testFromInterval_nonFull() {
- for (double theta = 0.0; theta <= Geometry.TWO_PI; theta += 0.2) {
+ for (double theta = 0.0; theta <= PlaneAngleRadians.TWO_PI; theta += 0.2) {
// arrange
double min = theta;
- double max = theta + Geometry.HALF_PI;
+ double max = theta + PlaneAngleRadians.PI_OVER_TWO;
// act
RegionBSPTree1S tree = RegionBSPTree1S.fromInterval(AngularInterval.of(min, max, TEST_PRECISION));
checkSingleInterval(tree, min, max);
- Assert.assertEquals(Geometry.HALF_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, tree.getSize(), TEST_EPS);
Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(PlaneAngleRadians.normalizeBetweenZeroAndTwoPi(theta + (0.25 * Geometry.PI)),
+ Assert.assertEquals(PlaneAngleRadians.normalizeBetweenZeroAndTwoPi(theta + (0.25 * PlaneAngleRadians.PI)),
tree.getBarycenter().getNormalizedAzimuth(), TEST_EPS);
}
}
@@ -160,7 +160,7 @@
RegionBSPTree1S tree = RegionBSPTree1S.full();
// act/assert
- for (double az = -Geometry.TWO_PI; az <= 2 * Geometry.TWO_PI; az += 0.2) {
+ for (double az = -PlaneAngleRadians.TWO_PI; az <= 2 * PlaneAngleRadians.TWO_PI; az += 0.2) {
checkClassify(tree, RegionLocation.INSIDE, az);
}
}
@@ -171,7 +171,7 @@
RegionBSPTree1S tree = RegionBSPTree1S.empty();
// act/assert
- for (double az = -Geometry.TWO_PI; az <= 2 * Geometry.TWO_PI; az += 0.2) {
+ for (double az = -PlaneAngleRadians.TWO_PI; az <= 2 * PlaneAngleRadians.TWO_PI; az += 0.2) {
checkClassify(tree, RegionLocation.OUTSIDE, az);
}
}
@@ -180,19 +180,19 @@
public void testClassify() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.fromInterval(
- AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI, TEST_PRECISION));
+ AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
// act/assert
checkClassify(tree, RegionLocation.BOUNDARY,
- Geometry.MINUS_HALF_PI, Geometry.HALF_PI,
- Geometry.MINUS_HALF_PI - Geometry.TWO_PI, Geometry.HALF_PI + Geometry.TWO_PI);
+ PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO,
+ PlaneAngleRadians.MINUS_PI_OVER_TWO - PlaneAngleRadians.TWO_PI, PlaneAngleRadians.PI_OVER_TWO + PlaneAngleRadians.TWO_PI);
checkClassify(tree, RegionLocation.INSIDE,
0.0, 0.5, -0.5,
- Geometry.TWO_PI, 0.5 + Geometry.TWO_PI, -0.5 - Geometry.TWO_PI);
+ PlaneAngleRadians.TWO_PI, 0.5 + PlaneAngleRadians.TWO_PI, -0.5 - PlaneAngleRadians.TWO_PI);
checkClassify(tree, RegionLocation.OUTSIDE,
- Geometry.PI, Geometry.PI + 0.5, Geometry.PI - 0.5,
- Geometry.PI + Geometry.TWO_PI, Geometry.PI + 0.5 + Geometry.TWO_PI,
- Geometry.PI - 0.5 + Geometry.TWO_PI);
+ PlaneAngleRadians.PI, PlaneAngleRadians.PI + 0.5, PlaneAngleRadians.PI - 0.5,
+ PlaneAngleRadians.PI + PlaneAngleRadians.TWO_PI, PlaneAngleRadians.PI + 0.5 + PlaneAngleRadians.TWO_PI,
+ PlaneAngleRadians.PI - 0.5 + PlaneAngleRadians.TWO_PI);
}
@Test
@@ -227,7 +227,7 @@
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- for (double theta = 0; theta <= Geometry.TWO_PI; theta += 0.2) {
+ for (double theta = 0; theta <= PlaneAngleRadians.TWO_PI; theta += 0.2) {
// act/assert
tree.setEmpty();
tree.getRoot().cut(CutAngle.createPositiveFacing(theta, TEST_PRECISION));
@@ -237,7 +237,7 @@
tree.setEmpty();
tree.getRoot().cut(CutAngle.createNegativeFacing(theta, TEST_PRECISION));
- checkSingleInterval(tree, theta, Geometry.TWO_PI);
+ checkSingleInterval(tree, theta, PlaneAngleRadians.TWO_PI);
}
}
@@ -245,8 +245,8 @@
public void testToIntervals_wrapAround_joinedIntervalsOnPositiveSide() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- tree.add(AngularInterval.of(0.25 * Geometry.PI, Geometry.HALF_PI, TEST_PRECISION));
- tree.add(AngularInterval.of(1.5 * Geometry.PI, 0.25 * Geometry.PI, TEST_PRECISION));
+ tree.add(AngularInterval.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
+ tree.add(AngularInterval.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION));
// act
List<AngularInterval> intervals = tree.toIntervals();
@@ -254,15 +254,15 @@
// assert
Assert.assertEquals(1, intervals.size());
- checkInterval(intervals.get(0), 1.5 * Geometry.PI, Geometry.HALF_PI);
+ checkInterval(intervals.get(0), 1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testToIntervals_wrapAround_joinedIntervalsOnNegativeSide() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- tree.add(AngularInterval.of(1.75 * Geometry.PI, Geometry.HALF_PI, TEST_PRECISION));
- tree.add(AngularInterval.of(1.5 * Geometry.PI, 1.75 * Geometry.PI, TEST_PRECISION));
+ tree.add(AngularInterval.of(1.75 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
+ tree.add(AngularInterval.of(1.5 * PlaneAngleRadians.PI, 1.75 * PlaneAngleRadians.PI, TEST_PRECISION));
// act
List<AngularInterval> intervals = tree.toIntervals();
@@ -270,16 +270,16 @@
// assert
Assert.assertEquals(1, intervals.size());
- checkInterval(intervals.get(0), 1.5 * Geometry.PI, Geometry.HALF_PI);
+ checkInterval(intervals.get(0), 1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testToIntervals_multipleIntervals() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- tree.add(AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI - 0.5, Geometry.PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI, Geometry.PI + 0.5, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI - 0.5, PlaneAngleRadians.PI, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI + 0.5, TEST_PRECISION));
// act
List<AngularInterval> intervals = tree.toIntervals();
@@ -287,17 +287,17 @@
// assert
Assert.assertEquals(2, intervals.size());
- checkInterval(intervals.get(0), Geometry.PI - 0.5, Geometry.PI + 0.5);
- checkInterval(intervals.get(1), Geometry.MINUS_HALF_PI, Geometry.HALF_PI);
+ checkInterval(intervals.get(0), PlaneAngleRadians.PI - 0.5, PlaneAngleRadians.PI + 0.5);
+ checkInterval(intervals.get(1), PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testToIntervals_multipleIntervals_complement() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- tree.add(AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI - 0.5, Geometry.PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI, Geometry.PI + 0.5, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI - 0.5, PlaneAngleRadians.PI, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI + 0.5, TEST_PRECISION));
tree.complement();
@@ -307,8 +307,8 @@
// assert
Assert.assertEquals(2, intervals.size());
- checkInterval(intervals.get(0), Geometry.HALF_PI, Geometry.PI - 0.5);
- checkInterval(intervals.get(1), Geometry.PI + 0.5, Geometry.MINUS_HALF_PI);
+ checkInterval(intervals.get(0), PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI - 0.5);
+ checkInterval(intervals.get(1), PlaneAngleRadians.PI + 0.5, PlaneAngleRadians.MINUS_PI_OVER_TWO);
}
@Test
@@ -320,13 +320,13 @@
Assert.assertEquals(SplitLocation.NEITHER,
tree.split(CutAngle.createPositiveFacing(0, TEST_PRECISION)).getLocation());
Assert.assertEquals(SplitLocation.NEITHER,
- tree.split(CutAngle.createNegativeFacing(Geometry.HALF_PI, TEST_PRECISION)).getLocation());
+ tree.split(CutAngle.createNegativeFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)).getLocation());
Assert.assertEquals(SplitLocation.NEITHER,
- tree.split(CutAngle.createPositiveFacing(Geometry.PI, TEST_PRECISION)).getLocation());
+ tree.split(CutAngle.createPositiveFacing(PlaneAngleRadians.PI, TEST_PRECISION)).getLocation());
Assert.assertEquals(SplitLocation.NEITHER,
- tree.split(CutAngle.createNegativeFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION)).getLocation());
+ tree.split(CutAngle.createNegativeFacing(PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION)).getLocation());
Assert.assertEquals(SplitLocation.NEITHER,
- tree.split(CutAngle.createPositiveFacing(Geometry.TWO_PI, TEST_PRECISION)).getLocation());
+ tree.split(CutAngle.createPositiveFacing(PlaneAngleRadians.TWO_PI, TEST_PRECISION)).getLocation());
}
@Test
@@ -338,27 +338,27 @@
checkSimpleSplit(
tree.split(CutAngle.createPositiveFacing(1e-6, TEST_PRECISION)),
AngularInterval.of(0, 1e-6, TEST_PRECISION),
- AngularInterval.of(1e-6, Geometry.TWO_PI, TEST_PRECISION)
+ AngularInterval.of(1e-6, PlaneAngleRadians.TWO_PI, TEST_PRECISION)
);
checkSimpleSplit(
- tree.split(CutAngle.createNegativeFacing(Geometry.HALF_PI, TEST_PRECISION)),
- AngularInterval.of(Geometry.HALF_PI, Geometry.TWO_PI, TEST_PRECISION),
- AngularInterval.of(0, Geometry.HALF_PI, TEST_PRECISION)
+ tree.split(CutAngle.createNegativeFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)),
+ AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.TWO_PI, TEST_PRECISION),
+ AngularInterval.of(0, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)
);
checkSimpleSplit(
- tree.split(CutAngle.createPositiveFacing(Geometry.PI, TEST_PRECISION)),
- AngularInterval.of(0, Geometry.PI, TEST_PRECISION),
- AngularInterval.of(Geometry.PI, Geometry.TWO_PI, TEST_PRECISION)
+ tree.split(CutAngle.createPositiveFacing(PlaneAngleRadians.PI, TEST_PRECISION)),
+ AngularInterval.of(0, PlaneAngleRadians.PI, TEST_PRECISION),
+ AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.TWO_PI, TEST_PRECISION)
);
checkSimpleSplit(
- tree.split(CutAngle.createNegativeFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION)),
- AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.TWO_PI, TEST_PRECISION),
- AngularInterval.of(0, Geometry.MINUS_HALF_PI, TEST_PRECISION)
+ tree.split(CutAngle.createNegativeFacing(PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION)),
+ AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.TWO_PI, TEST_PRECISION),
+ AngularInterval.of(0, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION)
);
checkSimpleSplit(
- tree.split(CutAngle.createPositiveFacing(Geometry.TWO_PI - 1e-6, TEST_PRECISION)),
- AngularInterval.of(0, Geometry.TWO_PI - 1e-6, TEST_PRECISION),
- AngularInterval.of(Geometry.TWO_PI - 1e-6, Geometry.TWO_PI, TEST_PRECISION)
+ tree.split(CutAngle.createPositiveFacing(PlaneAngleRadians.TWO_PI - 1e-6, TEST_PRECISION)),
+ AngularInterval.of(0, PlaneAngleRadians.TWO_PI - 1e-6, TEST_PRECISION),
+ AngularInterval.of(PlaneAngleRadians.TWO_PI - 1e-6, PlaneAngleRadians.TWO_PI, TEST_PRECISION)
);
}
@@ -367,7 +367,7 @@
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.full();
- AngularInterval twoPi = AngularInterval.of(0, Geometry.TWO_PI, TEST_PRECISION);
+ AngularInterval twoPi = AngularInterval.of(0, PlaneAngleRadians.TWO_PI, TEST_PRECISION);
// act/assert
checkSimpleSplit(
@@ -382,12 +382,12 @@
);
checkSimpleSplit(
- tree.split(CutAngle.createPositiveFacing(Geometry.TWO_PI - 1e-18, TEST_PRECISION)),
+ tree.split(CutAngle.createPositiveFacing(PlaneAngleRadians.TWO_PI - 1e-18, TEST_PRECISION)),
null,
twoPi
);
checkSimpleSplit(
- tree.split(CutAngle.createNegativeFacing(Geometry.TWO_PI - 1e-18, TEST_PRECISION)),
+ tree.split(CutAngle.createNegativeFacing(PlaneAngleRadians.TWO_PI - 1e-18, TEST_PRECISION)),
twoPi,
null
);
@@ -396,7 +396,7 @@
@Test
public void testSplit_singleInterval() {
// arrange
- AngularInterval interval = AngularInterval.of(Geometry.HALF_PI, Geometry.MINUS_HALF_PI, TEST_PRECISION);
+ AngularInterval interval = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION);
RegionBSPTree1S tree = interval.toTree();
// act
@@ -406,33 +406,33 @@
null
);
checkSimpleSplit(
- tree.split(CutAngle.createNegativeFacing(-Geometry.TWO_PI, TEST_PRECISION)),
+ tree.split(CutAngle.createNegativeFacing(-PlaneAngleRadians.TWO_PI, TEST_PRECISION)),
interval,
null
);
checkSimpleSplit(
- tree.split(CutAngle.createPositiveFacing(Geometry.TWO_PI + Geometry.HALF_PI, TEST_PRECISION)),
+ tree.split(CutAngle.createPositiveFacing(PlaneAngleRadians.TWO_PI + PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)),
null,
interval
);
checkSimpleSplit(
- tree.split(CutAngle.createPositiveFacing(1.5 * Geometry.PI, TEST_PRECISION)),
+ tree.split(CutAngle.createPositiveFacing(1.5 * PlaneAngleRadians.PI, TEST_PRECISION)),
interval,
null
);
checkSimpleSplit(
- tree.split(CutAngle.createNegativeFacing(Geometry.PI, TEST_PRECISION)),
- AngularInterval.of(Geometry.PI, Geometry.MINUS_HALF_PI, TEST_PRECISION),
- AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION)
+ tree.split(CutAngle.createNegativeFacing(PlaneAngleRadians.PI, TEST_PRECISION)),
+ AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION),
+ AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION)
);
}
@Test
public void testSplit_singleIntervalSplitIntoTwoIntervalsOnSameSide() {
// arrange
- RegionBSPTree1S tree = AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI, TEST_PRECISION).toTree();
+ RegionBSPTree1S tree = AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION).toTree();
CutAngle cut = CutAngle.createPositiveFacing(0, TEST_PRECISION);
@@ -448,15 +448,15 @@
RegionBSPTree1S plus = split.getPlus();
List<AngularInterval> plusIntervals = plus.toIntervals();
Assert.assertEquals(1, plusIntervals.size());
- checkInterval(plusIntervals.get(0), Geometry.MINUS_HALF_PI, Geometry.HALF_PI);
+ checkInterval(plusIntervals.get(0), PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO);
}
@Test
public void testSplit_multipleRegions() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- tree.add(AngularInterval.of(Geometry.TWO_PI - 1, Geometry.HALF_PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI, Geometry.MINUS_HALF_PI, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.TWO_PI - 1, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION));
CutAngle cut = CutAngle.createNegativeFacing(1, TEST_PRECISION);
@@ -469,9 +469,9 @@
RegionBSPTree1S minus = split.getMinus();
List<AngularInterval> minusIntervals = minus.toIntervals();
Assert.assertEquals(3, minusIntervals.size());
- checkInterval(minusIntervals.get(0), 1, Geometry.HALF_PI);
- checkInterval(minusIntervals.get(1), Geometry.PI, Geometry.MINUS_HALF_PI);
- checkInterval(minusIntervals.get(2), Geometry.TWO_PI - 1, 0);
+ checkInterval(minusIntervals.get(0), 1, PlaneAngleRadians.PI_OVER_TWO);
+ checkInterval(minusIntervals.get(1), PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO);
+ checkInterval(minusIntervals.get(2), PlaneAngleRadians.TWO_PI - 1, 0);
RegionBSPTree1S plus = split.getPlus();
List<AngularInterval> plusIntervals = plus.toIntervals();
@@ -483,7 +483,7 @@
public void testSplitDiameter_full() {
// arrange
RegionBSPTree1S full = RegionBSPTree1S.full();
- CutAngle splitter = CutAngle.createPositiveFacing(Geometry.HALF_PI, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createPositiveFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
Split<RegionBSPTree1S> split = full.splitDiameter(splitter);
@@ -494,19 +494,19 @@
RegionBSPTree1S minus = split.getMinus();
List<AngularInterval> minusIntervals = minus.toIntervals();
Assert.assertEquals(1, minusIntervals.size());
- checkInterval(minusIntervals.get(0), 1.5 * Geometry.PI, 2.5 * Geometry.PI);
+ checkInterval(minusIntervals.get(0), 1.5 * PlaneAngleRadians.PI, 2.5 * PlaneAngleRadians.PI);
RegionBSPTree1S plus = split.getPlus();
List<AngularInterval> plusIntervals = plus.toIntervals();
Assert.assertEquals(1, plusIntervals.size());
- checkInterval(plusIntervals.get(0), Geometry.HALF_PI, 1.5 * Geometry.PI);
+ checkInterval(plusIntervals.get(0), PlaneAngleRadians.PI_OVER_TWO, 1.5 * PlaneAngleRadians.PI);
}
@Test
public void testSplitDiameter_empty() {
// arrange
RegionBSPTree1S empty = RegionBSPTree1S.empty();
- CutAngle splitter = CutAngle.createPositiveFacing(Geometry.HALF_PI, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createPositiveFacing(PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
// act
Split<RegionBSPTree1S> split = empty.splitDiameter(splitter);
@@ -595,7 +595,7 @@
tree.add(AngularInterval.of(1, 1.1, TEST_PRECISION));
tree.add(AngularInterval.of(2, 2.1, TEST_PRECISION));
- CutAngle splitter = CutAngle.createNegativeFacing(Geometry.PI - 1, TEST_PRECISION);
+ CutAngle splitter = CutAngle.createNegativeFacing(PlaneAngleRadians.PI - 1, TEST_PRECISION);
// act
Split<RegionBSPTree1S>split = tree.splitDiameter(splitter);
@@ -670,25 +670,25 @@
@Test
public void testRegionProperties_singleInterval_wrapsZero() {
// arrange
- RegionBSPTree1S tree = AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.PI,
+ RegionBSPTree1S tree = AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI,
TEST_PRECISION).toTree();
// act/assert
- Assert.assertEquals(1.5 * Geometry.PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, tree.getSize(), TEST_EPS);
Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, tree.getBarycenter().getAzimuth(), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, tree.getBarycenter().getAzimuth(), TEST_EPS);
}
@Test
public void testRegionProperties_singleInterval_doesNotWrap() {
// arrange
- RegionBSPTree1S tree = AngularInterval.of(Geometry.HALF_PI, Geometry.TWO_PI,
+ RegionBSPTree1S tree = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.TWO_PI,
TEST_PRECISION).toTree();
// act/assert
- Assert.assertEquals(1.5 * Geometry.PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, tree.getSize(), TEST_EPS);
Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(1.25 * Geometry.PI, tree.getBarycenter().getAzimuth(), TEST_EPS);
+ Assert.assertEquals(1.25 * PlaneAngleRadians.PI, tree.getBarycenter().getAzimuth(), TEST_EPS);
}
@Test
@@ -751,8 +751,8 @@
List<AngularInterval> intervals = tree.toIntervals();
Assert.assertEquals(2, intervals.size());
- checkInterval(intervals.get(0), Geometry.HALF_PI - 1, Geometry.HALF_PI + 1);
- checkInterval(intervals.get(1), Geometry.HALF_PI + 2, Geometry.HALF_PI + 3);
+ checkInterval(intervals.get(0), PlaneAngleRadians.PI_OVER_TWO - 1, PlaneAngleRadians.PI_OVER_TWO + 1);
+ checkInterval(intervals.get(1), PlaneAngleRadians.PI_OVER_TWO + 2, PlaneAngleRadians.PI_OVER_TWO + 3);
}
@Test
@@ -771,8 +771,8 @@
List<AngularInterval> intervals = tree.toIntervals();
Assert.assertEquals(2, intervals.size());
- checkInterval(intervals.get(0), Geometry.PI - 3, Geometry.PI - 2);
- checkInterval(intervals.get(1), Geometry.PI - 1, Geometry.PI + 1);
+ checkInterval(intervals.get(0), PlaneAngleRadians.PI - 3, PlaneAngleRadians.PI - 2);
+ checkInterval(intervals.get(1), PlaneAngleRadians.PI - 1, PlaneAngleRadians.PI + 1);
}
@Test
@@ -793,25 +793,25 @@
public void testProject_withIntervals() {
// arrange
RegionBSPTree1S tree = RegionBSPTree1S.empty();
- tree.add(AngularInterval.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI - 1, Geometry.PI + 1, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI - 1, PlaneAngleRadians.PI + 1, TEST_PRECISION));
// act/assert
- Assert.assertEquals(Geometry.MINUS_HALF_PI,
- tree.project(Point1S.of(Geometry.MINUS_HALF_PI - 0.1)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.MINUS_HALF_PI,
- tree.project(Point1S.of(Geometry.MINUS_HALF_PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.MINUS_HALF_PI,
- tree.project(Point1S.of(Geometry.MINUS_HALF_PI + 0.1)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.MINUS_PI_OVER_TWO,
+ tree.project(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO - 0.1)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.MINUS_PI_OVER_TWO,
+ tree.project(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.MINUS_PI_OVER_TWO,
+ tree.project(Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO + 0.1)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.MINUS_HALF_PI, tree.project(Point1S.of(-0.1)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, tree.project(Point1S.ZERO).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, tree.project(Point1S.of(0.1)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.MINUS_PI_OVER_TWO, tree.project(Point1S.of(-0.1)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, tree.project(Point1S.ZERO).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, tree.project(Point1S.of(0.1)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.PI - 1,
- tree.project(Point1S.of(Geometry.PI - 0.5)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(Geometry.PI + 1,
- tree.project(Point1S.of(Geometry.PI + 0.5)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - 1,
+ tree.project(Point1S.of(PlaneAngleRadians.PI - 0.5)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI + 1,
+ tree.project(Point1S.of(PlaneAngleRadians.PI + 0.5)).getAzimuth(), TEST_EPS);
}
@Test
@@ -834,9 +834,9 @@
RegionBSPTree1S tree = AngularInterval.of(start, end, TEST_PRECISION).toTree();
// act/assert
- Assert.assertEquals(end, tree.project(Point1S.of(-1.5 * Geometry.PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(start, tree.project(Point1S.of(-Geometry.PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(start, tree.project(Point1S.of(-0.5 * Geometry.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(end, tree.project(Point1S.of(-1.5 * PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(start, tree.project(Point1S.of(-PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(start, tree.project(Point1S.of(-0.5 * PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
Assert.assertEquals(start, tree.project(Point1S.of(-1)).getAzimuth(), TEST_EPS);
Assert.assertEquals(start, tree.project(Point1S.of(-0.5)).getAzimuth(), TEST_EPS);
Assert.assertEquals(end, tree.project(Point1S.of(-0.25)).getAzimuth(), TEST_EPS);
@@ -856,9 +856,9 @@
RegionBSPTree1S tree = AngularInterval.of(start, end, TEST_PRECISION).toTree();
// act/assert
- Assert.assertEquals(end, tree.project(Point1S.of(-1.5 * Geometry.PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(end, tree.project(Point1S.of(-Geometry.PI)).getAzimuth(), TEST_EPS);
- Assert.assertEquals(start, tree.project(Point1S.of(-0.5 * Geometry.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(end, tree.project(Point1S.of(-1.5 * PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(end, tree.project(Point1S.of(-PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
+ Assert.assertEquals(start, tree.project(Point1S.of(-0.5 * PlaneAngleRadians.PI)).getAzimuth(), TEST_EPS);
Assert.assertEquals(start, tree.project(Point1S.of(-1)).getAzimuth(), TEST_EPS);
Assert.assertEquals(start, tree.project(Point1S.of(-0.5)).getAzimuth(), TEST_EPS);
Assert.assertEquals(start, tree.project(Point1S.of(-0.25)).getAzimuth(), TEST_EPS);
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Transform1STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Transform1STest.java
index 7248ce7..e969dca 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Transform1STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Transform1STest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.spherical.oned;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.spherical.SphericalTestUtils;
import org.junit.Assert;
@@ -28,11 +28,11 @@
private static final Point1S ZERO = Point1S.ZERO;
- private static final Point1S HALF_PI = Point1S.of(Geometry.HALF_PI);
+ private static final Point1S HALF_PI = Point1S.of(PlaneAngleRadians.PI_OVER_TWO);
- private static final Point1S PI = Point1S.of(Geometry.PI);
+ private static final Point1S PI = Point1S.of(PlaneAngleRadians.PI);
- private static final Point1S MINUS_HALF_PI = Point1S.of(Geometry.MINUS_HALF_PI);
+ private static final Point1S MINUS_HALF_PI = Point1S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO);
@Test
public void testIdentity() {
@@ -55,16 +55,16 @@
@Test
public void testRotate_positive() {
// arrange
- Transform1S t = Transform1S.createRotation(Geometry.HALF_PI);
+ Transform1S t = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
Assert.assertTrue(t.preservesOrientation());
Assert.assertFalse(t.isNegation());
- Assert.assertEquals(Geometry.HALF_PI, t.getRotation(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, t.getRotation(), TEST_EPS);
SphericalTestUtils.assertPointsEqual(HALF_PI, t.apply(ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(PI, t.apply(HALF_PI), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(1.5 * Geometry.PI), t.apply(PI), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point1S.of(1.5 * PlaneAngleRadians.PI), t.apply(PI), TEST_EPS);
SphericalTestUtils.assertPointsEqual(Point1S.ZERO, t.apply(MINUS_HALF_PI), TEST_EPS);
checkInverse(t);
@@ -73,17 +73,17 @@
@Test
public void testRotate_negative() {
// arrange
- Transform1S t = Transform1S.createRotation(-Geometry.HALF_PI);
+ Transform1S t = Transform1S.createRotation(-PlaneAngleRadians.PI_OVER_TWO);
// act/assert
Assert.assertTrue(t.preservesOrientation());
Assert.assertFalse(t.isNegation());
- Assert.assertEquals(-Geometry.HALF_PI, t.getRotation(), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI_OVER_TWO, t.getRotation(), TEST_EPS);
SphericalTestUtils.assertPointsEqual(MINUS_HALF_PI, t.apply(ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(ZERO, t.apply(HALF_PI), TEST_EPS);
SphericalTestUtils.assertPointsEqual(HALF_PI, t.apply(PI), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(-Geometry.PI), t.apply(MINUS_HALF_PI), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point1S.of(-PlaneAngleRadians.PI), t.apply(MINUS_HALF_PI), TEST_EPS);
checkInverse(t);
}
@@ -100,7 +100,7 @@
SphericalTestUtils.assertPointsEqual(ZERO, t.apply(ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(MINUS_HALF_PI, t.apply(HALF_PI), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(-Geometry.PI), t.apply(PI), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point1S.of(-PlaneAngleRadians.PI), t.apply(PI), TEST_EPS);
SphericalTestUtils.assertPointsEqual(HALF_PI, t.apply(MINUS_HALF_PI), TEST_EPS);
checkInverse(t);
@@ -109,12 +109,12 @@
@Test
public void testNegateThenRotate() {
// arrange
- Transform1S t = Transform1S.createNegation().rotate(Geometry.HALF_PI);
+ Transform1S t = Transform1S.createNegation().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
Assert.assertFalse(t.preservesOrientation());
Assert.assertTrue(t.isNegation());
- Assert.assertEquals(Geometry.HALF_PI, t.getRotation(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, t.getRotation(), TEST_EPS);
SphericalTestUtils.assertPointsEqual(HALF_PI, t.apply(ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(ZERO, t.apply(HALF_PI), TEST_EPS);
@@ -127,16 +127,16 @@
@Test
public void testRotateThenNegate() {
// arrange
- Transform1S t = Transform1S.createRotation(Geometry.HALF_PI).negate();
+ Transform1S t = Transform1S.createRotation(PlaneAngleRadians.PI_OVER_TWO).negate();
// act/assert
Assert.assertFalse(t.preservesOrientation());
Assert.assertTrue(t.isNegation());
- Assert.assertEquals(-Geometry.HALF_PI, t.getRotation(), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI_OVER_TWO, t.getRotation(), TEST_EPS);
SphericalTestUtils.assertPointsEqual(MINUS_HALF_PI, t.apply(ZERO), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(-Geometry.PI), t.apply(HALF_PI), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(-1.5 * Geometry.PI), t.apply(PI), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point1S.of(-PlaneAngleRadians.PI), t.apply(HALF_PI), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point1S.of(-1.5 * PlaneAngleRadians.PI), t.apply(PI), TEST_EPS);
SphericalTestUtils.assertPointsEqual(ZERO, t.apply(MINUS_HALF_PI), TEST_EPS);
checkInverse(t);
@@ -146,7 +146,7 @@
public void testMultiply() {
// arrange
Transform1S neg = Transform1S.identity().negate();
- Transform1S rot = Transform1S.identity().rotate(Geometry.HALF_PI);
+ Transform1S rot = Transform1S.identity().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act
Transform1S t = rot.multiply(neg);
@@ -154,7 +154,7 @@
// assert
Assert.assertFalse(t.preservesOrientation());
Assert.assertTrue(t.isNegation());
- Assert.assertEquals(Geometry.HALF_PI, t.getRotation(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, t.getRotation(), TEST_EPS);
SphericalTestUtils.assertPointsEqual(HALF_PI, t.apply(ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(ZERO, t.apply(HALF_PI), TEST_EPS);
@@ -168,7 +168,7 @@
public void testPreultiply() {
// arrange
Transform1S neg = Transform1S.identity().negate();
- Transform1S rot = Transform1S.identity().rotate(Geometry.HALF_PI);
+ Transform1S rot = Transform1S.identity().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act
Transform1S t = neg.premultiply(rot);
@@ -176,7 +176,7 @@
// assert
Assert.assertFalse(t.preservesOrientation());
Assert.assertTrue(t.isNegation());
- Assert.assertEquals(Geometry.HALF_PI, t.getRotation(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, t.getRotation(), TEST_EPS);
SphericalTestUtils.assertPointsEqual(HALF_PI, t.apply(ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(ZERO, t.apply(HALF_PI), TEST_EPS);
@@ -189,10 +189,10 @@
@Test
public void testHashCode() {
// arrange
- Transform1S a = Transform1S.identity().negate().rotate(Geometry.HALF_PI);
- Transform1S b = Transform1S.identity().rotate(Geometry.HALF_PI);
- Transform1S c = Transform1S.identity().negate().rotate(-Geometry.HALF_PI);
- Transform1S d = Transform1S.identity().negate().rotate(Geometry.HALF_PI);
+ Transform1S a = Transform1S.identity().negate().rotate(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S b = Transform1S.identity().rotate(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S c = Transform1S.identity().negate().rotate(-PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S d = Transform1S.identity().negate().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act/assert
Assert.assertTrue(a.equals(a));
@@ -210,10 +210,10 @@
@Test
public void testEquals() {
// arrange
- Transform1S a = Transform1S.identity().negate().rotate(Geometry.HALF_PI);
- Transform1S b = Transform1S.identity().rotate(Geometry.HALF_PI);
- Transform1S c = Transform1S.identity().negate().rotate(-Geometry.HALF_PI);
- Transform1S d = Transform1S.identity().negate().rotate(Geometry.HALF_PI);
+ Transform1S a = Transform1S.identity().negate().rotate(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S b = Transform1S.identity().rotate(PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S c = Transform1S.identity().negate().rotate(-PlaneAngleRadians.PI_OVER_TWO);
+ Transform1S d = Transform1S.identity().negate().rotate(PlaneAngleRadians.PI_OVER_TWO);
// act
int hash = a.hashCode();
@@ -244,7 +244,7 @@
private static void checkInverse(Transform1S t) {
Transform1S inv = t.inverse();
- for (double x = -Geometry.TWO_PI; x <= 2 * Geometry.TWO_PI; x += 0.2) {
+ for (double x = -PlaneAngleRadians.TWO_PI; x <= 2 * PlaneAngleRadians.TWO_PI; x += 0.2) {
Point1S pt = Point1S.of(x);
SphericalTestUtils.assertPointsEqual(pt, inv.apply(t.apply(pt)), TEST_EPS);
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/AbstractGreatArcPathConnectorTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/AbstractGreatArcPathConnectorTest.java
index 76ea922..1e42015 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/AbstractGreatArcPathConnectorTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/AbstractGreatArcPathConnectorTest.java
@@ -20,7 +20,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
import org.apache.commons.geometry.euclidean.threed.Vector3D;
@@ -90,8 +90,8 @@
GreatCircle upperBound = GreatCircle.fromPoleAndU(
Vector3D.of(0, 1, -1), Vector3D.Unit.PLUS_X , TEST_PRECISION);
- connector.add(XY_PLANE.arc(0, Geometry.PI));
- connector.add(upperBound.arc(Geometry.PI, 0));
+ connector.add(XY_PLANE.arc(0, PlaneAngleRadians.PI));
+ connector.add(upperBound.arc(PlaneAngleRadians.PI, 0));
// act
List<GreatArcPath> paths = connector.connectAll();
@@ -111,8 +111,8 @@
GreatCircle upperBound = GreatCircle.fromPoleAndU(
Vector3D.of(0, 1, -1), Vector3D.Unit.PLUS_X , TEST_PRECISION);
- connector.add(XY_PLANE.arc(0, Geometry.PI));
- connector.add(upperBound.arc(0, Geometry.PI));
+ connector.add(XY_PLANE.arc(0, PlaneAngleRadians.PI));
+ connector.add(upperBound.arc(0, PlaneAngleRadians.PI));
// act
List<GreatArcPath> paths = connector.connectAll();
@@ -156,23 +156,23 @@
public void testConnectAll_smallTriangleWithDisconnectedLuneAndArc() {
// arrange
Point2S p1 = Point2S.of(0, 0);
- Point2S p2 = Point2S.of(0, 0.1 * Geometry.PI);
- Point2S p3 = Point2S.of(0.1, 0.1 * Geometry.PI);
+ Point2S p2 = Point2S.of(0, 0.1 * PlaneAngleRadians.PI);
+ Point2S p3 = Point2S.of(0.1, 0.1 * PlaneAngleRadians.PI);
GreatArc luneEdge1 = GreatCircle.fromPoints(
Point2S.PLUS_J,
Point2S.MINUS_I,
TEST_PRECISION)
- .arc(0, Geometry.PI);
+ .arc(0, PlaneAngleRadians.PI);
GreatArc luneEdge2 = GreatCircle.fromPoints(
Point2S.MINUS_J,
- Point2S.of(Geometry.HALF_PI, 0.4 * Geometry.PI),
+ Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.4 * PlaneAngleRadians.PI),
TEST_PRECISION)
- .arc(0, Geometry.PI);
+ .arc(0, PlaneAngleRadians.PI);
GreatArc separateArc = GreatArc.fromPoints(
- Point2S.of(Geometry.MINUS_HALF_PI, 0.7 * Geometry.PI),
- Point2S.of(Geometry.MINUS_HALF_PI, 0.8 * Geometry.PI),
+ Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, 0.7 * PlaneAngleRadians.PI),
+ Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, 0.8 * PlaneAngleRadians.PI),
TEST_PRECISION);
// act
@@ -208,9 +208,9 @@
DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-1);
Point2S p1 = Point2S.PLUS_I;
- Point2S p2 = Point2S.of(1, Geometry.HALF_PI);
- Point2S p3 = Point2S.of(1.001, 0.491 * Geometry.PI);
- Point2S p4 = Point2S.of(1.001, 0.502 * Geometry.PI);
+ Point2S p2 = Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S p3 = Point2S.of(1.001, 0.491 * PlaneAngleRadians.PI);
+ Point2S p4 = Point2S.of(1.001, 0.502 * PlaneAngleRadians.PI);
connector.add(GreatArc.fromPoints(p2, p3, TEST_PRECISION));
connector.add(GreatArc.fromPoints(p2, p4, TEST_PRECISION));
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/ConvexArea2STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/ConvexArea2STest.java
index d626f96..7560311 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/ConvexArea2STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/ConvexArea2STest.java
@@ -21,7 +21,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.partitioning.Split;
@@ -54,7 +54,7 @@
Assert.assertTrue(area.isFull());
Assert.assertFalse(area.isEmpty());
Assert.assertEquals(0, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(4 * Geometry.PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(4 * PlaneAngleRadians.PI, area.getSize(), TEST_EPS);
Assert.assertNull(area.getBarycenter());
Assert.assertEquals(0, area.getBoundaries().size());
@@ -74,7 +74,7 @@
Assert.assertTrue(area.isFull());
Assert.assertFalse(area.isEmpty());
Assert.assertEquals(0, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(4 * Geometry.PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(4 * PlaneAngleRadians.PI, area.getSize(), TEST_EPS);
Assert.assertNull(area.getBarycenter());
Assert.assertEquals(0, area.getBoundaries().size());
@@ -96,8 +96,8 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(2 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(2 * Geometry.PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, area.getSize(), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_J, area.getBarycenter(), TEST_EPS);
checkBarycenterConsistency(area);
@@ -120,7 +120,7 @@
// arrange
GreatCircle a = GreatCircle.fromPoints(Point2S.PLUS_K, Point2S.PLUS_I, TEST_PRECISION);
GreatCircle b = GreatCircle.fromPoints(
- Point2S.of(0.25 * Geometry.PI, Geometry.HALF_PI), Point2S.PLUS_K, TEST_PRECISION);
+ Point2S.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO), Point2S.PLUS_K, TEST_PRECISION);
// act
ConvexArea2S area = ConvexArea2S.fromBounds(a, b);
@@ -128,9 +128,9 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(2 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.125 * Geometry.PI, Geometry.HALF_PI), area.getBarycenter(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.125 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO), area.getBarycenter(), TEST_EPS);
checkBarycenterConsistency(area);
List<GreatArc> arcs = sortArcs(area.getBoundaries());
@@ -139,12 +139,12 @@
checkArc(arcs.get(1), Point2S.MINUS_K, Point2S.PLUS_K);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(0.125 * Geometry.PI, 0.1),
- Point2S.of(0.125 * Geometry.PI, Geometry.HALF_PI),
- Point2S.of(0.125 * Geometry.PI, Geometry.PI - 0.1));
+ Point2S.of(0.125 * PlaneAngleRadians.PI, 0.1),
+ Point2S.of(0.125 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(0.125 * PlaneAngleRadians.PI, PlaneAngleRadians.PI - 0.1));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
- Point2S.PLUS_I, Point2S.of(0.25 * Geometry.PI, Geometry.HALF_PI),
+ Point2S.PLUS_I, Point2S.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO),
Point2S.PLUS_K, Point2S.MINUS_K);
SphericalTestUtils.checkClassify(area, RegionLocation.OUTSIDE,
@@ -163,9 +163,9 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(2 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.PI, area.getSize(), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0, 0.25 * Geometry.PI), area.getBarycenter(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, area.getSize(), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0, 0.25 * PlaneAngleRadians.PI), area.getBarycenter(), TEST_EPS);
checkBarycenterConsistency(area);
List<GreatArc> arcs = sortArcs(area.getBoundaries());
@@ -174,9 +174,9 @@
checkArc(arcs.get(1), Point2S.MINUS_J, Point2S.PLUS_J);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(0, 0.25 * Geometry.PI),
- Point2S.of(0.25, 0.4 * Geometry.PI),
- Point2S.of(-0.25, 0.4 * Geometry.PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI),
+ Point2S.of(0.25, 0.4 * PlaneAngleRadians.PI),
+ Point2S.of(-0.25, 0.4 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.PLUS_K,
@@ -184,8 +184,8 @@
SphericalTestUtils.checkClassify(area, RegionLocation.OUTSIDE,
Point2S.MINUS_I, Point2S.MINUS_K,
- Point2S.of(Geometry.PI, 0.25 * Geometry.PI),
- Point2S.of(Geometry.PI, 0.75 * Geometry.PI));
+ Point2S.of(PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI),
+ Point2S.of(PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI));
}
@Test
@@ -201,8 +201,8 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(1.5 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.assertPointsEq(expectedBarycenter, area.getBarycenter(), TEST_EPS);
@@ -216,12 +216,12 @@
checkArc(arcs.get(2), Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(0.25 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K,
- Point2S.of(0, 0.25 * Geometry.PI), Point2S.of(Geometry.HALF_PI, 0.304 * Geometry.PI),
- Point2S.of(0.25 * Geometry.PI, Geometry.HALF_PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.304 * PlaneAngleRadians.PI),
+ Point2S.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
SphericalTestUtils.checkClassify(area, RegionLocation.OUTSIDE,
Point2S.MINUS_I, Point2S.MINUS_J, Point2S.MINUS_K);
@@ -230,11 +230,11 @@
@Test
public void testFromBounds_triangle_small() {
// arrange
- double azMin = 1.125 * Geometry.PI;
- double azMax = 1.375 * Geometry.PI;
+ double azMin = 1.125 * PlaneAngleRadians.PI;
+ double azMax = 1.375 * PlaneAngleRadians.PI;
double azMid = 0.5 * (azMin + azMax);
double polarTop = 0.1;
- double polarBottom = 0.25 * Geometry.PI;
+ double polarBottom = 0.25 * PlaneAngleRadians.PI;
Point2S p1 = Point2S.of(azMin, polarBottom);
Point2S p2 = Point2S.of(azMax, polarBottom);
@@ -252,7 +252,7 @@
Assert.assertFalse(area.isEmpty());
Assert.assertEquals(p1.distance(p2) + p2.distance(p3) + p3.distance(p1),
area.getBoundarySize(), TEST_EPS);
- double size = Geometry.TWO_PI - a.angle(b) - b.angle(c) - c.angle(a);
+ double size = PlaneAngleRadians.TWO_PI - a.angle(b) - b.angle(c) - c.angle(a);
Assert.assertEquals(size, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(p1, p2, p3);
@@ -299,7 +299,7 @@
Assert.assertEquals(p1.distance(p2) + p2.distance(p3) + p3.distance(p4) + p4.distance(p1),
area.getBoundarySize(), TEST_EPS);
- double size = 2 * Geometry.PI - c1.angle(c2) - c2.angle(c3) - c3.angle(c4) - c4.angle(c1);
+ double size = 2 * PlaneAngleRadians.PI - c1.angle(c2) - c2.angle(c3) - c3.angle(c4) - c4.angle(c1);
Assert.assertEquals(size, area.getSize(), TEST_EPS);
checkBarycenterConsistency(area);
@@ -346,8 +346,8 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(1.5 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.MINUS_I, Point2S.MINUS_K, Point2S.MINUS_J);
SphericalTestUtils.assertPointsEq(expectedBarycenter, area.getBarycenter(), TEST_EPS);
@@ -361,7 +361,7 @@
checkArc(arcs.get(2), Point2S.MINUS_K, Point2S.MINUS_J);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(1.25 * Geometry.PI, 0.75 * Geometry.PI));
+ Point2S.of(1.25 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.MINUS_I, Point2S.MINUS_J, Point2S.MINUS_K);
@@ -392,9 +392,9 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(2 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.PI, area.getSize(), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0, 0.25 * Geometry.PI), area.getBarycenter(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, area.getSize(), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0, 0.25 * PlaneAngleRadians.PI), area.getBarycenter(), TEST_EPS);
checkBarycenterConsistency(area);
List<GreatArc> arcs = sortArcs(area.getBoundaries());
@@ -403,9 +403,9 @@
checkArc(arcs.get(1), Point2S.MINUS_J, Point2S.PLUS_J);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(-0.25 * Geometry.PI, 0.25 * Geometry.PI),
- Point2S.of(0, 0.25 * Geometry.PI),
- Point2S.of(0.25 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(-0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI),
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI),
+ Point2S.of(0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.PLUS_J,
@@ -428,8 +428,8 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(1.5 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.assertPointsEq(expectedBarycenter, area.getBarycenter(), TEST_EPS);
@@ -443,12 +443,12 @@
checkArc(arcs.get(2), Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(0.25 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K,
- Point2S.of(0, 0.25 * Geometry.PI), Point2S.of(Geometry.HALF_PI, 0.304 * Geometry.PI),
- Point2S.of(0.25 * Geometry.PI, Geometry.HALF_PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.304 * PlaneAngleRadians.PI),
+ Point2S.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
SphericalTestUtils.checkClassify(area, RegionLocation.OUTSIDE,
Point2S.MINUS_I, Point2S.MINUS_J, Point2S.MINUS_K);
@@ -463,10 +463,10 @@
// act
ConvexArea2S area = ConvexArea2S.fromVertices(Arrays.asList(
- p1, Point2S.of(1e-17, Geometry.HALF_PI), p2, p3, p3, p1), true, TEST_PRECISION);
+ p1, Point2S.of(1e-17, PlaneAngleRadians.PI_OVER_TWO), p2, p3, p3, p1), true, TEST_PRECISION);
// assert
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.assertPointsEq(expectedBarycenter, area.getBarycenter(), TEST_EPS);
@@ -487,7 +487,7 @@
}, IllegalStateException.class);
GeometryTestUtils.assertThrows(() -> {
- ConvexArea2S.fromVertices(Arrays.asList(Point2S.PLUS_I, Point2S.of(1e-16, Geometry.HALF_PI)), TEST_PRECISION);
+ ConvexArea2S.fromVertices(Arrays.asList(Point2S.PLUS_I, Point2S.of(1e-16, PlaneAngleRadians.PI_OVER_TWO)), TEST_PRECISION);
}, IllegalStateException.class);
}
@@ -504,8 +504,8 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(1.5 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.assertPointsEq(expectedBarycenter, area.getBarycenter(), TEST_EPS);
@@ -519,12 +519,12 @@
checkArc(arcs.get(2), Point2S.PLUS_J, Point2S.PLUS_K);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(0.25 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.PLUS_J, Point2S.PLUS_K,
- Point2S.of(0, 0.25 * Geometry.PI), Point2S.of(Geometry.HALF_PI, 0.304 * Geometry.PI),
- Point2S.of(0.25 * Geometry.PI, Geometry.HALF_PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.304 * PlaneAngleRadians.PI),
+ Point2S.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
SphericalTestUtils.checkClassify(area, RegionLocation.OUTSIDE,
Point2S.MINUS_I, Point2S.MINUS_J, Point2S.MINUS_K);
@@ -566,10 +566,10 @@
// assert
double[] angles = area.getInteriorAngles();
Assert.assertEquals(4, angles.length);
- Assert.assertEquals(Geometry.HALF_PI + 0.2, angles[0], TEST_EPS);
- Assert.assertEquals(Geometry.PI - c1.angle(c2), angles[1], TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI + 0.1, angles[2], TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, angles[3], TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO + 0.2, angles[0], TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI - c1.angle(c2), angles[1], TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO + 0.1, angles[2], TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, angles[3], TEST_EPS);
}
@Test
@@ -585,8 +585,8 @@
// assert
Assert.assertFalse(area.isFull());
Assert.assertFalse(area.isEmpty());
- Assert.assertEquals(1.5 * Geometry.PI, area.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, area.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, area.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, area.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.MINUS_J, Point2S.PLUS_I, Point2S.PLUS_K);
SphericalTestUtils.assertPointsEq(expectedBarycenter, area.getBarycenter(), TEST_EPS);
@@ -600,12 +600,12 @@
checkArc(arcs.get(2), Point2S.MINUS_J, Point2S.PLUS_I);
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE,
- Point2S.of(-0.25 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(-0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(area, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.MINUS_J, Point2S.PLUS_K,
- Point2S.of(0, 0.25 * Geometry.PI), Point2S.of(Geometry.MINUS_HALF_PI, 0.304 * Geometry.PI),
- Point2S.of(-0.25 * Geometry.PI, Geometry.HALF_PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, 0.304 * PlaneAngleRadians.PI),
+ Point2S.of(-0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
SphericalTestUtils.checkClassify(area, RegionLocation.OUTSIDE,
Point2S.PLUS_J, Point2S.MINUS_I, Point2S.MINUS_K);
@@ -622,14 +622,14 @@
ConvexArea2S area = ConvexArea2S.fromBounds(c1, c2);
// act/assert
- checkArc(area.trim(GreatArc.fromPoints(Point2S.of(0.1, Geometry.HALF_PI), Point2S.MINUS_I, TEST_PRECISION)),
- Point2S.PLUS_J, Point2S.of(0.75 * Geometry.PI, Geometry.HALF_PI));
+ checkArc(area.trim(GreatArc.fromPoints(Point2S.of(0.1, PlaneAngleRadians.PI_OVER_TWO), Point2S.MINUS_I, TEST_PRECISION)),
+ Point2S.PLUS_J, Point2S.of(0.75 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
- checkArc(area.trim(GreatArc.fromPoints(Point2S.MINUS_I, Point2S.of(0.2, Geometry.HALF_PI), TEST_PRECISION)),
- Point2S.of(0.75 * Geometry.PI, Geometry.HALF_PI), Point2S.PLUS_J);
+ checkArc(area.trim(GreatArc.fromPoints(Point2S.MINUS_I, Point2S.of(0.2, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION)),
+ Point2S.of(0.75 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO), Point2S.PLUS_J);
- checkArc(area.trim(GreatArc.fromPoints(Point2S.of(0.6 * Geometry.PI, 0.1), Point2S.of(0.7 * Geometry.PI, 0.8), TEST_PRECISION)),
- Point2S.of(0.6 * Geometry.PI, 0.1), Point2S.of(0.7 * Geometry.PI, 0.8));
+ checkArc(area.trim(GreatArc.fromPoints(Point2S.of(0.6 * PlaneAngleRadians.PI, 0.1), Point2S.of(0.7 * PlaneAngleRadians.PI, 0.8), TEST_PRECISION)),
+ Point2S.of(0.6 * PlaneAngleRadians.PI, 0.1), Point2S.of(0.7 * PlaneAngleRadians.PI, 0.8));
Assert.assertNull(area.trim(GreatArc.fromPoints(Point2S.MINUS_I, Point2S.MINUS_J, TEST_PRECISION)));
@@ -765,7 +765,7 @@
SphericalTestUtils.checkClassify(area, RegionLocation.INSIDE, barycenter);
GreatCircle circle = GreatCircle.fromPole(barycenter.getVector(), TEST_PRECISION);
- for (double az = 0; az <= Geometry.TWO_PI; az += 0.2) {
+ for (double az = 0; az <= PlaneAngleRadians.TWO_PI; az += 0.2) {
Point2S pt = circle.toSpace(Point1S.of(az));
GreatCircle splitter = GreatCircle.fromPoints(barycenter, pt, TEST_PRECISION);
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcPathTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcPathTest.java
index 7911f9d..52c13a3 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcPathTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcPathTest.java
@@ -24,7 +24,7 @@
import java.util.List;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
@@ -140,7 +140,7 @@
// arrange
DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-2);
- Point2S almostPlusI = Point2S.of(1e-4, Geometry.HALF_PI);
+ Point2S almostPlusI = Point2S.of(1e-4, PlaneAngleRadians.PI_OVER_TWO);
List<Point2S> points = Arrays.asList(
Point2S.PLUS_I,
@@ -232,9 +232,9 @@
public void testFromArcs() {
// arrange
Point2S ptA = Point2S.PLUS_I;
- Point2S ptB = Point2S.of(1, Geometry.HALF_PI);
- Point2S ptC = Point2S.of(1, Geometry.HALF_PI - 1);
- Point2S ptD = Point2S.of(2, Geometry.HALF_PI - 1);
+ Point2S ptB = Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S ptC = Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO - 1);
+ Point2S ptD = Point2S.of(2, PlaneAngleRadians.PI_OVER_TWO - 1);
GreatArc a = GreatArc.fromPoints(ptA, ptB, TEST_PRECISION);
GreatArc b = GreatArc.fromPoints(ptB, ptC, TEST_PRECISION);
@@ -327,7 +327,7 @@
Assert.assertFalse(tree.isFull());
Assert.assertFalse(tree.isEmpty());
- Assert.assertEquals(Geometry.TWO_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, tree.getSize(), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K, tree.getBarycenter(), TEST_EPS);
SphericalTestUtils.checkClassify(tree, RegionLocation.INSIDE, Point2S.PLUS_K);
@@ -350,7 +350,7 @@
Assert.assertFalse(tree.isFull());
Assert.assertFalse(tree.isEmpty());
- Assert.assertEquals(Geometry.HALF_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, tree.getSize(), TEST_EPS);
Point2S bc = Point2S.from(Point2S.PLUS_I.getVector()
.add(Point2S.PLUS_J.getVector())
@@ -369,8 +369,8 @@
Point2S a = Point2S.PLUS_I;
Point2S b = Point2S.PLUS_J;
Point2S c = Point2S.PLUS_K;
- Point2S d = Point2S.of(-1, Geometry.HALF_PI);
- Point2S e = Point2S.of(0, 0.6 * Geometry.PI);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S e = Point2S.of(0, 0.6 * PlaneAngleRadians.PI);
GreatArcPath.Builder builder = GreatArcPath.builder(TEST_PRECISION);
@@ -405,8 +405,8 @@
Point2S a = Point2S.PLUS_I;
Point2S b = Point2S.PLUS_J;
Point2S c = Point2S.PLUS_K;
- Point2S d = Point2S.of(-1, Geometry.HALF_PI);
- Point2S e = Point2S.of(0, 0.6 * Geometry.PI);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S e = Point2S.of(0, 0.6 * PlaneAngleRadians.PI);
GreatArcPath.Builder builder = GreatArcPath.builder(TEST_PRECISION);
@@ -441,8 +441,8 @@
Point2S a = Point2S.PLUS_I;
Point2S b = Point2S.PLUS_J;
Point2S c = Point2S.PLUS_K;
- Point2S d = Point2S.of(-1, Geometry.HALF_PI);
- Point2S e = Point2S.of(0, 0.6 * Geometry.PI);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S e = Point2S.of(0, 0.6 * PlaneAngleRadians.PI);
GreatArcPath.Builder builder = GreatArcPath.builder(TEST_PRECISION);
@@ -477,8 +477,8 @@
Point2S a = Point2S.PLUS_I;
Point2S b = Point2S.PLUS_J;
Point2S c = Point2S.PLUS_K;
- Point2S d = Point2S.of(-1, Geometry.HALF_PI);
- Point2S e = Point2S.of(0, 0.6 * Geometry.PI);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S e = Point2S.of(0, 0.6 * PlaneAngleRadians.PI);
GreatArcPath.Builder builder = GreatArcPath.builder(TEST_PRECISION);
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java
index 9d129c7..6160a9c 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.exception.GeometryException;
@@ -55,15 +55,15 @@
Assert.assertNull(arc.getStartPoint());
Assert.assertNull(arc.getEndPoint());
- Assert.assertEquals(Geometry.TWO_PI, arc.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, arc.getSize(), TEST_EPS);
- for (double az = 0; az < Geometry.TWO_PI; az += 0.1) {
- checkClassify(arc, RegionLocation.INSIDE, Point2S.of(az, Geometry.HALF_PI));
+ for (double az = 0; az < PlaneAngleRadians.TWO_PI; az += 0.1) {
+ checkClassify(arc, RegionLocation.INSIDE, Point2S.of(az, PlaneAngleRadians.PI_OVER_TWO));
}
checkClassify(arc, RegionLocation.OUTSIDE,
- Point2S.PLUS_K, Point2S.of(0, Geometry.HALF_PI + 0.1),
- Point2S.MINUS_K, Point2S.of(0, Geometry.HALF_PI - 0.1));
+ Point2S.PLUS_K, Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO + 0.1),
+ Point2S.MINUS_K, Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO - 0.1));
}
@Test
@@ -71,7 +71,7 @@
// arrange
GreatArc arc = GreatArc.fromInterval(
GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.PLUS_K, TEST_PRECISION),
- AngularInterval.Convex.of(Geometry.HALF_PI, 1.5 * Geometry.PI, TEST_PRECISION));
+ AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, 1.5 * PlaneAngleRadians.PI, TEST_PRECISION));
// assert
Assert.assertFalse(arc.isFull());
@@ -101,18 +101,18 @@
checkArc(arc, start, end);
- checkClassify(arc, RegionLocation.INSIDE, Point2S.of(0, 0.75 * Geometry.PI));
+ checkClassify(arc, RegionLocation.INSIDE, Point2S.of(0, 0.75 * PlaneAngleRadians.PI));
checkClassify(arc, RegionLocation.BOUNDARY, start, end);
checkClassify(arc, RegionLocation.OUTSIDE,
- Point2S.of(0, 0.25 * Geometry.PI), Point2S.of(Geometry.PI, 0.75 * Geometry.PI),
- Point2S.of(Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI),
+ Point2S.of(PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
}
@Test
public void testFromPoints_almostPi() {
// arrange
Point2S start = Point2S.PLUS_J;
- Point2S end = Point2S.of(1.5 * Geometry.PI, Geometry.HALF_PI - 1e-5);
+ Point2S end = Point2S.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO - 1e-5);
// act
GreatArc arc = GreatArc.fromPoints(start, end, TEST_PRECISION);
@@ -139,14 +139,14 @@
Vector3D.Unit.MINUS_Y,
GreatArc.fromPoints(
Point2S.PLUS_I,
- Point2S.of(Geometry.PI, Geometry.HALF_PI - 1e-5),
+ Point2S.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO - 1e-5),
TEST_PRECISION).getCircle().getPole(), TEST_EPS);
SphericalTestUtils.assertVectorsEqual(
Vector3D.Unit.PLUS_Y,
GreatArc.fromPoints(
Point2S.PLUS_I,
- Point2S.of(Geometry.PI, Geometry.HALF_PI + 1e-5),
+ Point2S.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO + 1e-5),
TEST_PRECISION).getCircle().getPole(), TEST_EPS);
}
@@ -154,7 +154,7 @@
public void testFromPoints_invalidPoints() {
// act/assert
GeometryTestUtils.assertThrows(() -> {
- GreatArc.fromPoints(Point2S.PLUS_I, Point2S.of(1e-12, Geometry.HALF_PI), TEST_PRECISION);
+ GreatArc.fromPoints(Point2S.PLUS_I, Point2S.of(1e-12, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
@@ -167,7 +167,7 @@
// arrange
GreatArc arc = GreatArc.fromInterval(
GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.MINUS_I, TEST_PRECISION),
- AngularInterval.Convex.of(0.0, Geometry.PI, TEST_PRECISION));
+ AngularInterval.Convex.of(0.0, PlaneAngleRadians.PI, TEST_PRECISION));
// act
List<GreatArc> result = arc.toConvex();
@@ -198,7 +198,7 @@
// arrange
GreatArc arc = GreatArc.fromInterval(
GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.MINUS_I, TEST_PRECISION),
- AngularInterval.Convex.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION));
+ AngularInterval.Convex.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION));
// act
GreatArc result = arc.reverse();
@@ -213,10 +213,10 @@
public void testTransform() {
// arrange
GreatArc arc = GreatCircle.fromPoints(Point2S.PLUS_K, Point2S.MINUS_I, TEST_PRECISION)
- .arc(Geometry.PI, Geometry.MINUS_HALF_PI);
+ .arc(PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO);
- Transform2S t = Transform2S.createRotation(Point2S.PLUS_I, Geometry.HALF_PI)
- .reflect(Point2S.of(-0.25 * Geometry.PI, Geometry.HALF_PI));
+ Transform2S t = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI_OVER_TWO)
+ .reflect(Point2S.of(-0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
// act
GreatArc result = arc.transform(t);
@@ -254,7 +254,7 @@
public void testSplit_both() {
// arrange
GreatArc arc = GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.PLUS_K, TEST_PRECISION)
- .arc(Geometry.HALF_PI, Geometry.PI);
+ .arc(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
GreatCircle splitter = GreatCircle.fromPole(Vector3D.of(0, 1, 1), TEST_PRECISION);
// act
@@ -265,18 +265,18 @@
GreatArc minus = split.getMinus();
Assert.assertSame(arc.getCircle(), minus.getCircle());
- checkArc(minus, Point2S.of(0, 0), Point2S.of(1.5 * Geometry.PI, 0.25 * Geometry.PI));
+ checkArc(minus, Point2S.of(0, 0), Point2S.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
GreatArc plus = split.getPlus();
Assert.assertSame(arc.getCircle(), plus.getCircle());
- checkArc(plus, Point2S.of(1.5 * Geometry.PI, 0.25 * Geometry.PI), Point2S.MINUS_J);
+ checkArc(plus, Point2S.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI), Point2S.MINUS_J);
}
@Test
public void testSplit_minus() {
// arrange
GreatArc arc = GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.PLUS_K, TEST_PRECISION)
- .arc(Geometry.HALF_PI, Geometry.PI);
+ .arc(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
GreatCircle splitter = GreatCircle.fromPole(Vector3D.Unit.PLUS_Z, TEST_PRECISION);
@@ -297,7 +297,7 @@
public void testSplit_plus() {
// arrange
GreatArc arc = GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.PLUS_K, TEST_PRECISION)
- .arc(Geometry.HALF_PI, Geometry.PI);
+ .arc(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI);
GreatCircle splitter = GreatCircle.fromPole(Vector3D.Unit.from(-1, 0, -1), TEST_PRECISION);
// act
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java
index b056834..f9c0200 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java
@@ -18,7 +18,7 @@
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.exception.GeometryException;
import org.apache.commons.geometry.core.partitioning.HyperplaneLocation;
@@ -62,26 +62,26 @@
public void testFromPoints() {
// act/assert
checkGreatCircle(GreatCircle.fromPoints(
- Point2S.of(0, Geometry.HALF_PI),
- Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION),
Z, X);
checkGreatCircle(GreatCircle.fromPoints(
- Point2S.of(0, Geometry.HALF_PI),
- Point2S.of(-0.1 * Geometry.PI, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(-0.1 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION),
Z.negate(), X);
checkGreatCircle(GreatCircle.fromPoints(
- Point2S.of(0, Geometry.HALF_PI),
- Point2S.of(1.5 * Geometry.PI, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION),
Z.negate(), X);
checkGreatCircle(GreatCircle.fromPoints(
Point2S.of(0, 0),
- Point2S.of(0, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION),
Y, Z);
}
@@ -89,8 +89,8 @@
@Test
public void testFromPoints_invalidPoints() {
// arrange
- Point2S p1 = Point2S.of(0, Geometry.HALF_PI);
- Point2S p2 = Point2S.of(Geometry.PI, Geometry.HALF_PI);
+ Point2S p1 = Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO);
+ Point2S p2 = Point2S.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO);
// act/assert
GeometryTestUtils.assertThrows(() -> {
@@ -98,7 +98,7 @@
}, GeometryException.class, Pattern.compile("^.*points are equal$"));
GeometryTestUtils.assertThrows(() -> {
- GreatCircle.fromPoints(p1, Point2S.of(1e-12, Geometry.HALF_PI), TEST_PRECISION);
+ GreatCircle.fromPoints(p1, Point2S.of(1e-12, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
}, GeometryException.class, Pattern.compile("^.*points are equal$"));
GeometryTestUtils.assertThrows(() -> {
@@ -117,11 +117,11 @@
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
- GreatCircle.fromPoints(p1, Point2S.of(Double.POSITIVE_INFINITY, Geometry.HALF_PI), TEST_PRECISION);
+ GreatCircle.fromPoints(p1, Point2S.of(Double.POSITIVE_INFINITY, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
}, GeometryException.class);
GeometryTestUtils.assertThrows(() -> {
- GreatCircle.fromPoints(Point2S.of(Double.POSITIVE_INFINITY, Geometry.HALF_PI), p2, TEST_PRECISION);
+ GreatCircle.fromPoints(Point2S.of(Double.POSITIVE_INFINITY, PlaneAngleRadians.PI_OVER_TWO), p2, TEST_PRECISION);
}, GeometryException.class);
}
@@ -134,18 +134,18 @@
// --- act/assert
// on circle
- for (double polar = Geometry.MINUS_HALF_PI; polar <= Geometry.HALF_PI; polar += 0.1) {
- Assert.assertEquals(0, circle.offset(Point2S.of(Geometry.HALF_PI, polar)), TEST_EPS);
- Assert.assertEquals(0, circle.offset(Point2S.of(Geometry.MINUS_HALF_PI, polar)), TEST_EPS);
+ for (double polar = PlaneAngleRadians.MINUS_PI_OVER_TWO; polar <= PlaneAngleRadians.PI_OVER_TWO; polar += 0.1) {
+ Assert.assertEquals(0, circle.offset(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, polar)), TEST_EPS);
+ Assert.assertEquals(0, circle.offset(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, polar)), TEST_EPS);
}
// +1/-1
- Assert.assertEquals(-1, circle.offset(Point2S.of(Geometry.HALF_PI + 1, Geometry.HALF_PI)), TEST_EPS);
- Assert.assertEquals(1, circle.offset(Point2S.of(Geometry.MINUS_HALF_PI + 1, Geometry.HALF_PI)), TEST_EPS);
+ Assert.assertEquals(-1, circle.offset(Point2S.of(PlaneAngleRadians.PI_OVER_TWO + 1, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
+ Assert.assertEquals(1, circle.offset(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO + 1, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
// poles
- Assert.assertEquals(Geometry.MINUS_HALF_PI, circle.offset(Point2S.of(Geometry.PI, Geometry.HALF_PI)), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, circle.offset(Point2S.of(0.0, Geometry.HALF_PI)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.MINUS_PI_OVER_TWO, circle.offset(Point2S.of(PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.offset(Point2S.of(0.0, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
}
@Test
@@ -163,19 +163,19 @@
Assert.assertEquals(0, circle.offset(Vector3D.of(0, 0, -1)), TEST_EPS);
// +1/-1
- Assert.assertEquals(-0.25 * Geometry.PI, circle.offset(Vector3D.of(-1, 1, 0)), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, circle.offset(Vector3D.of(-1, 0, 1)), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, circle.offset(Vector3D.of(-1, -1, 0)), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, circle.offset(Vector3D.of(-1, 0, -1)), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(-1, 1, 0)), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(-1, 0, 1)), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(-1, -1, 0)), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(-1, 0, -1)), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, circle.offset(Vector3D.of(1, 1, 0)), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, circle.offset(Vector3D.of(1, 0, 1)), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, circle.offset(Vector3D.of(1, -1, 0)), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, circle.offset(Vector3D.of(1, 0, -1)), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(1, 1, 0)), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(1, 0, 1)), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(1, -1, 0)), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, circle.offset(Vector3D.of(1, 0, -1)), TEST_EPS);
// poles
- Assert.assertEquals(Geometry.MINUS_HALF_PI, circle.offset(Vector3D.Unit.MINUS_X), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, circle.offset(Vector3D.Unit.PLUS_X), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.MINUS_PI_OVER_TWO, circle.offset(Vector3D.Unit.MINUS_X), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.offset(Vector3D.Unit.PLUS_X), TEST_EPS);
}
@Test
@@ -187,21 +187,21 @@
// --- act/assert
// on circle
- Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Point2S.from(Vector3D.of(0, 1, 0))), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.azimuth(Point2S.from(Vector3D.of(0, 1, 0))), TEST_EPS);
Assert.assertEquals(0.0, circle.azimuth(Point2S.from(Vector3D.of(0, 0, 1))), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(0, -1, 0))), TEST_EPS);
- Assert.assertEquals(Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(0, 0, -1))), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, circle.azimuth(Point2S.from(Vector3D.of(0, -1, 0))), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, circle.azimuth(Point2S.from(Vector3D.of(0, 0, -1))), TEST_EPS);
// +1/-1
- Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Point2S.from(Vector3D.of(-1, 1, 0))), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.azimuth(Point2S.from(Vector3D.of(-1, 1, 0))), TEST_EPS);
Assert.assertEquals(0.0, circle.azimuth(Point2S.from(Vector3D.of(-1, 0, 1))), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(-1, -1, 0))), TEST_EPS);
- Assert.assertEquals(Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(-1, 0, -1))), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, circle.azimuth(Point2S.from(Vector3D.of(-1, -1, 0))), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, circle.azimuth(Point2S.from(Vector3D.of(-1, 0, -1))), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Point2S.from(Vector3D.of(1, 1, 0))), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.azimuth(Point2S.from(Vector3D.of(1, 1, 0))), TEST_EPS);
Assert.assertEquals(0.0, circle.azimuth(Point2S.from(Vector3D.of(1, 0, 1))), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(1, -1, 0))), TEST_EPS);
- Assert.assertEquals(Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(1, 0, -1))), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, circle.azimuth(Point2S.from(Vector3D.of(1, -1, 0))), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, circle.azimuth(Point2S.from(Vector3D.of(1, 0, -1))), TEST_EPS);
// poles
Assert.assertEquals(0, circle.azimuth(Point2S.from(Vector3D.Unit.MINUS_X)), TEST_EPS);
@@ -217,21 +217,21 @@
// --- act/assert
// on circle
- Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Vector3D.of(0, 1, 0)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.azimuth(Vector3D.of(0, 1, 0)), TEST_EPS);
Assert.assertEquals(0.0, circle.azimuth(Vector3D.of(0, 0, 1)), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Vector3D.of(0, -1, 0)), TEST_EPS);
- Assert.assertEquals(Geometry.PI, circle.azimuth(Vector3D.of(0, 0, -1)), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, circle.azimuth(Vector3D.of(0, -1, 0)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, circle.azimuth(Vector3D.of(0, 0, -1)), TEST_EPS);
// +1/-1
- Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Vector3D.of(-1, 1, 0)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.azimuth(Vector3D.of(-1, 1, 0)), TEST_EPS);
Assert.assertEquals(0.0, circle.azimuth(Vector3D.of(-1, 0, 1)), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Vector3D.of(-1, -1, 0)), TEST_EPS);
- Assert.assertEquals(Geometry.PI, circle.azimuth(Vector3D.of(-1, 0, -1)), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, circle.azimuth(Vector3D.of(-1, -1, 0)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, circle.azimuth(Vector3D.of(-1, 0, -1)), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Vector3D.of(1, 1, 0)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, circle.azimuth(Vector3D.of(1, 1, 0)), TEST_EPS);
Assert.assertEquals(0.0, circle.azimuth(Vector3D.of(1, 0, 1)), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Vector3D.of(1, -1, 0)), TEST_EPS);
- Assert.assertEquals(Geometry.PI, circle.azimuth(Vector3D.of(1, 0, -1)), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, circle.azimuth(Vector3D.of(1, -1, 0)), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, circle.azimuth(Vector3D.of(1, 0, -1)), TEST_EPS);
// poles
Assert.assertEquals(0, circle.azimuth(Vector3D.Unit.MINUS_X), TEST_EPS);
@@ -246,10 +246,10 @@
// act/assert
SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Z, circle.vectorAt(0.0), TEST_EPS);
- SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Y, circle.vectorAt(Geometry.HALF_PI), TEST_EPS);
- SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Z, circle.vectorAt(Geometry.PI), TEST_EPS);
- SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Y, circle.vectorAt(Geometry.MINUS_HALF_PI), TEST_EPS);
- SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Z, circle.vectorAt(Geometry.TWO_PI), TEST_EPS);
+ SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Y, circle.vectorAt(PlaneAngleRadians.PI_OVER_TWO), TEST_EPS);
+ SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Z, circle.vectorAt(PlaneAngleRadians.PI), TEST_EPS);
+ SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Y, circle.vectorAt(PlaneAngleRadians.MINUS_PI_OVER_TWO), TEST_EPS);
+ SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Z, circle.vectorAt(PlaneAngleRadians.TWO_PI), TEST_EPS);
}
@Test
@@ -259,19 +259,19 @@
Vector3D.Unit.MINUS_X, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act/assert
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI),
- circle.project(Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI),
- circle.project(Point2S.of(Geometry.HALF_PI + 1, Geometry.HALF_PI)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI),
- circle.project(Point2S.of(Geometry.HALF_PI - 1, Geometry.HALF_PI)), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ circle.project(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ circle.project(Point2S.of(PlaneAngleRadians.PI_OVER_TWO + 1, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ circle.project(Point2S.of(PlaneAngleRadians.PI_OVER_TWO - 1, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI),
- circle.project(Point2S.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI),
- circle.project(Point2S.of(Geometry.MINUS_HALF_PI + 1, Geometry.HALF_PI)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.MINUS_HALF_PI, Geometry.HALF_PI),
- circle.project(Point2S.of(Geometry.MINUS_HALF_PI - 1, Geometry.HALF_PI)), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ circle.project(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ circle.project(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO + 1, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ circle.project(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO - 1, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
}
@Test
@@ -288,9 +288,9 @@
SphericalTestUtils.assertPointsEqual(Point2S.of(0.0, 0.0),
minusXCircle.project(Point2S.from(Vector3D.Unit.PLUS_X)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(1.5 * Geometry.PI, Geometry.HALF_PI),
+ SphericalTestUtils.assertPointsEqual(Point2S.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO),
plusZCircle.project(Point2S.from(Vector3D.Unit.PLUS_Z)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(1.5 * Geometry.PI, Geometry.HALF_PI),
+ SphericalTestUtils.assertPointsEqual(Point2S.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO),
plusZCircle.project(Point2S.from(Vector3D.Unit.MINUS_Z)), TEST_EPS);
}
@@ -310,11 +310,11 @@
public void testTransform_rotateAroundPole() {
// arrange
GreatCircle circle = GreatCircle.fromPoints(
- Point2S.of(0, Geometry.HALF_PI),
- Point2S.of(1, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION);
- Transform2S t = Transform2S.createRotation(circle.getPolePoint(), 0.25 * Geometry.PI);
+ Transform2S t = Transform2S.createRotation(circle.getPolePoint(), 0.25 * PlaneAngleRadians.PI);
// act
GreatCircle result = circle.transform(t);
@@ -328,11 +328,11 @@
public void testTransform_rotateAroundNonPole() {
// arrange
GreatCircle circle = GreatCircle.fromPoints(
- Point2S.of(0, Geometry.HALF_PI),
- Point2S.of(1, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION);
- Transform2S t = Transform2S.createRotation(Point2S.of(0, Geometry.HALF_PI), Geometry.HALF_PI);
+ Transform2S t = Transform2S.createRotation(Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO), PlaneAngleRadians.PI_OVER_TWO);
// act
GreatCircle result = circle.transform(t);
@@ -346,12 +346,12 @@
public void testTransform_piMinusAzimuth() {
// arrange
GreatCircle circle = GreatCircle.fromPoints(
- Point2S.of(0, Geometry.HALF_PI),
- Point2S.of(1, Geometry.HALF_PI),
+ Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO),
TEST_PRECISION);
Transform2S t = Transform2S.createReflection(Point2S.PLUS_J)
- .rotate(Point2S.PLUS_K, Geometry.PI);
+ .rotate(Point2S.PLUS_K, PlaneAngleRadians.PI);
// act
GreatCircle result = circle.transform(t);
@@ -402,8 +402,8 @@
GreatCircle circle = GreatCircle.fromPoleAndU(Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act/assert
- checkArc(circle.arc(Point2S.of(1, Geometry.HALF_PI), Point2S.of(0, 1)),
- Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI), Point2S.of(0, 0));
+ checkArc(circle.arc(Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO), Point2S.of(0, 1)),
+ Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), Point2S.of(0, 0));
Assert.assertTrue(circle.arc(Point2S.PLUS_I, Point2S.PLUS_I).isFull());
}
@@ -414,8 +414,8 @@
GreatCircle circle = GreatCircle.fromPoleAndU(Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act/assert
- checkArc(circle.arc(Point1S.of(Geometry.PI), Point1S.of(1.5 * Geometry.PI)),
- Point2S.of(0, Geometry.PI), Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI));
+ checkArc(circle.arc(Point1S.of(PlaneAngleRadians.PI), Point1S.of(1.5 * PlaneAngleRadians.PI)),
+ Point2S.of(0, PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO));
Assert.assertTrue(circle.arc(Point1S.of(1), Point1S.of(1)).isFull());
}
@@ -426,8 +426,8 @@
GreatCircle circle = GreatCircle.fromPoleAndU(Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act/assert
- checkArc(circle.arc(Geometry.PI, 1.5 * Geometry.PI),
- Point2S.of(0, Geometry.PI), Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI));
+ checkArc(circle.arc(PlaneAngleRadians.PI, 1.5 * PlaneAngleRadians.PI),
+ Point2S.of(0, PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO));
Assert.assertTrue(circle.arc(1, 1).isFull());
}
@@ -502,19 +502,19 @@
// act/assert
Assert.assertEquals(0, a.angle(a), TEST_EPS);
- Assert.assertEquals(Geometry.PI, a.angle(b), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, a.angle(b), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, a.angle(c), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, c.angle(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, a.angle(c), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, c.angle(a), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, a.angle(d), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, d.angle(a), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, a.angle(d), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, d.angle(a), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, a.angle(e), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, e.angle(a), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, a.angle(e), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, e.angle(a), TEST_EPS);
- Assert.assertEquals(0.75 * Geometry.PI, a.angle(f), TEST_EPS);
- Assert.assertEquals(0.75 * Geometry.PI, f.angle(a), TEST_EPS);
+ Assert.assertEquals(0.75 * PlaneAngleRadians.PI, a.angle(f), TEST_EPS);
+ Assert.assertEquals(0.75 * PlaneAngleRadians.PI, f.angle(a), TEST_EPS);
}
@Test
@@ -538,32 +538,32 @@
Assert.assertEquals(0, a.angle(a, Point2S.PLUS_J), TEST_EPS);
Assert.assertEquals(0, a.angle(a, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(-Geometry.PI, a.angle(b, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(-Geometry.PI, a.angle(b, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI, a.angle(b, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI, a.angle(b, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, a.angle(c, Point2S.PLUS_I), TEST_EPS);
- Assert.assertEquals(-Geometry.HALF_PI, a.angle(c, Point2S.MINUS_I), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, a.angle(c, Point2S.PLUS_I), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI_OVER_TWO, a.angle(c, Point2S.MINUS_I), TEST_EPS);
- Assert.assertEquals(-Geometry.HALF_PI, c.angle(a, Point2S.PLUS_I), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, c.angle(a, Point2S.MINUS_I), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI_OVER_TWO, c.angle(a, Point2S.PLUS_I), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, c.angle(a, Point2S.MINUS_I), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, a.angle(d, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(-Geometry.HALF_PI, a.angle(d, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, a.angle(d, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI_OVER_TWO, a.angle(d, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(-Geometry.HALF_PI, d.angle(a, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, d.angle(a, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(-PlaneAngleRadians.PI_OVER_TWO, d.angle(a, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, d.angle(a, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, a.angle(e, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, a.angle(e, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, a.angle(e, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, a.angle(e, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, e.angle(a, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(0.25 * Geometry.PI, e.angle(a, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, e.angle(a, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(0.25 * PlaneAngleRadians.PI, e.angle(a, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(0.75 * Geometry.PI, a.angle(f, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(-0.75 * Geometry.PI, a.angle(f, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(0.75 * PlaneAngleRadians.PI, a.angle(f, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(-0.75 * PlaneAngleRadians.PI, a.angle(f, Point2S.MINUS_J), TEST_EPS);
- Assert.assertEquals(-0.75 * Geometry.PI, f.angle(a, Point2S.PLUS_J), TEST_EPS);
- Assert.assertEquals(0.75 * Geometry.PI, f.angle(a, Point2S.MINUS_J), TEST_EPS);
+ Assert.assertEquals(-0.75 * PlaneAngleRadians.PI, f.angle(a, Point2S.PLUS_J), TEST_EPS);
+ Assert.assertEquals(0.75 * PlaneAngleRadians.PI, f.angle(a, Point2S.MINUS_J), TEST_EPS);
}
@Test
@@ -576,8 +576,8 @@
TEST_PRECISION);
// act/assert
- Assert.assertEquals(-0.25 * Geometry.PI, a.angle(b, Point2S.PLUS_I), TEST_EPS);
- Assert.assertEquals(-0.25 * Geometry.PI, a.angle(b, Point2S.MINUS_I), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, a.angle(b, Point2S.PLUS_I), TEST_EPS);
+ Assert.assertEquals(-0.25 * PlaneAngleRadians.PI, a.angle(b, Point2S.MINUS_I), TEST_EPS);
}
@Test
@@ -589,13 +589,13 @@
SphericalTestUtils.assertPointsEqual(Point1S.ZERO,
circle.toSubspace(Point2S.from(Vector3D.Unit.MINUS_Z)), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(0.25 * Geometry.PI),
+ SphericalTestUtils.assertPointsEqual(Point1S.of(0.25 * PlaneAngleRadians.PI),
circle.toSubspace(Point2S.from(Vector3D.of(-1, -1, -1))), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(0.75 * Geometry.PI),
+ SphericalTestUtils.assertPointsEqual(Point1S.of(0.75 * PlaneAngleRadians.PI),
circle.toSubspace(Point2S.from(Vector3D.of(-1, 1, 1))), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(1.25 * Geometry.PI),
+ SphericalTestUtils.assertPointsEqual(Point1S.of(1.25 * PlaneAngleRadians.PI),
circle.toSubspace(Point2S.from(Vector3D.of(1, -1, 1))), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point1S.of(1.75 * Geometry.PI),
+ SphericalTestUtils.assertPointsEqual(Point1S.of(1.75 * PlaneAngleRadians.PI),
circle.toSubspace(Point2S.from(Vector3D.of(1, 1, -1))), TEST_EPS);
SphericalTestUtils.assertPointsEqual(Point1S.ZERO,
@@ -614,13 +614,13 @@
circle.toSpace(Point1S.ZERO), TEST_EPS);
SphericalTestUtils.assertPointsEqual(Point2S.from(Vector3D.of(-1, 0, -1)),
- circle.toSpace(Point1S.of(0.25 * Geometry.PI)), TEST_EPS);
+ circle.toSpace(Point1S.of(0.25 * PlaneAngleRadians.PI)), TEST_EPS);
SphericalTestUtils.assertPointsEqual(Point2S.from(Vector3D.of(-1, 0, 1)),
- circle.toSpace(Point1S.of(0.75 * Geometry.PI)), TEST_EPS);
+ circle.toSpace(Point1S.of(0.75 * PlaneAngleRadians.PI)), TEST_EPS);
SphericalTestUtils.assertPointsEqual(Point2S.from(Vector3D.of(1, 0, 1)),
- circle.toSpace(Point1S.of(1.25 * Geometry.PI)), TEST_EPS);
+ circle.toSpace(Point1S.of(1.25 * PlaneAngleRadians.PI)), TEST_EPS);
SphericalTestUtils.assertPointsEqual(Point2S.from(Vector3D.of(1, 0, -1)),
- circle.toSpace(Point1S.of(1.75 * Geometry.PI)), TEST_EPS);
+ circle.toSpace(Point1S.of(1.75 * PlaneAngleRadians.PI)), TEST_EPS);
}
@Test
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java
index fbcdab6..afc37ff 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java
@@ -19,7 +19,7 @@
import java.util.Comparator;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
import org.apache.commons.geometry.euclidean.threed.Vector3D;
@@ -35,7 +35,7 @@
public void testProperties() {
for (int k = -2; k < 3; ++k) {
// arrange
- Point2S p = Point2S.of(1.0 + k * Geometry.TWO_PI, 1.4);
+ Point2S p = Point2S.of(1.0 + k * PlaneAngleRadians.TWO_PI, 1.4);
// act/assert
Assert.assertEquals(1.0, p.getAzimuth(), TEST_EPS);
@@ -70,16 +70,16 @@
@Test
public void testFrom_vector() {
// arrange
- double quarterPi = 0.25 * Geometry.PI;
+ double quarterPi = 0.25 * PlaneAngleRadians.PI;
// act/assert
- checkPoint(Point2S.from(Vector3D.of(1, 1, 0)), quarterPi, Geometry.HALF_PI);
+ checkPoint(Point2S.from(Vector3D.of(1, 1, 0)), quarterPi, PlaneAngleRadians.PI_OVER_TWO);
checkPoint(Point2S.from(Vector3D.of(1, 0, 1)), 0, quarterPi);
- checkPoint(Point2S.from(Vector3D.of(0, 1, 1)), Geometry.HALF_PI, quarterPi);
+ checkPoint(Point2S.from(Vector3D.of(0, 1, 1)), PlaneAngleRadians.PI_OVER_TWO, quarterPi);
- checkPoint(Point2S.from(Vector3D.of(1, -1, 0)), Geometry.TWO_PI - quarterPi, Geometry.HALF_PI);
- checkPoint(Point2S.from(Vector3D.of(-1, 0, -1)), Geometry.PI, Geometry.PI - quarterPi);
- checkPoint(Point2S.from(Vector3D.of(0, -1, -1)), Geometry.TWO_PI - Geometry.HALF_PI, Geometry.PI - quarterPi);
+ checkPoint(Point2S.from(Vector3D.of(1, -1, 0)), PlaneAngleRadians.TWO_PI - quarterPi, PlaneAngleRadians.PI_OVER_TWO);
+ checkPoint(Point2S.from(Vector3D.of(-1, 0, -1)), PlaneAngleRadians.PI, PlaneAngleRadians.PI - quarterPi);
+ checkPoint(Point2S.from(Vector3D.of(0, -1, -1)), PlaneAngleRadians.TWO_PI - PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI - quarterPi);
}
@Test
@@ -122,13 +122,13 @@
@Test
public void testDistance() {
// arrange
- Point2S a = Point2S.of(1.0, 0.5 * Geometry.PI);
- Point2S b = Point2S.of(a.getAzimuth() + 0.5 * Geometry.PI, a.getPolar());
+ Point2S a = Point2S.of(1.0, 0.5 * PlaneAngleRadians.PI);
+ Point2S b = Point2S.of(a.getAzimuth() + 0.5 * PlaneAngleRadians.PI, a.getPolar());
// act/assert
- Assert.assertEquals(0.5 * Geometry.PI, a.distance(b), 1.0e-10);
- Assert.assertEquals(Geometry.PI, a.distance(a.antipodal()), 1.0e-10);
- Assert.assertEquals(0.5 * Geometry.PI, Point2S.MINUS_I.distance(Point2S.MINUS_K), 1.0e-10);
+ Assert.assertEquals(0.5 * PlaneAngleRadians.PI, a.distance(b), 1.0e-10);
+ Assert.assertEquals(PlaneAngleRadians.PI, a.distance(a.antipodal()), 1.0e-10);
+ Assert.assertEquals(0.5 * PlaneAngleRadians.PI, Point2S.MINUS_I.distance(Point2S.MINUS_K), 1.0e-10);
Assert.assertEquals(0.0, Point2S.of(1.0, 0).distance(Point2S.of(2.0, 0)), 1.0e-10);
}
@@ -140,15 +140,15 @@
// act/assert
SphericalTestUtils.assertPointsEq(p1, p1.slerp(p2, 0), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.25 * Geometry.HALF_PI, Geometry.HALF_PI), p1.slerp(p2, 0.25), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.5 * Geometry.HALF_PI, Geometry.HALF_PI), p1.slerp(p2, 0.5), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.75 * Geometry.HALF_PI, Geometry.HALF_PI), p1.slerp(p2, 0.75), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.25 * PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), p1.slerp(p2, 0.25), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.5 * PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), p1.slerp(p2, 0.5), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.75 * PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), p1.slerp(p2, 0.75), TEST_EPS);
SphericalTestUtils.assertPointsEq(p2, p1.slerp(p2, 1), TEST_EPS);
SphericalTestUtils.assertPointsEq(p2, p2.slerp(p1, 0), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.75 * Geometry.HALF_PI, Geometry.HALF_PI), p2.slerp(p1, 0.25), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.5 * Geometry.HALF_PI, Geometry.HALF_PI), p2.slerp(p1, 0.5), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(0.25 * Geometry.HALF_PI, Geometry.HALF_PI), p2.slerp(p1, 0.75), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.75 * PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), p2.slerp(p1, 0.25), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.5 * PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), p2.slerp(p1, 0.5), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(0.25 * PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), p2.slerp(p1, 0.75), TEST_EPS);
SphericalTestUtils.assertPointsEq(p1, p2.slerp(p1, 1), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.MINUS_I, p1.slerp(p2, 2), TEST_EPS);
@@ -163,15 +163,15 @@
// act/assert
SphericalTestUtils.assertPointsEq(p1, p1.slerp(p2, 0), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, 0.75 * Geometry.HALF_PI), p1.slerp(p2, 0.25), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, 0.5 * Geometry.HALF_PI), p1.slerp(p2, 0.5), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, 0.25 * Geometry.HALF_PI), p1.slerp(p2, 0.75), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.75 * PlaneAngleRadians.PI_OVER_TWO), p1.slerp(p2, 0.25), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.5 * PlaneAngleRadians.PI_OVER_TWO), p1.slerp(p2, 0.5), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.25 * PlaneAngleRadians.PI_OVER_TWO), p1.slerp(p2, 0.75), TEST_EPS);
SphericalTestUtils.assertPointsEq(p2, p1.slerp(p2, 1), TEST_EPS);
SphericalTestUtils.assertPointsEq(p2, p2.slerp(p1, 0), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, 0.25 * Geometry.HALF_PI), p2.slerp(p1, 0.25), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, 0.5 * Geometry.HALF_PI), p2.slerp(p1, 0.5), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, 0.75 * Geometry.HALF_PI), p2.slerp(p1, 0.75), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.25 * PlaneAngleRadians.PI_OVER_TWO), p2.slerp(p1, 0.25), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.5 * PlaneAngleRadians.PI_OVER_TWO), p2.slerp(p1, 0.5), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.75 * PlaneAngleRadians.PI_OVER_TWO), p2.slerp(p1, 0.75), TEST_EPS);
SphericalTestUtils.assertPointsEq(p1, p2.slerp(p1, 1), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.MINUS_J, p1.slerp(p2, 2), TEST_EPS);
@@ -205,8 +205,8 @@
@Test
public void testAntipodal() {
- for (double az = -6 * Geometry.PI; az <= 6 * Geometry.PI; az += 0.1) {
- for (double p = 0; p <= Geometry.PI; p += 0.1) {
+ for (double az = -6 * PlaneAngleRadians.PI; az <= 6 * PlaneAngleRadians.PI; az += 0.1) {
+ for (double p = 0; p <= PlaneAngleRadians.PI; p += 0.1) {
// arrange
Point2S pt = Point2S.of(az, p);
@@ -214,7 +214,7 @@
Point2S result = pt.antipodal();
// assert
- Assert.assertEquals(Geometry.PI, pt.distance(result), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI, pt.distance(result), TEST_EPS);
Assert.assertEquals(-1, pt.getVector().dot(result.getVector()), TEST_EPS);
}
}
@@ -303,9 +303,9 @@
Point2S b = Point2S.of(0.0, 0.0);
Point2S c = Point2S.of(1.0, 0.0);
- Point2S d = Point2S.of(-1.0, Geometry.PI);
- Point2S e = Point2S.of(0.0, Geometry.PI);
- Point2S f = Point2S.of(-1.0, Geometry.PI);
+ Point2S d = Point2S.of(-1.0, PlaneAngleRadians.PI);
+ Point2S e = Point2S.of(0.0, PlaneAngleRadians.PI);
+ Point2S f = Point2S.of(-1.0, PlaneAngleRadians.PI);
// act/assert
Assert.assertTrue(a.equals(a));
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2STest.java
index 29b51b5..b52d99d 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2STest.java
@@ -21,7 +21,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.partitioning.Split;
@@ -241,10 +241,10 @@
public void testToConvex_doubleLune() {
// arrange
RegionBSPTree2S tree = GreatArcPath.builder(TEST_PRECISION)
- .append(EQUATOR.arc(0, Geometry.PI))
- .append(X_MERIDIAN.arc(Geometry.PI, 0))
- .append(EQUATOR.reverse().arc(0, Geometry.PI))
- .append(X_MERIDIAN.reverse().arc(Geometry.PI, 0))
+ .append(EQUATOR.arc(0, PlaneAngleRadians.PI))
+ .append(X_MERIDIAN.arc(PlaneAngleRadians.PI, 0))
+ .append(EQUATOR.reverse().arc(0, PlaneAngleRadians.PI))
+ .append(X_MERIDIAN.reverse().arc(PlaneAngleRadians.PI, 0))
.build()
.toTree();
@@ -255,17 +255,17 @@
Assert.assertEquals(2, result.size());
double size = result.stream().collect(Collectors.summingDouble(a -> a.getSize()));
- Assert.assertEquals(Geometry.TWO_PI, size, TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, size, TEST_EPS);
}
@Test
public void testToConvex_doubleLune_comlement() {
// arrange
RegionBSPTree2S tree = GreatArcPath.builder(TEST_PRECISION)
- .append(EQUATOR.arc(0, Geometry.PI))
- .append(X_MERIDIAN.arc(Geometry.PI, 0))
- .append(EQUATOR.reverse().arc(0, Geometry.PI))
- .append(X_MERIDIAN.reverse().arc(Geometry.PI, 0))
+ .append(EQUATOR.arc(0, PlaneAngleRadians.PI))
+ .append(X_MERIDIAN.arc(PlaneAngleRadians.PI, 0))
+ .append(EQUATOR.reverse().arc(0, PlaneAngleRadians.PI))
+ .append(X_MERIDIAN.reverse().arc(PlaneAngleRadians.PI, 0))
.build()
.toTree();
@@ -276,26 +276,26 @@
Assert.assertEquals(2, result.size());
double size = result.stream().collect(Collectors.summingDouble(a -> a.getSize()));
- Assert.assertEquals(Geometry.TWO_PI, size, TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, size, TEST_EPS);
}
@Test
public void testProject() {
// arrange
RegionBSPTree2S tree = RegionBSPTree2S.empty();
- tree.insert(EQUATOR.arc(0, Geometry.PI));
- tree.insert(X_MERIDIAN.arc(Geometry.PI, 0));
+ tree.insert(EQUATOR.arc(0, PlaneAngleRadians.PI));
+ tree.insert(X_MERIDIAN.arc(PlaneAngleRadians.PI, 0));
// act/assert
- SphericalTestUtils.assertPointsEq(Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI),
- tree.project(Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI + 0.2)), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO),
+ tree.project(Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO + 0.2)), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K,
- tree.project(Point2S.of(Geometry.MINUS_HALF_PI, 0.2)), TEST_EPS);
+ tree.project(Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, 0.2)), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_I,
- tree.project(Point2S.of(-0.5, Geometry.HALF_PI)), TEST_EPS);
+ tree.project(Point2S.of(-0.5, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.MINUS_I,
- tree.project(Point2S.of(Geometry.PI + 0.5, Geometry.HALF_PI)), TEST_EPS);
+ tree.project(Point2S.of(PlaneAngleRadians.PI + 0.5, PlaneAngleRadians.PI_OVER_TWO)), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K, tree.project(tree.getBarycenter()), TEST_EPS);
}
@@ -313,7 +313,7 @@
RegionBSPTree2S tree = RegionBSPTree2S.full();
// act/assert
- Assert.assertEquals(4 * Geometry.PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(4 * PlaneAngleRadians.PI, tree.getSize(), TEST_EPS);
Assert.assertNull(tree.getBarycenter());
Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);
@@ -344,8 +344,8 @@
tree.getRoot().cut(EQUATOR);
// act/assert
- Assert.assertEquals(Geometry.TWO_PI, tree.getSize(), TEST_EPS);
- Assert.assertEquals(Geometry.TWO_PI, tree.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, tree.getBoundarySize(), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K, tree.getBarycenter(), TEST_EPS);
checkBarycenterConsistency(tree);
@@ -370,16 +370,16 @@
public void testGeometricProperties_doubleLune() {
// act
RegionBSPTree2S tree = GreatArcPath.builder(TEST_PRECISION)
- .append(EQUATOR.arc(0, Geometry.PI))
- .append(X_MERIDIAN.arc(Geometry.PI, 0))
- .append(EQUATOR.reverse().arc(0, Geometry.PI))
- .append(X_MERIDIAN.reverse().arc(Geometry.PI, 0))
+ .append(EQUATOR.arc(0, PlaneAngleRadians.PI))
+ .append(X_MERIDIAN.arc(PlaneAngleRadians.PI, 0))
+ .append(EQUATOR.reverse().arc(0, PlaneAngleRadians.PI))
+ .append(X_MERIDIAN.reverse().arc(PlaneAngleRadians.PI, 0))
.build()
.toTree();
// assert
- Assert.assertEquals(2 * Geometry.PI, tree.getSize(), TEST_EPS);
- Assert.assertEquals(4 * Geometry.PI, tree.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(4 * PlaneAngleRadians.PI, tree.getBoundarySize(), TEST_EPS);
Assert.assertNull(tree.getBarycenter());
List<GreatArcPath> paths = tree.getBoundaryPaths();
@@ -389,12 +389,12 @@
assertPath(paths.get(1), Point2S.PLUS_I, Point2S.MINUS_I, Point2S.PLUS_I);
SphericalTestUtils.checkClassify(tree, RegionLocation.INSIDE,
- Point2S.of(0.5 * Geometry.PI, 0.25 * Geometry.PI),
- Point2S.of(1.5 * Geometry.PI, 0.75 * Geometry.PI));
+ Point2S.of(0.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI),
+ Point2S.of(1.5 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(tree, RegionLocation.OUTSIDE,
- Point2S.of(0.5 * Geometry.PI, 0.75 * Geometry.PI),
- Point2S.of(1.5 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(0.5 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI),
+ Point2S.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
}
@Test
@@ -406,8 +406,8 @@
.toTree();
// assert
- Assert.assertEquals(0.5 * Geometry.PI, tree.getSize(), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, tree.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(0.5 * PlaneAngleRadians.PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, tree.getBoundarySize(), TEST_EPS);
Point2S center = Point2S.from(Point2S.MINUS_K.getVector()
.add(Point2S.PLUS_I.getVector())
@@ -422,7 +422,7 @@
assertPath(paths.get(0), Point2S.MINUS_J, Point2S.MINUS_K, Point2S.PLUS_I, Point2S.MINUS_J);
SphericalTestUtils.checkClassify(tree, RegionLocation.INSIDE,
- Point2S.of(1.75 * Geometry.PI, 0.75 * Geometry.PI));
+ Point2S.of(1.75 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(tree, RegionLocation.OUTSIDE,
Point2S.PLUS_J, Point2S.PLUS_K, Point2S.MINUS_I);
@@ -440,8 +440,8 @@
tree.complement();
// assert
- Assert.assertEquals(3.5 * Geometry.PI, tree.getSize(), TEST_EPS);
- Assert.assertEquals(1.5 * Geometry.PI, tree.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(3.5 * PlaneAngleRadians.PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, tree.getBoundarySize(), TEST_EPS);
// Point2S center = Point2S.from(Point2S.MINUS_K.getVector()
// .add(Point2S.PLUS_I.getVector())
@@ -456,7 +456,7 @@
assertPath(paths.get(0), Point2S.MINUS_J, Point2S.PLUS_I, Point2S.MINUS_K, Point2S.MINUS_J);
SphericalTestUtils.checkClassify(tree, RegionLocation.OUTSIDE,
- Point2S.of(1.75 * Geometry.PI, 0.75 * Geometry.PI));
+ Point2S.of(1.75 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(tree, RegionLocation.INSIDE,
Point2S.PLUS_J, Point2S.PLUS_K, Point2S.MINUS_I);
@@ -551,8 +551,8 @@
// assert
Assert.assertFalse(tree.isFull());
Assert.assertFalse(tree.isEmpty());
- Assert.assertEquals(1.5 * Geometry.PI, tree.getBoundarySize(), TEST_EPS);
- Assert.assertEquals(Geometry.HALF_PI, tree.getSize(), TEST_EPS);
+ Assert.assertEquals(1.5 * PlaneAngleRadians.PI, tree.getBoundarySize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, tree.getSize(), TEST_EPS);
Point2S expectedBarycenter = triangleBarycenter(Point2S.MINUS_J, Point2S.PLUS_I, Point2S.PLUS_K);
SphericalTestUtils.assertPointsEq(expectedBarycenter, tree.getBarycenter(), TEST_EPS);
@@ -560,12 +560,12 @@
checkBarycenterConsistency(tree);
SphericalTestUtils.checkClassify(tree, RegionLocation.INSIDE,
- Point2S.of(-0.25 * Geometry.PI, 0.25 * Geometry.PI));
+ Point2S.of(-0.25 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SphericalTestUtils.checkClassify(tree, RegionLocation.BOUNDARY,
Point2S.PLUS_I, Point2S.MINUS_J, Point2S.PLUS_K,
- Point2S.of(0, 0.25 * Geometry.PI), Point2S.of(Geometry.MINUS_HALF_PI, 0.304 * Geometry.PI),
- Point2S.of(-0.25 * Geometry.PI, Geometry.HALF_PI));
+ Point2S.of(0, 0.25 * PlaneAngleRadians.PI), Point2S.of(PlaneAngleRadians.MINUS_PI_OVER_TWO, 0.304 * PlaneAngleRadians.PI),
+ Point2S.of(-0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
SphericalTestUtils.checkClassify(tree, RegionLocation.OUTSIDE,
Point2S.PLUS_J, Point2S.MINUS_I, Point2S.MINUS_K);
@@ -582,16 +582,16 @@
// act/assert
ConvexArea2S rootRegion = root.getNodeRegion();
- Assert.assertEquals(4 * Geometry.PI, rootRegion.getSize(), TEST_EPS);
+ Assert.assertEquals(4 * PlaneAngleRadians.PI, rootRegion.getSize(), TEST_EPS);
Assert.assertNull(rootRegion.getBarycenter());
ConvexArea2S minusRegion = minus.getNodeRegion();
- Assert.assertEquals(2 * Geometry.PI, minusRegion.getSize(), TEST_EPS);
+ Assert.assertEquals(2 * PlaneAngleRadians.PI, minusRegion.getSize(), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K, minusRegion.getBarycenter(), TEST_EPS);
ConvexArea2S minusPlusRegion = minusPlus.getNodeRegion();
- Assert.assertEquals(Geometry.PI, minusPlusRegion.getSize(), TEST_EPS);
- SphericalTestUtils.assertPointsEq(Point2S.of(1.5 * Geometry.PI, 0.25 * Geometry.PI),
+ Assert.assertEquals(PlaneAngleRadians.PI, minusPlusRegion.getSize(), TEST_EPS);
+ SphericalTestUtils.assertPointsEq(Point2S.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI),
minusPlusRegion.getBarycenter(), TEST_EPS);
}
@@ -684,7 +684,7 @@
SphericalTestUtils.checkClassify(region, RegionLocation.INSIDE, barycenter);
GreatCircle circle = GreatCircle.fromPole(barycenter.getVector(), TEST_PRECISION);
- for (double az = 0; az <= Geometry.TWO_PI; az += 0.2) {
+ for (double az = 0; az <= PlaneAngleRadians.TWO_PI; az += 0.2) {
Point2S pt = circle.toSpace(Point1S.of(az));
GreatCircle splitter = GreatCircle.fromPoints(barycenter, pt, TEST_PRECISION);
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/SubGreatCircleTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/SubGreatCircleTest.java
index 18ed3bd..3b431b5 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/SubGreatCircleTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/SubGreatCircleTest.java
@@ -18,7 +18,7 @@
import java.util.List;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.core.RegionLocation;
import org.apache.commons.geometry.core.Transform;
@@ -61,8 +61,8 @@
Assert.assertEquals(0, sub.getSize(), TEST_EPS);
- for (double az = 0; az <= Geometry.TWO_PI; az += 0.5) {
- for (double p = 0; p <= Geometry.PI; p += 0.5) {
+ for (double az = 0; az <= PlaneAngleRadians.TWO_PI; az += 0.5) {
+ for (double p = 0; p <= PlaneAngleRadians.PI; p += 0.5) {
checkClassify(sub, RegionLocation.OUTSIDE, Point2S.of(az, p));
}
}
@@ -79,15 +79,15 @@
Assert.assertTrue(sub.isFinite());
Assert.assertFalse(sub.isInfinite());
- Assert.assertEquals(Geometry.TWO_PI, sub.getSize(), TEST_EPS);
+ Assert.assertEquals(PlaneAngleRadians.TWO_PI, sub.getSize(), TEST_EPS);
- for (double az = 0; az < Geometry.TWO_PI; az += 0.1) {
- checkClassify(sub, RegionLocation.INSIDE, Point2S.of(az, Geometry.HALF_PI));
+ for (double az = 0; az < PlaneAngleRadians.TWO_PI; az += 0.1) {
+ checkClassify(sub, RegionLocation.INSIDE, Point2S.of(az, PlaneAngleRadians.PI_OVER_TWO));
}
checkClassify(sub, RegionLocation.OUTSIDE,
- Point2S.PLUS_K, Point2S.of(0, Geometry.HALF_PI + 0.1),
- Point2S.MINUS_K, Point2S.of(0, Geometry.HALF_PI - 0.1));
+ Point2S.PLUS_K, Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO + 0.1),
+ Point2S.MINUS_K, Point2S.of(0, PlaneAngleRadians.PI_OVER_TWO - 0.1));
}
@Test
@@ -103,8 +103,8 @@
Assert.assertEquals(0, sub.getSize(), TEST_EPS);
- for (double az = 0; az <= Geometry.TWO_PI; az += 0.5) {
- for (double p = 0; p <= Geometry.PI; p += 0.5) {
+ for (double az = 0; az <= PlaneAngleRadians.TWO_PI; az += 0.5) {
+ for (double p = 0; p <= PlaneAngleRadians.PI; p += 0.5) {
checkClassify(sub, RegionLocation.OUTSIDE, Point2S.of(az, p));
}
}
@@ -126,14 +126,14 @@
Assert.assertEquals(1, sub.getSize(), TEST_EPS);
- checkClassify(sub, RegionLocation.INSIDE, Point2S.of(1.5, Geometry.HALF_PI));
+ checkClassify(sub, RegionLocation.INSIDE, Point2S.of(1.5, PlaneAngleRadians.PI_OVER_TWO));
checkClassify(sub, RegionLocation.BOUNDARY,
- Point2S.of(1, Geometry.HALF_PI), Point2S.of(2, Geometry.HALF_PI));
+ Point2S.of(1, PlaneAngleRadians.PI_OVER_TWO), Point2S.of(2, PlaneAngleRadians.PI_OVER_TWO));
checkClassify(sub, RegionLocation.OUTSIDE,
- Point2S.of(0.5, Geometry.HALF_PI), Point2S.of(2.5, Geometry.HALF_PI),
- Point2S.of(1.5, 1), Point2S.of(1.5, Geometry.PI - 1));
+ Point2S.of(0.5, PlaneAngleRadians.PI_OVER_TWO), Point2S.of(2.5, PlaneAngleRadians.PI_OVER_TWO),
+ Point2S.of(1.5, 1), Point2S.of(1.5, PlaneAngleRadians.PI - 1));
}
@Test
@@ -141,11 +141,11 @@
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.PLUS_K, Point2S.MINUS_I, TEST_PRECISION);
RegionBSPTree1S region = RegionBSPTree1S.empty();
- region.add(AngularInterval.of(Geometry.PI, Geometry.MINUS_HALF_PI, TEST_PRECISION));
- region.add(AngularInterval.of(0, Geometry.HALF_PI, TEST_PRECISION));
+ region.add(AngularInterval.of(PlaneAngleRadians.PI, PlaneAngleRadians.MINUS_PI_OVER_TWO, TEST_PRECISION));
+ region.add(AngularInterval.of(0, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
- Transform2S t = Transform2S.createRotation(Point2S.PLUS_I, Geometry.HALF_PI)
- .reflect(Point2S.of(-0.25 * Geometry.PI, Geometry.HALF_PI));
+ Transform2S t = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI_OVER_TWO)
+ .reflect(Point2S.of(-0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO));
SubGreatCircle sub = new SubGreatCircle(circle, region);
@@ -223,8 +223,8 @@
RegionBSPTree1S tree = RegionBSPTree1S.empty();
tree.add(AngularInterval.of(0, 1, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION));
- tree.add(AngularInterval.of(Geometry.PI + 1, Geometry.PI + 2, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION));
+ tree.add(AngularInterval.of(PlaneAngleRadians.PI + 1, PlaneAngleRadians.PI + 2, TEST_PRECISION));
SubGreatCircle sub = new SubGreatCircle(circle, tree);
@@ -240,23 +240,23 @@
Assert.assertSame(sub.getCircle(), minus.getCircle());
List<GreatArc> minusArcs = minus.toConvex();
Assert.assertEquals(2, minusArcs.size());
- checkArc(minusArcs.get(0), Point2S.of(1.5 * Geometry.PI, 0.25 * Geometry.PI), Point2S.MINUS_J);
- checkArc(minusArcs.get(1), Point2S.of(1.5 * Geometry.PI, Geometry.HALF_PI + 1),
- Point2S.of(0.5 * Geometry.PI, (1.5 * Geometry.PI) - 2));
+ checkArc(minusArcs.get(0), Point2S.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI), Point2S.MINUS_J);
+ checkArc(minusArcs.get(1), Point2S.of(1.5 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO + 1),
+ Point2S.of(0.5 * PlaneAngleRadians.PI, (1.5 * PlaneAngleRadians.PI) - 2));
SubGreatCircle plus = split.getPlus();
Assert.assertSame(sub.getCircle(), plus.getCircle());
List<GreatArc> plusArcs = plus.toConvex();
Assert.assertEquals(2, plusArcs.size());
- checkArc(plusArcs.get(0), Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI), Point2S.of(Geometry.HALF_PI, Geometry.HALF_PI - 1));
- checkArc(plusArcs.get(1), Point2S.of(0, 0), Point2S.of(1.5 * Geometry.PI, 0.25 * Geometry.PI));
+ checkArc(plusArcs.get(0), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI_OVER_TWO - 1));
+ checkArc(plusArcs.get(1), Point2S.of(0, 0), Point2S.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
}
@Test
public void testSplit_minus() {
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.PLUS_K, TEST_PRECISION);
- RegionBSPTree1S tree = AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION).toTree();
+ RegionBSPTree1S tree = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION).toTree();
SubGreatCircle sub = new SubGreatCircle(circle, tree);
@@ -279,7 +279,7 @@
public void testSplit_plus() {
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.PLUS_K, TEST_PRECISION);
- RegionBSPTree1S tree = AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION).toTree();
+ RegionBSPTree1S tree = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION).toTree();
SubGreatCircle sub = new SubGreatCircle(circle, tree);
@@ -302,7 +302,7 @@
public void testSplit_parallelAndAntiparallel() {
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.PLUS_I, Point2S.PLUS_J, TEST_PRECISION);
- RegionBSPTree1S tree = AngularInterval.of(Geometry.HALF_PI, Geometry.PI, TEST_PRECISION).toTree();
+ RegionBSPTree1S tree = AngularInterval.of(PlaneAngleRadians.PI_OVER_TWO, PlaneAngleRadians.PI, TEST_PRECISION).toTree();
SubGreatCircle sub = new SubGreatCircle(circle, tree);
@@ -318,13 +318,13 @@
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.MINUS_K, Point2S.MINUS_J, TEST_PRECISION);
GreatCircle closeCircle = GreatCircle.fromPoints(Point2S.MINUS_K,
- Point2S.of((1.5 * Geometry.PI) - 1e-11, Geometry.HALF_PI), TEST_PRECISION);
+ Point2S.of((1.5 * PlaneAngleRadians.PI) - 1e-11, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
SubGreatCircle sub = new SubGreatCircle(circle);
// act
- sub.add(circle.arc(Point2S.of(1.5 * Geometry.PI, 0.75 * Geometry.PI), Point2S.MINUS_J));
- sub.add(closeCircle.arc(Point2S.PLUS_J, Point2S.of(1.5 * Geometry.PI, 0.75 * Geometry.PI)));
+ sub.add(circle.arc(Point2S.of(1.5 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI), Point2S.MINUS_J));
+ sub.add(closeCircle.arc(Point2S.PLUS_J, Point2S.of(1.5 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI)));
// assert
List<GreatArc> arcs = sub.toConvex();
@@ -338,12 +338,12 @@
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.MINUS_K, Point2S.MINUS_J, TEST_PRECISION);
GreatCircle otherCircle = GreatCircle.fromPoints(Point2S.MINUS_K,
- Point2S.of((1.5 * Geometry.PI) - 1e-2, Geometry.HALF_PI), TEST_PRECISION);
+ Point2S.of((1.5 * PlaneAngleRadians.PI) - 1e-2, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
SubGreatCircle sub = new SubGreatCircle(circle);
// act/assert
- sub.add(otherCircle.arc(Point2S.PLUS_J, Point2S.of(1.5 * Geometry.PI, 0.75 * Geometry.PI)));
+ sub.add(otherCircle.arc(Point2S.PLUS_J, Point2S.of(1.5 * PlaneAngleRadians.PI, 0.75 * PlaneAngleRadians.PI)));
}
@Test
@@ -351,16 +351,16 @@
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.MINUS_K, Point2S.MINUS_J, TEST_PRECISION);
GreatCircle closeCircle = GreatCircle.fromPoints(Point2S.MINUS_K,
- Point2S.of((1.5 * Geometry.PI) - 1e-11, Geometry.HALF_PI), TEST_PRECISION);
+ Point2S.of((1.5 * PlaneAngleRadians.PI) - 1e-11, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
SubGreatCircle sub = new SubGreatCircle(circle);
RegionBSPTree1S regionA = RegionBSPTree1S.empty();
- regionA.add(AngularInterval.of(Geometry.PI, 1.25 * Geometry.PI, TEST_PRECISION));
- regionA.add(AngularInterval.of(0.25 * Geometry.PI, Geometry.HALF_PI, TEST_PRECISION));
+ regionA.add(AngularInterval.of(PlaneAngleRadians.PI, 1.25 * PlaneAngleRadians.PI, TEST_PRECISION));
+ regionA.add(AngularInterval.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
RegionBSPTree1S regionB = RegionBSPTree1S.empty();
- regionB.add(AngularInterval.of(1.5 * Geometry.PI, 0.25 * Geometry.PI, TEST_PRECISION));
+ regionB.add(AngularInterval.of(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI, TEST_PRECISION));
// act
sub.add(new SubGreatCircle(circle, regionA));
@@ -370,7 +370,7 @@
List<GreatArc> arcs = sub.toConvex();
Assert.assertEquals(2, arcs.size());
- checkArc(arcs.get(0), Point2S.of(Geometry.HALF_PI, 0), Point2S.of(Geometry.HALF_PI, 0.25 * Geometry.PI));
+ checkArc(arcs.get(0), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.25 * PlaneAngleRadians.PI));
checkArc(arcs.get(1), Point2S.PLUS_J, Point2S.MINUS_J);
}
@@ -379,7 +379,7 @@
// arrange
GreatCircle circle = GreatCircle.fromPoints(Point2S.MINUS_K, Point2S.MINUS_J, TEST_PRECISION);
GreatCircle otherCircle = GreatCircle.fromPoints(Point2S.MINUS_K,
- Point2S.of((1.5 * Geometry.PI) - 1e-5, Geometry.HALF_PI), TEST_PRECISION);
+ Point2S.of((1.5 * PlaneAngleRadians.PI) - 1e-5, PlaneAngleRadians.PI_OVER_TWO), TEST_PRECISION);
SubGreatCircle sub = new SubGreatCircle(circle);
@@ -395,14 +395,14 @@
SubGreatCircle sub = new SubGreatCircle(circle);
RegionBSPTree1S region = RegionBSPTree1S.empty();
- region.add(AngularInterval.of(Geometry.PI, 1.25 * Geometry.PI, TEST_PRECISION));
- region.add(AngularInterval.of(0.25 * Geometry.PI, Geometry.HALF_PI, TEST_PRECISION));
+ region.add(AngularInterval.of(PlaneAngleRadians.PI, 1.25 * PlaneAngleRadians.PI, TEST_PRECISION));
+ region.add(AngularInterval.of(0.25 * PlaneAngleRadians.PI, PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION));
// act
SubGreatCircleBuilder builder = sub.builder();
builder.add(new SubGreatCircle(circle, region));
- builder.add(circle.arc(1.5 * Geometry.PI, 0.25 * Geometry.PI));
+ builder.add(circle.arc(1.5 * PlaneAngleRadians.PI, 0.25 * PlaneAngleRadians.PI));
SubGreatCircle result = builder.build();
@@ -410,7 +410,7 @@
List<GreatArc> arcs = result.toConvex();
Assert.assertEquals(2, arcs.size());
- checkArc(arcs.get(0), Point2S.of(Geometry.HALF_PI, 0), Point2S.of(Geometry.HALF_PI, 0.25 * Geometry.PI));
+ checkArc(arcs.get(0), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0), Point2S.of(PlaneAngleRadians.PI_OVER_TWO, 0.25 * PlaneAngleRadians.PI));
checkArc(arcs.get(1), Point2S.PLUS_J, Point2S.MINUS_J);
}
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Transform2STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Transform2STest.java
index 2c5a396..91def2b 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Transform2STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Transform2STest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.geometry.spherical.twod;
-import org.apache.commons.geometry.core.Geometry;
+import org.apache.commons.numbers.angle.PlaneAngleRadians;
import org.apache.commons.geometry.core.GeometryTestUtils;
import org.apache.commons.geometry.euclidean.threed.Vector3D;
import org.apache.commons.geometry.euclidean.threed.rotation.QuaternionRotation;
@@ -51,10 +51,10 @@
@Test
public void testRotation() {
// arrange
- Transform2S aroundPole = Transform2S.createRotation(Point2S.PLUS_K, Geometry.HALF_PI);
- Transform2S aroundX = Transform2S.createRotation(Vector3D.Unit.PLUS_X, -Geometry.HALF_PI);
+ Transform2S aroundPole = Transform2S.createRotation(Point2S.PLUS_K, PlaneAngleRadians.PI_OVER_TWO);
+ Transform2S aroundX = Transform2S.createRotation(Vector3D.Unit.PLUS_X, -PlaneAngleRadians.PI_OVER_TWO);
Transform2S aroundY = Transform2S.createRotation(
- QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act/assert
SphericalTestUtils.assertPointsEqual(Point2S.PLUS_J, aroundPole.apply(Point2S.PLUS_I), TEST_EPS);
@@ -77,9 +77,9 @@
public void testMultipleRotations() {
// act
Transform2S t = Transform2S.identity()
- .rotate(Point2S.PLUS_K, Geometry.HALF_PI)
- .rotate(Vector3D.Unit.PLUS_X, -Geometry.HALF_PI)
- .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI));
+ .rotate(Point2S.PLUS_K, PlaneAngleRadians.PI_OVER_TWO)
+ .rotate(Vector3D.Unit.PLUS_X, -PlaneAngleRadians.PI_OVER_TWO)
+ .rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// assert
SphericalTestUtils.assertPointsEqual(Point2S.MINUS_I, t.apply(Point2S.PLUS_I), TEST_EPS);
@@ -93,8 +93,8 @@
public void testMultiply() {
// act
Transform2S t = Transform2S.identity()
- .multiply(Transform2S.createRotation(Point2S.PLUS_K, Geometry.HALF_PI))
- .multiply(Transform2S.createRotation(Point2S.PLUS_J, Geometry.HALF_PI));
+ .multiply(Transform2S.createRotation(Point2S.PLUS_K, PlaneAngleRadians.PI_OVER_TWO))
+ .multiply(Transform2S.createRotation(Point2S.PLUS_J, PlaneAngleRadians.PI_OVER_TWO));
// assert
SphericalTestUtils.assertPointsEq(Point2S.MINUS_K, t.apply(Point2S.PLUS_I), TEST_EPS);
@@ -108,8 +108,8 @@
public void testPremultiply() {
// act
Transform2S t = Transform2S.identity()
- .premultiply(Transform2S.createRotation(Point2S.PLUS_K, Geometry.HALF_PI))
- .premultiply(Transform2S.createRotation(Point2S.PLUS_J, Geometry.HALF_PI));
+ .premultiply(Transform2S.createRotation(Point2S.PLUS_K, PlaneAngleRadians.PI_OVER_TWO))
+ .premultiply(Transform2S.createRotation(Point2S.PLUS_J, PlaneAngleRadians.PI_OVER_TWO));
// assert
SphericalTestUtils.assertPointsEqual(Point2S.PLUS_J, t.apply(Point2S.PLUS_I), TEST_EPS);
@@ -125,8 +125,8 @@
Point2S a = Point2S.of(1, 1);
Point2S b = Point2S.of(-1, 1);
- Point2S c = Point2S.of(1, Geometry.PI - 1);
- Point2S d = Point2S.of(-1, Geometry.PI - 1);
+ Point2S c = Point2S.of(1, PlaneAngleRadians.PI - 1);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI - 1);
// act
Transform2S t = Transform2S.createReflection(Point2S.PLUS_I);
@@ -138,11 +138,11 @@
SphericalTestUtils.assertPointsEqual(Point2S.PLUS_J, t.apply(Point2S.PLUS_J), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K, t.apply(Point2S.PLUS_K), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI - 1, 1), t.apply(a), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI + 1, 1), t.apply(b), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI - 1, 1), t.apply(a), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI + 1, 1), t.apply(b), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI - 1, Geometry.PI - 1), t.apply(c), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI + 1, Geometry.PI - 1), t.apply(d), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI - 1, PlaneAngleRadians.PI - 1), t.apply(c), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI + 1, PlaneAngleRadians.PI - 1), t.apply(d), TEST_EPS);
checkInverse(t);
}
@@ -153,8 +153,8 @@
Point2S a = Point2S.of(1, 1);
Point2S b = Point2S.of(-1, 1);
- Point2S c = Point2S.of(1, Geometry.PI - 1);
- Point2S d = Point2S.of(-1, Geometry.PI - 1);
+ Point2S c = Point2S.of(1, PlaneAngleRadians.PI - 1);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI - 1);
// act
Transform2S t = Transform2S.createReflection(Vector3D.Unit.PLUS_Y);
@@ -181,8 +181,8 @@
Point2S a = Point2S.of(1, 1);
Point2S b = Point2S.of(-1, 1);
- Point2S c = Point2S.of(1, Geometry.PI - 1);
- Point2S d = Point2S.of(-1, Geometry.PI - 1);
+ Point2S c = Point2S.of(1, PlaneAngleRadians.PI - 1);
+ Point2S d = Point2S.of(-1, PlaneAngleRadians.PI - 1);
// act
Transform2S t = Transform2S.identity()
@@ -196,11 +196,11 @@
SphericalTestUtils.assertPointsEqual(Point2S.MINUS_J, t.apply(Point2S.PLUS_J), TEST_EPS);
SphericalTestUtils.assertPointsEq(Point2S.PLUS_K, t.apply(Point2S.PLUS_K), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI + 1, 1), t.apply(a), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI - 1, 1), t.apply(b), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI + 1, 1), t.apply(a), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI - 1, 1), t.apply(b), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI + 1, Geometry.PI - 1), t.apply(c), TEST_EPS);
- SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.PI - 1, Geometry.PI - 1), t.apply(d), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI + 1, PlaneAngleRadians.PI - 1), t.apply(c), TEST_EPS);
+ SphericalTestUtils.assertPointsEqual(Point2S.of(PlaneAngleRadians.PI - 1, PlaneAngleRadians.PI - 1), t.apply(d), TEST_EPS);
checkInverse(t);
}
@@ -208,10 +208,10 @@
@Test
public void testHashcode() {
// arrange
- Transform2S a = Transform2S.createRotation(Point2S.PLUS_I, Geometry.HALF_PI);
- Transform2S b = Transform2S.createRotation(Point2S.PLUS_J, Geometry.HALF_PI);
- Transform2S c = Transform2S.createRotation(Point2S.PLUS_I, Geometry.PI);
- Transform2S d = Transform2S.createRotation(Point2S.PLUS_I, Geometry.HALF_PI);
+ Transform2S a = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI_OVER_TWO);
+ Transform2S b = Transform2S.createRotation(Point2S.PLUS_J, PlaneAngleRadians.PI_OVER_TWO);
+ Transform2S c = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI);
+ Transform2S d = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI_OVER_TWO);
// act
int hash = a.hashCode();
@@ -228,10 +228,10 @@
@Test
public void testEquals() {
// arrange
- Transform2S a = Transform2S.createRotation(Point2S.PLUS_I, Geometry.HALF_PI);
- Transform2S b = Transform2S.createRotation(Point2S.PLUS_J, Geometry.HALF_PI);
- Transform2S c = Transform2S.createRotation(Point2S.PLUS_I, Geometry.PI);
- Transform2S d = Transform2S.createRotation(Point2S.PLUS_I, Geometry.HALF_PI);
+ Transform2S a = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI_OVER_TWO);
+ Transform2S b = Transform2S.createRotation(Point2S.PLUS_J, PlaneAngleRadians.PI_OVER_TWO);
+ Transform2S c = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI);
+ Transform2S d = Transform2S.createRotation(Point2S.PLUS_I, PlaneAngleRadians.PI_OVER_TWO);
// act/assert
Assert.assertTrue(a.equals(a));
@@ -263,8 +263,8 @@
Transform2S inv = t.inverse();
// test non-pole points
- for (double az = -Geometry.TWO_PI; az <= 2 * Geometry.TWO_PI; az += 0.2) {
- for (double p = 0.1; p < Geometry.PI; p += 0.2) {
+ for (double az = -PlaneAngleRadians.TWO_PI; az <= 2 * PlaneAngleRadians.TWO_PI; az += 0.2) {
+ for (double p = 0.1; p < PlaneAngleRadians.PI; p += 0.2) {
Point2S pt = Point2S.of(az, p);
@@ -280,8 +280,8 @@
t.apply(inv.apply(Point2S.of(-1, 0))).getVector(), TEST_EPS);
SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Z,
- inv.apply(t.apply(Point2S.of(1, Geometry.PI))).getVector(), TEST_EPS);
+ inv.apply(t.apply(Point2S.of(1, PlaneAngleRadians.PI))).getVector(), TEST_EPS);
SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Z,
- t.apply(inv.apply(Point2S.of(-1, Geometry.PI))).getVector(), TEST_EPS);
+ t.apply(inv.apply(Point2S.of(-1, PlaneAngleRadians.PI))).getVector(), TEST_EPS);
}
}