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 2020/01/07 15:14:39 UTC

[commons-geometry] 05/08: GEOMETRY-68: removing Equivalency interface in favor of defining eq() methods that accept DoublePrecisionContext objects as arguments

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 66740f454c4a4ff81afcf0d57b034c4b4d2b6e43
Author: Matt Juntunen <ma...@hotmail.com>
AuthorDate: Fri Jan 3 22:30:37 2020 -0500

    GEOMETRY-68: removing Equivalency interface in favor of defining eq() methods that accept DoublePrecisionContext objects as arguments
---
 .../apache/commons/geometry/core/Equivalency.java  | 33 --------------------
 .../geometry/euclidean/oned/OrientedPoint.java     | 32 ++++++++------------
 .../commons/geometry/euclidean/threed/Line3D.java  | 30 ++++++-------------
 .../geometry/euclidean/threed/LinecastPoint3D.java | 34 +++++++++------------
 .../commons/geometry/euclidean/threed/Plane.java   | 34 +++++++--------------
 .../geometry/euclidean/threed/SubPlane.java        |  2 +-
 .../commons/geometry/euclidean/twod/Line.java      | 34 +++++++--------------
 .../geometry/euclidean/twod/LinecastPoint2D.java   | 35 +++++++++-------------
 .../commons/geometry/euclidean/twod/SubLine.java   |  2 +-
 .../geometry/euclidean/oned/OrientedPointTest.java | 17 +++++------
 .../geometry/euclidean/threed/Line3DTest.java      | 35 ++++++++++------------
 .../euclidean/threed/LinecastPoint3DTest.java      | 10 +++----
 .../geometry/euclidean/threed/PlaneTest.java       | 14 ++++-----
 .../commons/geometry/euclidean/twod/LineTest.java  | 35 ++++++++++------------
 .../euclidean/twod/LinecastPoint2DTest.java        | 10 +++----
 .../euclidean/twod/RegionBSPTree2DTest.java        |  2 +-
 .../commons/geometry/spherical/oned/CutAngle.java  | 30 +++++++------------
 .../geometry/spherical/twod/GreatCircle.java       | 24 +++++++--------
 .../geometry/spherical/twod/SubGreatCircle.java    |  2 +-
 .../geometry/spherical/oned/CutAngleTest.java      | 16 +++++-----
 .../geometry/spherical/twod/GreatCircleTest.java   | 20 ++++++-------
 21 files changed, 172 insertions(+), 279 deletions(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Equivalency.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Equivalency.java
deleted file mode 100644
index 64b47de..0000000
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Equivalency.java
+++ /dev/null
@@ -1,33 +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;
-
-/** Interface for determining equivalency, not exact equality, between
- * two objects. This is performs a function similar to {@link Object#equals(Object)}
- * but allows fuzzy comparisons to occur instead of strict equality. This is
- * especially useful when comparing objects with floating point values that
- * may not be exact but are operationally equivalent.
- * @param <T> The type being compared
- */
-public interface Equivalency<T> {
-
-    /** Determine if this object is equivalent (effectively equal) to the argument.
-     * @param other the object to compare for equivalency
-     * @return true if this object is equivalent to the argument; false otherwise
-     */
-    boolean eq(T other);
-}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
index 78491a9..4973dca 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
@@ -20,7 +20,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.RegionLocation;
 import org.apache.commons.geometry.core.Transform;
 import org.apache.commons.geometry.core.partitioning.AbstractHyperplane;
@@ -39,7 +38,7 @@ import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
  * <p>Instances of this class are guaranteed to be immutable.</p>
  */
 public final class OrientedPoint extends AbstractHyperplane<Vector1D>
-    implements Hyperplane<Vector1D>, Equivalency<OrientedPoint> {
+    implements Hyperplane<Vector1D> {
     /** Hyperplane location as a point. */
     private final Vector1D point;
 
@@ -184,27 +183,20 @@ public final class OrientedPoint extends AbstractHyperplane<Vector1D>
         return new SubOrientedPoint(this);
     }
 
-    /** {@inheritDoc}
-     *
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison.
      * <p>Instances are considered equivalent if they
-     * <ul>
-     *  <li>contain equal {@link DoublePrecisionContext precision contexts},</li>
-     *  <li>have equivalent locations as evaluated by the precision context, and</li>
-     *  <li>point in the same direction</li>
-     * </ul>
+     * <ol>
+     *      <li>have equivalent locations and</li>
+     *      <li>point in the same direction.</li>
+     * </ol>
      * @param other the point to compare with
+     * @param precision precision context to use for the comparison
      * @return true if this instance should be considered equivalent to the argument
+     * @see Vector1D#eq(Vector1D, DoublePrecisionContext)
      */
-    @Override
-    public boolean eq(final OrientedPoint other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getPrecision();
-
-        return precision.equals(other.getPrecision()) &&
-                point.eq(other.point, precision) &&
+    public boolean eq(final OrientedPoint other, final DoublePrecisionContext precision) {
+        return point.eq(other.point, precision) &&
                 positiveFacing == other.positiveFacing;
     }
 
@@ -525,7 +517,7 @@ public final class OrientedPoint extends AbstractHyperplane<Vector1D>
             final OrientedPoint baseHyper = base.getHyperplane();
             final OrientedPoint inputHyper = (OrientedPoint) sub.getHyperplane();
 
-            if (!baseHyper.eq(inputHyper)) {
+            if (!baseHyper.eq(inputHyper, baseHyper.getPrecision())) {
                 throw new IllegalArgumentException("Argument is not on the same " +
                         "hyperplane. Expected " + baseHyper + " but was " +
                         inputHyper);
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line3D.java
index fe16fba..5eb1f0b 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line3D.java
@@ -19,7 +19,6 @@ package org.apache.commons.geometry.euclidean.threed;
 import java.util.Objects;
 
 import org.apache.commons.geometry.core.Embedding;
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.Transform;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
 import org.apache.commons.geometry.euclidean.oned.AffineTransformMatrix1D;
@@ -30,7 +29,7 @@ import org.apache.commons.geometry.euclidean.oned.Vector1D;
  *
  * <p>Instances of this class are guaranteed to be immutable.</p>
  */
-public final class Line3D implements Embedding<Vector3D, Vector1D>, Equivalency<Line3D> {
+public final class Line3D implements Embedding<Vector3D, Vector1D> {
     /** Line point closest to the origin. */
     private final Vector3D origin;
 
@@ -320,28 +319,17 @@ public final class Line3D implements Embedding<Vector3D, Vector1D>, Equivalency<
         return new SubLine3D(this);
     }
 
-    /**{@inheritDoc}
-     *
-     * <p>Instances are considered equivalent if they</p>
-     * <ul>
-     *   <li>contain equal {@link DoublePrecisionContext precision contexts},</li>
-     *   <li>have equivalent origin locations (as evaluated by the precision context), and</li>
-     *   <li>point in the same direction (as evaluated by the precision context)</li>
-     * </ul>
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison. Instances are considered equivalent if they have
+     * equivalent {@code origin}s and {@code direction}s.
      * @param other the point to compare with
+     * @param ctx precision context to use for the comparison
      * @return true if this instance should be considered equivalent to the argument
+     * @see Vector3D#eq(Vector3D, DoublePrecisionContext)
      */
-    @Override
-    public boolean eq(final Line3D other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext testPrecision = getPrecision();
-
-        return testPrecision.equals(other.getPrecision()) &&
-                getOrigin().eq(other.getOrigin(), precision) &&
-                getDirection().eq(other.getDirection(), precision);
+    public boolean eq(final Line3D other, final DoublePrecisionContext ctx) {
+        return getOrigin().eq(other.getOrigin(), ctx) &&
+                getDirection().eq(other.getDirection(), ctx);
     }
 
     /** {@inheritDoc} */
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3D.java
index e1776e4..cc1e6e4 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3D.java
@@ -22,7 +22,6 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.ListIterator;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
 import org.apache.commons.geometry.euclidean.AbstractLinecastPoint;
 
@@ -31,8 +30,7 @@ import org.apache.commons.geometry.euclidean.AbstractLinecastPoint;
  * of the target at the point of intersection.
  * @see Linecastable3D
  */
-public class LinecastPoint3D extends AbstractLinecastPoint<Vector3D, Vector3D.Unit, Line3D>
-    implements Equivalency<LinecastPoint3D> {
+public class LinecastPoint3D extends AbstractLinecastPoint<Vector3D, Vector3D.Unit, Line3D>  {
 
     /** Comparator that sorts intersection instances by increasing abscissa order. If two abscissa
      * values are equal, the comparison uses {@link Vector3D#COORDINATE_ASCENDING_ORDER} with the
@@ -55,28 +53,22 @@ public class LinecastPoint3D extends AbstractLinecastPoint<Vector3D, Vector3D.Un
         super(point, normal.normalize(), line);
     }
 
-    /** {@inheritDoc}
-     *
-     * <p>
-     * Instances are considered equivalent if they have equivalent points, normals, and lines.
-     * </p>
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison. Instances are considered equivalent if they have
+     * equivalent points, normals, and lines.
+     * @param other other point to compare with
+     * @param precision context to use for the comparison
+     * @return true if this instance should be considered equivalent to the argument
      */
-    @Override
-    public boolean eq(final LinecastPoint3D other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getLine().getPrecision();
-
-        return getLine().eq(other.getLine()) &&
+    public boolean eq(final LinecastPoint3D other, final DoublePrecisionContext precision) {
+        return getLine().eq(other.getLine(), precision) &&
                 getPoint().eq(other.getPoint(), precision) &&
                 getNormal().eq(other.getNormal(), precision);
     }
 
     /** Sort the given list of linecast points by increasing abscissa value and filter to remove
-     * duplicate entries (as determined by the {@link #eq(LinecastPoint3D)} method). The argument
-     * is modified.
+     * duplicate entries (as determined by the {@link #eq(LinecastPoint3D, DoublePrecisionContext)} method).
+     * The argument is modified.
      * @param pts list of points to sort and filter
      */
     public static void sortAndFilter(final List<LinecastPoint3D> pts) {
@@ -111,8 +103,10 @@ public class LinecastPoint3D extends AbstractLinecastPoint<Vector3D, Vector3D.Un
      * @return true if the given linecast point is equivalent to any of those in the given list
      */
     private static boolean containsEq(final LinecastPoint3D pt, final List<LinecastPoint3D> list) {
+        final DoublePrecisionContext precision = pt.getLine().getPrecision();
+
         for (LinecastPoint3D listPt : list) {
-            if (listPt.eq(pt)) {
+            if (listPt.eq(pt, precision)) {
                 return true;
             }
         }
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 1ab2ba4..7ffe3ee 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
@@ -21,7 +21,6 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Objects;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.Transform;
 import org.apache.commons.geometry.core.partitioning.AbstractHyperplane;
 import org.apache.commons.geometry.core.partitioning.EmbeddingHyperplane;
@@ -36,7 +35,7 @@ import org.apache.commons.geometry.euclidean.twod.Vector2D;
 /** Class representing a plane in 3 dimensional Euclidean space.
  */
 public final class Plane extends AbstractHyperplane<Vector3D>
-    implements EmbeddingHyperplane<Vector3D, Vector2D>, Equivalency<Plane> {
+    implements EmbeddingHyperplane<Vector3D, Vector2D> {
     /** First normalized vector of the plane frame (in plane). */
     private final Vector3D u;
 
@@ -510,27 +509,16 @@ public final class Plane extends AbstractHyperplane<Vector3D>
     }
 
 
-    /** {@inheritDoc}
-    *
-    * <p>Instances are considered equivalent if they
-    * <ul>
-    *   <li>contain equal {@link DoublePrecisionContext precision contexts},</li>
-    *   <li>have equivalent origins (as evaluated by the precision context), and</li>
-    *   <li>have equivalent {@code u} and {@code v} vectors (as evaluated by the precision context)</li>
-    * </ul>
-    * @param other the point to compare with
-    * @return true if this instance should be considered equivalent to the argument
-    */
-    @Override
-    public boolean eq(Plane other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getPrecision();
-
-        return precision.equals(other.getPrecision()) &&
-                getOrigin().eq(other.getOrigin(), precision) &&
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison. Instances are considered equivalent if they
+     * have equivalent {@code origin} points and {@code u} and {@code v} vectors.
+     * @param other the point to compare with
+     * @param precision precision context to use for the comparison
+     * @return true if this instance should be considered equivalent to the argument
+     * @see Vector3D#eq(Vector3D, DoublePrecisionContext)
+     */
+    public boolean eq(final Plane other, final DoublePrecisionContext precision) {
+        return getOrigin().eq(other.getOrigin(), precision) &&
                 u.eq(other.u, precision) &&
                 v.eq(other.v, precision);
     }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java
index e738536..2fb4e17 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java
@@ -143,7 +143,7 @@ public final class SubPlane extends AbstractSubPlane<RegionBSPTree2D> {
     private void validatePlane(final Plane inputPlane) {
         final Plane plane = getPlane();
 
-        if (!plane.eq(inputPlane)) {
+        if (!plane.eq(inputPlane, plane.getPrecision())) {
             throw new IllegalArgumentException("Argument is not on the same " +
                     "plane. Expected " + plane + " but was " +
                     inputPlane);
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 adedde9..a893206 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
@@ -18,7 +18,6 @@ package org.apache.commons.geometry.euclidean.twod;
 
 import java.util.Objects;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.Transform;
 import org.apache.commons.geometry.core.partitioning.AbstractHyperplane;
 import org.apache.commons.geometry.core.partitioning.EmbeddingHyperplane;
@@ -57,7 +56,7 @@ import org.apache.commons.numbers.arrays.LinearCombination;
  * points with positive offsets.</p>
  */
 public final class Line extends AbstractHyperplane<Vector2D>
-    implements EmbeddingHyperplane<Vector2D, Vector1D>, Equivalency<Line> {
+    implements EmbeddingHyperplane<Vector2D, Vector1D> {
     /** The direction of the line as a normalized vector. */
     private final Vector2D direction;
 
@@ -434,27 +433,16 @@ public final class Line extends AbstractHyperplane<Vector2D>
         return getPrecision().eqZero(area);
     }
 
-    /** {@inheritDoc}
-    *
-    * <p>Instances are considered equivalent if they
-    * <ul>
-    *   <li>contain equal {@link DoublePrecisionContext precision contexts},</li>
-    *   <li>have equivalent origin locations (as evaluated by the precision context), and</li>
-    *   <li>point in the same direction (as evaluated by the precision context)</li>
-    * </ul>
-    * @param other the point to compare with
-    * @return true if this instance should be considered equivalent to the argument
-    */
-    @Override
-    public boolean eq(final Line other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getPrecision();
-
-        return precision.equals(other.getPrecision()) &&
-                getOrigin().eq(other.getOrigin(), precision) &&
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison. Instances are considered equivalent if they have
+     * equivalent {@code origin} points and make similar angles with the x-axis.
+     * @param other the point to compare with
+     * @param precision precision context to use for the comparison
+     * @return true if this instance should be considered equivalent to the argument
+     * @see Vector2D#eq(Vector2D, DoublePrecisionContext)
+     */
+    public boolean eq(final Line other, final DoublePrecisionContext precision) {
+        return getOrigin().eq(other.getOrigin(), precision) &&
                 precision.eq(getAngle(), other.getAngle());
     }
 
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2D.java
index de6d6e6..d175330 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2D.java
@@ -22,7 +22,6 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.ListIterator;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
 import org.apache.commons.geometry.euclidean.AbstractLinecastPoint;
 
@@ -31,8 +30,7 @@ import org.apache.commons.geometry.euclidean.AbstractLinecastPoint;
  * of the target at the point of intersection.
  * @see Linecastable2D
  */
-public class LinecastPoint2D extends AbstractLinecastPoint<Vector2D, Vector2D.Unit, Line>
-    implements Equivalency<LinecastPoint2D> {
+public class LinecastPoint2D extends AbstractLinecastPoint<Vector2D, Vector2D.Unit, Line> {
 
     /** Comparator that sorts intersection instances by increasing abscissa order. If two abscissa
      * values are equal, the comparison uses {@link Vector2D#COORDINATE_ASCENDING_ORDER} with the
@@ -55,27 +53,20 @@ public class LinecastPoint2D extends AbstractLinecastPoint<Vector2D, Vector2D.Un
         super(point, normal.normalize(), line);
     }
 
-    /** {@inheritDoc}
-     *
-     * <p>
-     * Instances are considered equivalent if they have equivalent points, normals, and lines.
-     * </p>
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison. Instances are considered equivalent if they have equivalent
+     * points, normals, and lines.
+     * @param other point to compare with
+     * @param precision precision context to use for the comparison
+     * @return true if this instance should be considered equivalent to the argument
      */
-    @Override
-    public boolean eq(final LinecastPoint2D other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getLine().getPrecision();
-
-        return getLine().eq(other.getLine()) &&
-                getPoint().eq(other.getPoint(), precision) &&
+    public boolean eq(final LinecastPoint2D other, final DoublePrecisionContext precision) {
+        return getPoint().eq(other.getPoint(), precision) &&
                 getNormal().eq(other.getNormal(), precision);
     }
 
-    /** Sort the given list of linecast points by increasing abscissa value and filter
-     * to remove duplicate entries (as determined by the {@link #eq(LinecastPoint2D)} method).
+    /** Sort the given list of linecast points by increasing abscissa value and filter to remove
+     * duplicate entries (as determined by the {@link #eq(LinecastPoint2D, DoublePrecisionContext)} method).
      * The argument is modified.
      * @param pts list of points to sort and filter
      */
@@ -111,8 +102,10 @@ public class LinecastPoint2D extends AbstractLinecastPoint<Vector2D, Vector2D.Un
      * @return true if the given linecast point is equivalent to any of those in the given list
      */
     private static boolean containsEq(final LinecastPoint2D pt, final List<LinecastPoint2D> list) {
+        final DoublePrecisionContext precision = pt.getLine().getPrecision();
+
         for (LinecastPoint2D listPt : list) {
-            if (listPt.eq(pt)) {
+            if (listPt.eq(pt, precision)) {
                 return true;
             }
         }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
index dba65a4..9462880 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
@@ -164,7 +164,7 @@ public final class SubLine extends AbstractSubLine {
     private void validateLine(final Line inputLine) {
         final Line line = getLine();
 
-        if (!line.eq(inputLine)) {
+        if (!line.eq(inputLine, line.getPrecision())) {
             throw new IllegalArgumentException("Argument is not on the same " +
                     "line. Expected " + line + " but was " +
                     inputLine);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
index 87038e9..a090e88 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
@@ -251,22 +251,21 @@ public class OrientedPointTest {
         DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-3);
 
         OrientedPoint a = OrientedPoint.createPositiveFacing(0, precision);
-
         OrientedPoint b = OrientedPoint.createPositiveFacing(0, TEST_PRECISION);
-        OrientedPoint c = OrientedPoint.createNegativeFacing(0, precision);
-        OrientedPoint d = OrientedPoint.createPositiveFacing(2e-3, precision);
 
+        OrientedPoint c = OrientedPoint.createPositiveFacing(2e-3, precision);
+        OrientedPoint d = OrientedPoint.createNegativeFacing(0, precision);
         OrientedPoint e = OrientedPoint.createPositiveFacing(1e-4, precision);
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
+        Assert.assertTrue(a.eq(b, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
-        Assert.assertFalse(a.eq(d));
+        Assert.assertFalse(a.eq(c, precision));
+        Assert.assertFalse(a.eq(d, precision));
 
-        Assert.assertTrue(a.eq(e));
-        Assert.assertTrue(e.eq(a));
+        Assert.assertTrue(a.eq(e, precision));
+        Assert.assertTrue(e.eq(a, precision));
     }
 
     @Test
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 88c2d48..22df394 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
@@ -399,36 +399,33 @@ public class Line3DTest {
     @Test
     public void testEq() {
         // arrange
-        DoublePrecisionContext precision1 = new EpsilonDoublePrecisionContext(1e-3);
-        DoublePrecisionContext precision2 = new EpsilonDoublePrecisionContext(1e-2);
+        DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-3);
 
         Vector3D p = Vector3D.of(1, 2, 3);
         Vector3D dir = Vector3D.of(1, 0, 0);
 
-        Line3D a = Line3D.fromPointAndDirection(p, dir, precision1);
-        Line3D b = Line3D.fromPointAndDirection(Vector3D.ZERO, dir, precision1);
-        Line3D c = Line3D.fromPointAndDirection(p, Vector3D.of(1, 1, 0), precision1);
-        Line3D d = Line3D.fromPointAndDirection(p, dir, precision2);
+        Line3D a = Line3D.fromPointAndDirection(p, dir, precision);
+        Line3D b = Line3D.fromPointAndDirection(Vector3D.ZERO, dir, precision);
+        Line3D c = Line3D.fromPointAndDirection(p, Vector3D.of(1, 1, 0), precision);
 
-        Line3D e = Line3D.fromPointAndDirection(p, dir, precision1);
-        Line3D f = Line3D.fromPointAndDirection(p.add(Vector3D.of(1e-4, 1e-4, 1e-4)), dir, precision1);
-        Line3D g = Line3D.fromPointAndDirection(p, Vector3D.of(1 + 1e-4, 1e-4, 1e-4), precision1);
+        Line3D d = Line3D.fromPointAndDirection(p, dir, precision);
+        Line3D e = Line3D.fromPointAndDirection(p.add(Vector3D.of(1e-4, 1e-4, 1e-4)), dir, precision);
+        Line3D f = Line3D.fromPointAndDirection(p, Vector3D.of(1 + 1e-4, 1e-4, 1e-4), precision);
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertTrue(a.eq(e));
-        Assert.assertTrue(e.eq(a));
+        Assert.assertTrue(a.eq(d, precision));
+        Assert.assertTrue(d.eq(a, precision));
 
-        Assert.assertTrue(a.eq(f));
-        Assert.assertTrue(f.eq(a));
+        Assert.assertTrue(a.eq(e, precision));
+        Assert.assertTrue(e.eq(a, precision));
 
-        Assert.assertTrue(a.eq(g));
-        Assert.assertTrue(g.eq(a));
+        Assert.assertTrue(a.eq(f, precision));
+        Assert.assertTrue(f.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
-        Assert.assertFalse(a.eq(d));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
     }
 
     @Test
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3DTest.java
index aa6784d..59c74e8 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/LinecastPoint3DTest.java
@@ -134,13 +134,13 @@ public class LinecastPoint3DTest {
                 Vector3D.of(1 + 1e-3, 1 + 1e-3, 1 + 1e-3), Vector3D.Unit.from(1 + 1e-3, 1e-3, 1e-3), otherLine);
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
 
-        Assert.assertTrue(a.eq(d));
-        Assert.assertTrue(a.eq(e));
+        Assert.assertTrue(a.eq(d, precision));
+        Assert.assertTrue(a.eq(e, precision));
     }
 
     @Test
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 ed5f027..ba51155 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
@@ -1000,15 +1000,15 @@ public class PlaneTest {
         Plane f = Plane.fromPointAndPlaneVectors(ptPrime, uPrime, vPrime, new EpsilonDoublePrecisionContext(eps));
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
-        Assert.assertFalse(a.eq(d));
-        Assert.assertFalse(a.eq(e));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
+        Assert.assertFalse(a.eq(d, precision));
 
-        Assert.assertTrue(a.eq(f));
-        Assert.assertTrue(f.eq(a));
+        Assert.assertTrue(a.eq(e, precision));
+        Assert.assertTrue(a.eq(f, precision));
+        Assert.assertTrue(f.eq(a, precision));
     }
 
     @Test
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 66a232f..2b36179 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
@@ -1120,36 +1120,33 @@ public class LineTest {
     @Test
     public void testEq() {
         // arrange
-        DoublePrecisionContext precision1 = new EpsilonDoublePrecisionContext(1e-3);
-        DoublePrecisionContext precision2 = new EpsilonDoublePrecisionContext(1e-2);
+        DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-3);
 
         Vector2D p = Vector2D.of(1, 2);
         double angle = 1.0;
 
-        Line a = Line.fromPointAndAngle(p, angle, precision1);
-        Line b = Line.fromPointAndAngle(Vector2D.ZERO, angle, precision1);
-        Line c = Line.fromPointAndAngle(p, angle + 1.0, precision1);
-        Line d = Line.fromPointAndAngle(p, angle, precision2);
+        Line a = Line.fromPointAndAngle(p, angle, precision);
+        Line b = Line.fromPointAndAngle(Vector2D.ZERO, angle, precision);
+        Line c = Line.fromPointAndAngle(p, angle + 1.0, precision);
 
-        Line e = Line.fromPointAndAngle(p, angle, precision1);
-        Line f = Line.fromPointAndAngle(p.add(Vector2D.of(1e-4, 1e-4)), angle, precision1);
-        Line g = Line.fromPointAndAngle(p, angle + 1e-4, precision1);
+        Line d = Line.fromPointAndAngle(p, angle, precision);
+        Line e = Line.fromPointAndAngle(p.add(Vector2D.of(1e-4, 1e-4)), angle, precision);
+        Line f = Line.fromPointAndAngle(p, angle + 1e-4, precision);
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertTrue(a.eq(e));
-        Assert.assertTrue(e.eq(a));
+        Assert.assertTrue(a.eq(d, precision));
+        Assert.assertTrue(d.eq(a, precision));
 
-        Assert.assertTrue(a.eq(f));
-        Assert.assertTrue(f.eq(a));
+        Assert.assertTrue(a.eq(e, precision));
+        Assert.assertTrue(e.eq(a, precision));
 
-        Assert.assertTrue(a.eq(g));
-        Assert.assertTrue(g.eq(a));
+        Assert.assertTrue(a.eq(f, precision));
+        Assert.assertTrue(f.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
-        Assert.assertFalse(a.eq(d));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
     }
 
     @Test
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2DTest.java
index e000b4f..08f5184 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LinecastPoint2DTest.java
@@ -134,13 +134,13 @@ public class LinecastPoint2DTest {
                 Vector2D.of(1 + 1e-3, 1 + 1e-3), Vector2D.Unit.from(1 + 1e-3, 1e-3), otherLine);
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
 
-        Assert.assertTrue(a.eq(d));
-        Assert.assertTrue(a.eq(e));
+        Assert.assertTrue(a.eq(d, precision));
+        Assert.assertTrue(a.eq(e, precision));
     }
 
     @Test
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 6b3b109..e63b15f 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
@@ -1149,7 +1149,7 @@ public class RegionBSPTree2DTest {
         Assert.assertNull(segment.getEndPoint());
 
         Line expectedLine = Line.fromPointAndAngle(Vector2D.of(-1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION);
-        Assert.assertTrue(expectedLine.eq(segment.getLine()));
+        Assert.assertTrue(expectedLine.eq(segment.getLine(), expectedLine.getPrecision()));
     }
 
     @Test
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/CutAngle.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/CutAngle.java
index 0547868..cf1735a 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/CutAngle.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/CutAngle.java
@@ -20,7 +20,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.RegionLocation;
 import org.apache.commons.geometry.core.Transform;
 import org.apache.commons.geometry.core.partitioning.AbstractHyperplane;
@@ -56,8 +55,7 @@ import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
  *
  * <p>Instances of this class are guaranteed to be immutable.</p>
  */
-public final class CutAngle extends AbstractHyperplane<Point1S>
-    implements Equivalency<CutAngle> {
+public final class CutAngle extends AbstractHyperplane<Point1S> {
     /** Hyperplane location as a point. */
     private final Point1S point;
 
@@ -117,27 +115,21 @@ public final class CutAngle extends AbstractHyperplane<Point1S>
         return positiveFacing;
     }
 
-    /** {@inheritDoc}
-     *
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison.
      * <p>The instances are considered equivalent if they
      * <ol>
-     *    <li>have equal precision contexts,</li>
-     *    <li>have equivalent point locations as evaluated by the precision
-     *          context (points separated by multiples of 2pi are considered equivalent), and
+     *    <li>have equivalent point locations (points separated by multiples of 2pi are
+     *      considered equivalent) and
      *    <li>point in the same direction.</li>
      * </ol>
+     * @param other point to compare with
+     * @param precision precision context to use for the comparison
+     * @return true if this instance should be considered equivalent to the argument
      * @see Point1S#eq(Point1S, DoublePrecisionContext)
      */
-    @Override
-    public boolean eq(final CutAngle other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getPrecision();
-
-        return precision.equals(other.getPrecision()) &&
-                point.eq(other.point, precision) &&
+    public boolean eq(final CutAngle other, final DoublePrecisionContext precision) {
+        return point.eq(other.point, precision) &&
                 positiveFacing == other.positiveFacing;
     }
 
@@ -496,7 +488,7 @@ public final class CutAngle extends AbstractHyperplane<Point1S>
             final CutAngle baseHyper = base.getHyperplane();
             final CutAngle inputHyper = (CutAngle) sub.getHyperplane();
 
-            if (!baseHyper.eq(inputHyper)) {
+            if (!baseHyper.eq(inputHyper, baseHyper.getPrecision())) {
                 throw new IllegalArgumentException("Argument is not on the same " +
                         "hyperplane. Expected " + baseHyper + " but was " +
                         inputHyper);
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 584cd2f..c1ffffb 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,6 @@ package org.apache.commons.geometry.spherical.twod;
 
 import java.util.Objects;
 
-import org.apache.commons.geometry.core.Equivalency;
 import org.apache.commons.geometry.core.Transform;
 import org.apache.commons.geometry.core.partitioning.AbstractHyperplane;
 import org.apache.commons.geometry.core.partitioning.EmbeddingHyperplane;
@@ -38,7 +37,7 @@ import org.apache.commons.numbers.angle.PlaneAngleRadians;
  * <p>Instances of this class are guaranteed to be immutable.</p>
  */
 public final class GreatCircle extends AbstractHyperplane<Point2S>
-    implements EmbeddingHyperplane<Point2S, Point1S>, Equivalency<GreatCircle> {
+    implements EmbeddingHyperplane<Point2S, Point1S> {
     /** Pole or circle center. */
     private final Vector3D.Unit pole;
 
@@ -318,17 +317,16 @@ public final class GreatCircle extends AbstractHyperplane<Point2S>
         return Point2S.from(vectorAt(point.getAzimuth()));
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public boolean eq(final GreatCircle other) {
-        if (this == other) {
-            return true;
-        }
-
-        final DoublePrecisionContext precision = getPrecision();
-
-        return precision.equals(other.getPrecision()) &&
-                pole.eq(other.pole, precision) &&
+    /** Return true if this instance should be considered equivalent to the argument, using the
+     * given precision context for comparison. Instances are considered equivalent if have equivalent
+     * {@code pole}, {@code u}, and {@code v} vectors.
+     * @param other great circle to compare with
+     * @param precision precision context to use for the comparison
+     * @return true if this instance should be considered equivalent to the argument
+     * @see Vector3D#eq(Vector3D, DoublePrecisionContext)
+     */
+    public boolean eq(final GreatCircle other, final DoublePrecisionContext precision) {
+        return pole.eq(other.pole, precision) &&
                 u.eq(other.u, precision) &&
                 v.eq(other.v, precision);
     }
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java
index d2f918c..49e5c20 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java
@@ -173,7 +173,7 @@ public final class SubGreatCircle extends AbstractSubGreatCircle {
     private void validateGreatCircle(final GreatCircle inputCircle) {
         final GreatCircle circle = getCircle();
 
-        if (!circle.eq(inputCircle)) {
+        if (!circle.eq(inputCircle, circle.getPrecision())) {
             throw new IllegalArgumentException("Argument is not on the same " +
                     "great circle. Expected " + circle + " but was " +
                     inputCircle);
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 1bf033c..134de24 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
@@ -291,16 +291,16 @@ public class CutAngleTest {
         CutAngle h = CutAngle.fromPointAndDirection(Point1S.of(-1e-4), true, precision);
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
-        Assert.assertFalse(a.eq(d));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
 
-        Assert.assertTrue(a.eq(e));
-        Assert.assertTrue(a.eq(f));
-        Assert.assertTrue(a.eq(g));
-        Assert.assertTrue(a.eq(h));
+        Assert.assertTrue(a.eq(d, precision));
+        Assert.assertTrue(a.eq(e, precision));
+        Assert.assertTrue(a.eq(f, precision));
+        Assert.assertTrue(a.eq(g, precision));
+        Assert.assertTrue(a.eq(h, precision));
     }
 
     @Test
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 a554ee8..bf95bc6 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
@@ -640,20 +640,20 @@ public class GreatCircleTest {
                 new EpsilonDoublePrecisionContext(eps));
 
         // act/assert
-        Assert.assertTrue(a.eq(a));
+        Assert.assertTrue(a.eq(a, precision));
 
-        Assert.assertFalse(a.eq(b));
-        Assert.assertFalse(a.eq(c));
-        Assert.assertFalse(a.eq(d));
+        Assert.assertFalse(a.eq(b, precision));
+        Assert.assertFalse(a.eq(c, precision));
 
-        Assert.assertTrue(a.eq(e));
-        Assert.assertTrue(e.eq(a));
+        Assert.assertTrue(a.eq(d, precision));
+        Assert.assertTrue(a.eq(e, precision));
+        Assert.assertTrue(e.eq(a, precision));
 
-        Assert.assertTrue(a.eq(f));
-        Assert.assertTrue(f.eq(a));
+        Assert.assertTrue(a.eq(f, precision));
+        Assert.assertTrue(f.eq(a, precision));
 
-        Assert.assertTrue(g.eq(e));
-        Assert.assertTrue(e.eq(g));
+        Assert.assertTrue(g.eq(e, precision));
+        Assert.assertTrue(e.eq(g, precision));
     }
 
     @Test