You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/02/10 10:31:08 UTC

[commons-geometry] 02/03: GEOMETRY-11: using shorter and more consistent method names for DoublePrecisionContext

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git

commit f6de918dd4aff1b4291d5cf81f77807aad0ec413
Author: Matt Juntunen <ma...@hotmail.com>
AuthorDate: Fri Feb 8 18:47:43 2019 -0500

    GEOMETRY-11: using shorter and more consistent method names for DoublePrecisionContext
---
 .../core/precision/DoublePrecisionContext.java     | 16 ++---
 .../core/precision/DoublePrecisionContextTest.java | 80 +++++++++++-----------
 .../EpsilonDoublePrecisionContextTest.java         | 12 ++--
 .../commons/geometry/euclidean/oned/Vector1D.java  |  2 +-
 .../commons/geometry/euclidean/threed/Line.java    |  4 +-
 .../commons/geometry/euclidean/threed/Plane.java   | 10 +--
 .../geometry/euclidean/threed/PolyhedronsSet.java  |  6 +-
 .../geometry/euclidean/threed/Vector3D.java        |  6 +-
 .../commons/geometry/euclidean/twod/Line.java      |  6 +-
 .../geometry/euclidean/twod/PolygonsSet.java       | 12 ++--
 .../commons/geometry/euclidean/twod/Vector2D.java  |  4 +-
 .../euclidean/twod/hull/MonotoneChain.java         |  6 +-
 .../commons/geometry/spherical/oned/ArcsSet.java   |  2 +-
 .../commons/geometry/spherical/twod/Edge.java      |  2 +-
 .../geometry/spherical/twod/EdgesBuilder.java      |  2 +-
 .../spherical/twod/SphericalPolygonsSet.java       |  4 +-
 .../commons/geometry/spherical/twod/SubCircle.java |  2 +-
 17 files changed, 89 insertions(+), 87 deletions(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/DoublePrecisionContext.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/DoublePrecisionContext.java
index 1d36953..6773837 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/DoublePrecisionContext.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/DoublePrecisionContext.java
@@ -31,18 +31,18 @@ public abstract class DoublePrecisionContext implements Comparator<Double>, Seri
      * @param b second value
      * @return true if the given values are considered equal
      */
-    public boolean areEqual(final double a, final double b) {
+    public boolean eq(final double a, final double b) {
         return compare(a, b) == 0;
     }
 
     /** Return true if the given value is considered equal to zero. This is
-     * equivalent {@code context.areEqual(n, 0.0)} but with a more explicit
+     * equivalent {@code context.eq(n, 0.0)} but with a more explicit
      * method name.
      * @param n the number to compare to zero
      * @return true if the argument is considered equal to zero.
      */
-    public boolean isZero(final double n) {
-        return areEqual(n, 0.0);
+    public boolean eqZero(final double n) {
+        return eq(n, 0.0);
     }
 
     /**
@@ -51,7 +51,7 @@ public abstract class DoublePrecisionContext implements Comparator<Double>, Seri
      * @param b second value
      * @return true if {@code a < b}
      */
-    public boolean isLessThan(final double a, final double b) {
+    public boolean lt(final double a, final double b) {
         return compare(a, b) < 0;
     }
 
@@ -61,7 +61,7 @@ public abstract class DoublePrecisionContext implements Comparator<Double>, Seri
      * @param b second value
      * @return true if {@code a <= b}
      */
-    public boolean isLessThanOrEqual(final double a, final double b) {
+    public boolean lte(final double a, final double b) {
         return compare(a, b) <= 0;
     }
 
@@ -71,7 +71,7 @@ public abstract class DoublePrecisionContext implements Comparator<Double>, Seri
      * @param b second value
      * @return true if {@code a > b}
      */
-    public boolean isGreaterThan(final double a, final double b) {
+    public boolean gt(final double a, final double b) {
         return compare(a, b) > 0;
     }
 
@@ -81,7 +81,7 @@ public abstract class DoublePrecisionContext implements Comparator<Double>, Seri
      * @param b second value
      * @return true if {@code a >= b}
      */
-    public boolean isGreaterThanOrEqual(final double a, final double b) {
+    public boolean gte(final double a, final double b) {
         return compare(a, b) >= 0;
     }
 
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java
index f203e6d..80d9f8d 100644
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java
+++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java
@@ -25,72 +25,72 @@ public class DoublePrecisionContextTest {
     private StubContext ctx = new StubContext();
 
     @Test
-    public void testAreEqual() {
+    public void testEq() {
         // act/assert
-        Assert.assertTrue(ctx.areEqual(0.0, 0.0));
-        Assert.assertTrue(ctx.areEqual(1.0, 1.0));
-        Assert.assertTrue(ctx.areEqual(-1.0, -1.0));
+        Assert.assertTrue(ctx.eq(0.0, 0.0));
+        Assert.assertTrue(ctx.eq(1.0, 1.0));
+        Assert.assertTrue(ctx.eq(-1.0, -1.0));
 
-        Assert.assertFalse(ctx.areEqual(1.0, -1.0));
-        Assert.assertFalse(ctx.areEqual(1.0, Math.nextUp(1.0)));
-        Assert.assertFalse(ctx.areEqual(-1.0, Math.nextDown(1.0)));
+        Assert.assertFalse(ctx.eq(1.0, -1.0));
+        Assert.assertFalse(ctx.eq(1.0, Math.nextUp(1.0)));
+        Assert.assertFalse(ctx.eq(-1.0, Math.nextDown(1.0)));
     }
 
     @Test
-    public void testIsZero() {
+    public void testEqZero() {
         // act/assert
-        Assert.assertTrue(ctx.isZero(0.0));
+        Assert.assertTrue(ctx.eqZero(0.0));
 
-        Assert.assertFalse(ctx.isZero(Math.nextUp(0.0)));
-        Assert.assertFalse(ctx.isZero(Math.nextDown(-0.0)));
+        Assert.assertFalse(ctx.eqZero(Math.nextUp(0.0)));
+        Assert.assertFalse(ctx.eqZero(Math.nextDown(-0.0)));
     }
 
     @Test
-    public void testIsLessThan() {
+    public void testLt() {
         // act/assert
-        Assert.assertTrue(ctx.isLessThan(1, 2));
-        Assert.assertTrue(ctx.isLessThan(-2, -1));
+        Assert.assertTrue(ctx.lt(1, 2));
+        Assert.assertTrue(ctx.lt(-2, -1));
 
-        Assert.assertFalse(ctx.isLessThan(1, 1));
-        Assert.assertFalse(ctx.isLessThan(-1, -1));
-        Assert.assertFalse(ctx.isLessThan(2, 1));
-        Assert.assertFalse(ctx.isLessThan(-1, -2));
+        Assert.assertFalse(ctx.lt(1, 1));
+        Assert.assertFalse(ctx.lt(-1, -1));
+        Assert.assertFalse(ctx.lt(2, 1));
+        Assert.assertFalse(ctx.lt(-1, -2));
     }
 
     @Test
-    public void testIsLessThanOrEqual() {
+    public void testLte() {
         // act/assert
-        Assert.assertTrue(ctx.isLessThanOrEqual(1, 2));
-        Assert.assertTrue(ctx.isLessThanOrEqual(-2, -1));
-        Assert.assertTrue(ctx.isLessThanOrEqual(1, 1));
-        Assert.assertTrue(ctx.isLessThanOrEqual(-1, -1));
+        Assert.assertTrue(ctx.lte(1, 2));
+        Assert.assertTrue(ctx.lte(-2, -1));
+        Assert.assertTrue(ctx.lte(1, 1));
+        Assert.assertTrue(ctx.lte(-1, -1));
 
-        Assert.assertFalse(ctx.isLessThanOrEqual(2, 1));
-        Assert.assertFalse(ctx.isLessThanOrEqual(-1, -2));
+        Assert.assertFalse(ctx.lte(2, 1));
+        Assert.assertFalse(ctx.lte(-1, -2));
     }
 
     @Test
-    public void testIsGreaterThan() {
+    public void testGt() {
         // act/assert
-        Assert.assertTrue(ctx.isGreaterThan(2, 1));
-        Assert.assertTrue(ctx.isGreaterThan(-1, -2));
+        Assert.assertTrue(ctx.gt(2, 1));
+        Assert.assertTrue(ctx.gt(-1, -2));
 
-        Assert.assertFalse(ctx.isGreaterThan(1, 1));
-        Assert.assertFalse(ctx.isGreaterThan(-1, -1));
-        Assert.assertFalse(ctx.isGreaterThan(1, 2));
-        Assert.assertFalse(ctx.isGreaterThan(-2, -1));
+        Assert.assertFalse(ctx.gt(1, 1));
+        Assert.assertFalse(ctx.gt(-1, -1));
+        Assert.assertFalse(ctx.gt(1, 2));
+        Assert.assertFalse(ctx.gt(-2, -1));
     }
 
     @Test
-    public void testIsGreaterThanOrEqual() {
+    public void testGte() {
         // act/assert
-        Assert.assertTrue(ctx.isGreaterThanOrEqual(2, 1));
-        Assert.assertTrue(ctx.isGreaterThanOrEqual(-1, -2));
-        Assert.assertTrue(ctx.isGreaterThanOrEqual(1, 1));
-        Assert.assertTrue(ctx.isGreaterThanOrEqual(-1, -1));
+        Assert.assertTrue(ctx.gte(2, 1));
+        Assert.assertTrue(ctx.gte(-1, -2));
+        Assert.assertTrue(ctx.gte(1, 1));
+        Assert.assertTrue(ctx.gte(-1, -1));
 
-        Assert.assertFalse(ctx.isGreaterThanOrEqual(1, 2));
-        Assert.assertFalse(ctx.isGreaterThanOrEqual(-2, -1));
+        Assert.assertFalse(ctx.gte(1, 2));
+        Assert.assertFalse(ctx.gte(-2, -1));
     }
 
     @Test
@@ -119,6 +119,8 @@ public class DoublePrecisionContextTest {
 
     private static class StubContext extends DoublePrecisionContext {
 
+        private static final long serialVersionUID = 1L;
+
         @Override
         public double getMaxZero() {
             return 0.0;
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContextTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContextTest.java
index b94052b..8bbe10d 100644
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContextTest.java
+++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContextTest.java
@@ -126,13 +126,13 @@ public class EpsilonDoublePrecisionContextTest {
         double maxZero = ctx.getMaxZero();
 
         // act/assert
-        Assert.assertTrue(ctx.isZero(maxZero));
-        Assert.assertTrue(ctx.isZero(nextDown(maxZero, 1)));
-        Assert.assertFalse(ctx.isZero(nextUp(maxZero, 1)));
+        Assert.assertTrue(ctx.eqZero(maxZero));
+        Assert.assertTrue(ctx.eqZero(nextDown(maxZero, 1)));
+        Assert.assertFalse(ctx.eqZero(nextUp(maxZero, 1)));
 
-        Assert.assertTrue(ctx.isZero(-maxZero));
-        Assert.assertTrue(ctx.isZero(nextUp(-maxZero, 1)));
-        Assert.assertFalse(ctx.isZero(nextDown(-maxZero, 1)));
+        Assert.assertTrue(ctx.eqZero(-maxZero));
+        Assert.assertTrue(ctx.eqZero(nextUp(-maxZero, 1)));
+        Assert.assertFalse(ctx.eqZero(nextDown(-maxZero, 1)));
     }
 
     @Test
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 67a683a..07f3417 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
@@ -223,7 +223,7 @@ public class Vector1D extends EuclideanVector<Vector1D> {
     /** {@inheritDoc} */
     @Override
     public boolean equals(final Vector1D vec, final DoublePrecisionContext precision) {
-        return precision.areEqual(x, vec.x);
+        return precision.eq(x, vec.x);
     }
 
     /**
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java
index b587eb2..a804725 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java
@@ -158,7 +158,7 @@ public class Line implements Embedding<Vector3D, Vector1D> {
      */
     public boolean isSimilarTo(final Line line) {
         final double angle = direction.angle(line.direction);
-        return (precision.isZero(angle) || precision.areEqual(angle, Math.PI)) && contains(line.zero);
+        return (precision.eqZero(angle) || precision.eq(angle, Math.PI)) && contains(line.zero);
     }
 
     /** Check if the instance contains a point.
@@ -166,7 +166,7 @@ public class Line implements Embedding<Vector3D, Vector1D> {
      * @return true if p belongs to the line
      */
     public boolean contains(final Vector3D p) {
-        return precision.isZero(distance(p));
+        return precision.eqZero(distance(p));
     }
 
     /** Compute the distance between the instance and a point.
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
index 7bc7bc3..f390de6 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
@@ -277,8 +277,8 @@ public class Plane implements Hyperplane<Vector3D>, Embedding<Vector3D, Vector2D
     public boolean isSimilarTo(final Plane plane) {
         final double angle = w.angle(plane.w);
 
-        return ((precision.isZero(angle)) && precision.areEqual(originOffset, plane.originOffset)) ||
-                ((precision.areEqual(angle, Math.PI)) && precision.areEqual(originOffset, -plane.originOffset));
+        return ((precision.eqZero(angle)) && precision.eq(originOffset, plane.originOffset)) ||
+                ((precision.eq(angle, Math.PI)) && precision.eq(originOffset, -plane.originOffset));
     }
 
     /** Rotate the plane around the specified point.
@@ -326,7 +326,7 @@ public class Plane implements Hyperplane<Vector3D>, Embedding<Vector3D, Vector2D
     public Vector3D intersection(final Line line) {
         final Vector3D direction = line.getDirection();
         final double   dot       = w.dot(direction);
-        if (precision.isZero(dot)) {
+        if (precision.eqZero(dot)) {
             return null;
         }
         final Vector3D point = line.toSpace(Vector1D.ZERO);
@@ -341,7 +341,7 @@ public class Plane implements Hyperplane<Vector3D>, Embedding<Vector3D, Vector2D
      */
     public Line intersection(final Plane other) {
         final Vector3D direction = w.cross(other.w);
-        if (precision.isZero(direction.norm())) {
+        if (precision.eqZero(direction.norm())) {
             return null;
         }
         final Vector3D point = intersection(this, other, new Plane(direction, precision));
@@ -412,7 +412,7 @@ public class Plane implements Hyperplane<Vector3D>, Embedding<Vector3D, Vector2D
      * @return true if p belongs to the plane
      */
     public boolean contains(final Vector3D p) {
-        return precision.isZero(getOffset(p));
+        return precision.eqZero(getOffset(p));
     }
 
     /** Get the offset (oriented distance) of a parallel plane.
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/PolyhedronsSet.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/PolyhedronsSet.java
index 43d8ce6..6cdf088 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/PolyhedronsSet.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/PolyhedronsSet.java
@@ -151,7 +151,7 @@ public class PolyhedronsSet extends AbstractRegion<Vector3D, Vector2D> {
                                                       final double yMin, final double yMax,
                                                       final double zMin, final double zMax,
                                                       final DoublePrecisionContext precision) {
-        if (precision.areEqual(xMin, xMax) || precision.areEqual(yMin, yMax) || precision.areEqual(zMin, zMax)) {
+        if (precision.eq(xMin, xMax) || precision.eq(yMin, yMax) || precision.eq(zMin, zMax)) {
             // too thin box, build an empty polygons set
             return new BSPTree<>(Boolean.FALSE);
         }
@@ -181,7 +181,7 @@ public class PolyhedronsSet extends AbstractRegion<Vector3D, Vector2D> {
         for (int i = 0; i < vertices.size() - 1; ++i) {
             final Vector3D vi = vertices.get(i);
             for (int j = i + 1; j < vertices.size(); ++j) {
-                if (precision.isZero(vi.distance(vertices.get(j)))) {
+                if (precision.eqZero(vi.distance(vertices.get(j)))) {
                     throw new IllegalArgumentException("Vertices are too close near point " + vi);
                 }
             }
@@ -495,7 +495,7 @@ public class PolyhedronsSet extends AbstractRegion<Vector3D, Vector2D> {
 
         // establish search order
         final double offset = plane.getOffset(point);
-        final boolean in    = getPrecision().isZero(Math.abs(offset));
+        final boolean in    = getPrecision().eqZero(Math.abs(offset));
         final BSPTree<Vector3D> near;
         final BSPTree<Vector3D> far;
         if (offset < 0) {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
index e350ef7..232675c 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
@@ -374,9 +374,9 @@ public class Vector3D extends MultiDimensionalEuclideanVector<Vector3D> {
     /** {@inheritDoc} */
     @Override
     public boolean equals(final Vector3D vec, final DoublePrecisionContext precision) {
-        return precision.areEqual(x, vec.x) &&
-                precision.areEqual(y, vec.y) &&
-                precision.areEqual(z, vec.z);
+        return precision.eq(x, vec.x) &&
+                precision.eq(y, vec.y) &&
+                precision.eq(z, vec.z);
     }
 
     /**
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
index c0bc87e..892b952 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
@@ -231,7 +231,7 @@ public class Line implements Hyperplane<Vector2D>, Embedding<Vector2D, Vector1D>
      */
     public Vector2D intersection(final Line other) {
         final double d = LinearCombination.value(sin, other.cos, -other.sin, cos);
-        if (precision.isZero(d)) {
+        if (precision.eqZero(d)) {
             return null;
         }
         return Vector2D.of(LinearCombination.value(cos, other.originOffset, -other.cos, originOffset) / d,
@@ -311,7 +311,7 @@ public class Line implements Hyperplane<Vector2D>, Embedding<Vector2D, Vector1D>
      * @return true if p belongs to the line
      */
     public boolean contains(final Vector2D p) {
-        return precision.isZero(getOffset(p));
+        return precision.eqZero(getOffset(p));
     }
 
     /** Compute the distance between the instance and a point.
@@ -332,7 +332,7 @@ public class Line implements Hyperplane<Vector2D>, Embedding<Vector2D, Vector1D>
      * (they can have either the same or opposite orientations)
      */
     public boolean isParallelTo(final Line line) {
-        return precision.isZero(LinearCombination.value(sin, line.cos, -cos, line.sin));
+        return precision.eqZero(LinearCombination.value(sin, line.cos, -cos, line.sin));
     }
 
     /** Translate the line to force it passing by a point.
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolygonsSet.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolygonsSet.java
index 119e456..2d43b1a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolygonsSet.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolygonsSet.java
@@ -154,7 +154,7 @@ public class PolygonsSet extends AbstractRegion<Vector2D, Vector1D> {
     private static Line[] boxBoundary(final double xMin, final double xMax,
                                       final double yMin, final double yMax,
                                       final DoublePrecisionContext precision) {
-        if (precision.areEqual(xMin, xMax) || precision.areEqual(yMin, yMax)) {
+        if (precision.eq(xMin, xMax) || precision.eq(yMin, yMax)) {
             // too thin box, build an empty polygons set
             return null;
         }
@@ -221,7 +221,7 @@ public class PolygonsSet extends AbstractRegion<Vector2D, Vector1D> {
             // check if another vertex also happens to be on this line
             for (final Vertex vertex : vArray) {
                 if (vertex != start && vertex != end &&
-                    precision.isZero(line.getOffset(vertex.getLocation()))) {
+                    precision.eqZero(line.getOffset(vertex.getLocation()))) {
                     vertex.bindWith(line);
                 }
             }
@@ -283,9 +283,9 @@ public class PolygonsSet extends AbstractRegion<Vector2D, Vector1D> {
             if (edge != inserted) {
                 final double startOffset = inserted.getLine().getOffset(edge.getStart().getLocation());
                 final double endOffset   = inserted.getLine().getOffset(edge.getEnd().getLocation());
-                Side startSide = precision.isZero(Math.abs(startOffset)) ?
+                Side startSide = precision.eqZero(Math.abs(startOffset)) ?
                                  Side.HYPER : ((startOffset < 0) ? Side.MINUS : Side.PLUS);
-                Side endSide   = precision.isZero(endOffset) ?
+                Side endSide   = precision.eqZero(endOffset) ?
                                  Side.HYPER : ((endOffset < 0) ? Side.MINUS : Side.PLUS);
                 switch (startSide) {
                     case PLUS:
@@ -781,7 +781,7 @@ public class PolygonsSet extends AbstractRegion<Vector2D, Vector1D> {
                         }
                     }
                 }
-                if (getPrecision().isZero(min)) {
+                if (getPrecision().eqZero(min)) {
                     // connect the two segments
                     segment.setNext(selectedNext);
                     selectedNext.setPrevious(segment);
@@ -1082,7 +1082,7 @@ public class PolygonsSet extends AbstractRegion<Vector2D, Vector1D> {
                     }
                 }
 
-                if (precision.isZero(min)) {
+                if (precision.eqZero(min)) {
                     return selected;
                 }
             }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
index 582f66f..ccc7fe9 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
@@ -323,8 +323,8 @@ public class Vector2D extends MultiDimensionalEuclideanVector<Vector2D> {
     /** {@inheritDoc} */
     @Override
     public boolean equals(final Vector2D vec, final DoublePrecisionContext precision) {
-        return precision.areEqual(x, vec.x) &&
-                precision.areEqual(y, vec.y);
+        return precision.eq(x, vec.x) &&
+                precision.eq(y, vec.y);
     }
 
     /**
diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/MonotoneChain.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/MonotoneChain.java
index 043b79f..80a1686 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/MonotoneChain.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/MonotoneChain.java
@@ -137,7 +137,7 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D {
         if (hull.size() == 1) {
             // ensure that we do not add an identical point
             final Vector2D p1 = hull.get(0);
-            if (precision.isZero(p1.distance(point))) {
+            if (precision.eqZero(p1.distance(point))) {
                 return;
             }
         }
@@ -148,11 +148,11 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D {
             final Vector2D p2 = hull.get(size - 1);
 
             final double offset = new Line(p1, p2, precision).getOffset(point);
-            if (precision.isZero(offset)) {
+            if (precision.eqZero(offset)) {
                 // the point is collinear to the line (p1, p2)
 
                 final double distanceToCurrent = p1.distance(point);
-                if (precision.isZero(distanceToCurrent) || precision.isZero(p2.distance(point))) {
+                if (precision.eqZero(distanceToCurrent) || precision.eqZero(p2.distance(point))) {
                     // the point is assumed to be identical to either p1 or p2
                     return;
                 }
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/ArcsSet.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/ArcsSet.java
index 01866f4..2e8cc23 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/ArcsSet.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/ArcsSet.java
@@ -818,7 +818,7 @@ public class ArcsSet extends AbstractRegion<S1Point, S1Point> implements Iterabl
                 final int    j  = (i + 1) % limits.size();
                 final double lA = limits.get(i);
                 final double lB = PlaneAngleRadians.normalize(limits.get(j), lA);
-                if (getPrecision().areEqual(lB, lA)) {
+                if (getPrecision().eq(lB, lA)) {
                     // the two limits are too close to each other, we remove both of them
                     if (j > 0) {
                         // regular case, the two entries are consecutive ones
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Edge.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Edge.java
index e662c41..fd0181e 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Edge.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Edge.java
@@ -206,7 +206,7 @@ public class Edge {
     private Vertex addSubEdge(final Vertex subStart, final Vertex subEnd, final double subLength,
                               final List<Edge> list, final Circle splitCircle) {
 
-        if (circle.getPrecision().isZero(subLength)) {
+        if (circle.getPrecision().eqZero(subLength)) {
             // the edge is too short, we ignore it
             return subStart;
         }
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java
index 99c8814..6247eef 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java
@@ -138,7 +138,7 @@ class EdgesBuilder implements BSPTreeVisitor<S2Point> {
 
         if (following == null) {
             final Vector3D previousStart = previous.getStart().getLocation().getVector();
-            if (precision.isZero(point.getVector().angle(previousStart))) {
+            if (precision.eqZero(point.getVector().angle(previousStart))) {
                 // the edge connects back to itself
                 return previous;
             }
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java
index ee7c29a..83df5a6 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java
@@ -227,7 +227,7 @@ public class SphericalPolygonsSet extends AbstractRegion<S2Point, S1Point> {
             // check if another vertex also happens to be on this circle
             for (final Vertex vertex : vArray) {
                 if (vertex != start && vertex != end &&
-                    precision.isZero(circle.getOffset(vertex.getLocation()))) {
+                    precision.eqZero(circle.getOffset(vertex.getLocation()))) {
                     vertex.bindWith(circle);
                 }
             }
@@ -505,7 +505,7 @@ public class SphericalPolygonsSet extends AbstractRegion<S2Point, S1Point> {
         // convert to 3D sphere to spherical cap
         final double r = enclosing3D.getRadius();
         final double h = enclosing3D.getCenter().norm();
-        if (getPrecision().isZero(h)) {
+        if (getPrecision().eqZero(h)) {
             // the 3D sphere is centered on the unit sphere and covers it
             // fall back to a crude approximation, based only on outside convex cells
             EnclosingBall<S2Point> enclosingS2 =
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubCircle.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubCircle.java
index 58bdd27..bc8edca 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubCircle.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubCircle.java
@@ -53,7 +53,7 @@ public class SubCircle extends AbstractSubHyperplane<S2Point, S1Point> {
         final double angle = thisCircle.getPole().angle(otherCircle.getPole());
         final DoublePrecisionContext precision = thisCircle.getPrecision();
 
-        if (precision.isZero(angle) || precision.compare(angle, Math.PI) >= 0) {
+        if (precision.eqZero(angle) || precision.compare(angle, Math.PI) >= 0) {
             // the two circles are aligned or opposite
             return new SplitSubHyperplane<>(null, null);
         } else {