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 2018/09/22 13:40:08 UTC

[commons-geometry] 07/10: GEOMETRY-17: implementing changes from pull request feedback; renaming getRealNonZerNorm() vector method to getCheckedNorm() and making private

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 70adc8284394a93761562b91a79fff3f28d0cc78
Author: Matt Juntunen <ma...@hotmail.com>
AuthorDate: Fri Sep 21 21:57:44 2018 -0400

    GEOMETRY-17: implementing changes from pull request feedback; renaming getRealNonZerNorm() vector method to getCheckedNorm() and making private
---
 .../geometry/euclidean/EuclideanVector.java        |  9 -----
 .../geometry/euclidean/internal/Vectors.java       | 14 ++++++-
 .../commons/geometry/euclidean/oned/Vector1D.java  | 27 +++++++------
 .../commons/geometry/euclidean/threed/Plane.java   |  3 +-
 .../geometry/euclidean/threed/Rotation.java        |  5 ++-
 .../geometry/euclidean/threed/Vector3D.java        | 25 ++++++------
 .../commons/geometry/euclidean/twod/Vector2D.java  | 23 ++++++-----
 .../geometry/euclidean/internal/VectorsTest.java   | 45 ++++++++++++++++------
 .../geometry/euclidean/oned/Vector1DTest.java      | 21 ----------
 .../geometry/euclidean/threed/Vector3DTest.java    | 21 ----------
 .../geometry/euclidean/twod/Vector2DTest.java      | 21 ----------
 11 files changed, 94 insertions(+), 120 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/EuclideanVector.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/EuclideanVector.java
index acac512..ad4f21b 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/EuclideanVector.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/EuclideanVector.java
@@ -17,7 +17,6 @@
 package org.apache.commons.geometry.euclidean;
 
 import org.apache.commons.geometry.core.Vector;
-import org.apache.commons.geometry.core.exception.IllegalNormException;
 
 /** Represents a vector in a Euclidean space of any dimension.
  *
@@ -45,12 +44,4 @@ public interface EuclideanVector<P extends EuclideanPoint<P, V>, V extends Eucli
      * @return interpolated or extrapolated vector
      */
     V lerp(V v, double t);
-
-    /** Returns the vector norm value, throwing an {@link IllegalNormException} if the value
-     * is not real (ie, NaN or infinite) or zero. Obtaining a vector norm value and ensuring
-     * that it meets this criteria is such a common operation that it is given its own method.
-     * @return the vector norm value, guaranteed to be real and non-zero
-     * @throws IllegalNormException if the vector norm is zero, NaN, or infinite
-     */
-    double getRealNonZeroNorm();
 }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/internal/Vectors.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/internal/Vectors.java
index 1cd456f..cc054a5 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/internal/Vectors.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/internal/Vectors.java
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.geometry.euclidean.internal;
 
+import org.apache.commons.geometry.core.Vector;
 import org.apache.commons.geometry.core.exception.IllegalNormException;
 
 /** This class consists exclusively of static vector utility methods.
@@ -44,7 +45,7 @@ public final class Vectors {
      * @throws IllegalNormException if the given norm value is NaN, infinite,
      *  or zero
      */
-    public static double ensureRealNonZeroNorm(final double norm) throws IllegalNormException {
+    public static double checkedNorm(final double norm) throws IllegalNormException {
         if (!isRealNonZero(norm)) {
             throw new IllegalNormException(norm);
         }
@@ -52,6 +53,17 @@ public final class Vectors {
         return norm;
     }
 
+    /** Returns the vector's norm value, throwing an {@link IllegalNormException} if the value
+     * is not real (ie, not NaN or infinite) or zero.
+     * @param vec vector to obtain the real, non-zero norm of
+     * @return the validated norm value
+     * @throws IllegalNormException if the vector norm value is NaN, infinite,
+     *  or zero
+     */
+    public static double checkedNorm(final Vector<?> vec) {
+        return checkedNorm(vec.getNorm());
+    }
+
     /** Get the L<sub>1</sub> norm for the vector with the given components.
      * This is defined as the sum of the absolute values of all vector components.
      * @param x vector component
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 dccf46a..ee2f260 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
@@ -105,19 +105,13 @@ public class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Ve
     /** {@inheritDoc} */
     @Override
     public Vector1D withNorm(double magnitude) {
-        getRealNonZeroNorm(); // validate our norm value
+        getCheckedNorm(); // validate our norm value
 
         return (getX() > 0.0)? new Vector1D(magnitude) : new Vector1D(-magnitude);
     }
 
     /** {@inheritDoc} */
     @Override
-    public double getRealNonZeroNorm() {
-        return Vectors.ensureRealNonZeroNorm(getNorm());
-    }
-
-    /** {@inheritDoc} */
-    @Override
     public Vector1D add(Vector1D v) {
         return new Vector1D(getX() + v.getX());
     }
@@ -193,7 +187,7 @@ public class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Ve
      */
     @Override
     public Vector1D project(final Vector1D base) {
-        base.getRealNonZeroNorm(); // validate the base norm
+        base.getCheckedNorm(); // validate the base norm
 
         return this;
     }
@@ -203,7 +197,7 @@ public class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Ve
      */
     @Override
     public Vector1D reject(final Vector1D base) {
-        base.getRealNonZeroNorm(); // validate the base norm
+        base.getCheckedNorm(); // validate the base norm
 
         return Vector1D.ZERO;
     }
@@ -215,8 +209,8 @@ public class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Ve
     @Override
     public double angle(final Vector1D v) {
         // validate the norm values
-        getRealNonZeroNorm();
-        v.getRealNonZeroNorm();
+        getCheckedNorm();
+        v.getCheckedNorm();
 
         final double sig1 = Math.signum(getX());
         final double sig2 = Math.signum(v.getX());
@@ -276,6 +270,15 @@ public class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Ve
         return false;
     }
 
+    /** Returns the vector norm value, throwing an {@link IllegalNormException} if the value
+     * is not real (ie, NaN or infinite) or zero.
+     * @return the vector norm value, guaranteed to be real and non-zero
+     * @throws IllegalNormException if the vector norm is zero, NaN, or infinite
+     */
+    private double getCheckedNorm() {
+        return Vectors.checkedNorm(getNorm());
+    }
+
     /** Returns a vector with the given coordinate value.
      * @param x vector coordinate
      * @return vector instance
@@ -290,7 +293,7 @@ public class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Ve
      * @throws IllegalNormException if the norm of the given value is zero, NaN, or infinite
      */
     public static Vector1D normalize(final double x) {
-        Vectors.ensureRealNonZeroNorm(Vectors.norm(x));
+        Vectors.checkedNorm(Vectors.norm(x));
 
         return (x > 0.0) ? ONE : MINUS_ONE;
     }
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 1313c90..4d5ba76 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
@@ -19,6 +19,7 @@ package org.apache.commons.geometry.euclidean.threed;
 import org.apache.commons.geometry.core.exception.IllegalNormException;
 import org.apache.commons.geometry.core.partitioning.Embedding;
 import org.apache.commons.geometry.core.partitioning.Hyperplane;
+import org.apache.commons.geometry.euclidean.internal.Vectors;
 import org.apache.commons.geometry.euclidean.oned.Point1D;
 import org.apache.commons.geometry.euclidean.twod.Point2D;
 import org.apache.commons.geometry.euclidean.twod.PolygonsSet;
@@ -142,7 +143,7 @@ public class Plane implements Hyperplane<Point3D>, Embedding<Point3D, Point2D> {
      * @exception IllegalNormException if the normal norm zero, NaN, or infinite
      */
     private void setNormal(final Vector3D normal) {
-        final double norm = normal.getRealNonZeroNorm();
+        final double norm = Vectors.checkedNorm(normal);
 
         w = Vector3D.linearCombination(1.0 / norm, normal);
     }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java
index 285b34a..b845759 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
 
 import org.apache.commons.geometry.core.exception.GeometryException;
 import org.apache.commons.geometry.core.exception.IllegalNormException;
+import org.apache.commons.geometry.euclidean.internal.Vectors;
 import org.apache.commons.numbers.arrays.LinearCombination;
 
 /**
@@ -172,7 +173,7 @@ public class Rotation implements Serializable {
   public Rotation(final Vector3D axis, final double angle, final RotationConvention convention)
       throws IllegalNormException {
 
-    double norm = axis.getRealNonZeroNorm();
+    double norm = Vectors.checkedNorm(axis);
 
     double halfAngle = convention == RotationConvention.VECTOR_OPERATOR ? -0.5 * angle : +0.5 * angle;
     double coeff = Math.sin(halfAngle) / norm;
@@ -316,7 +317,7 @@ public class Rotation implements Serializable {
    */
   public Rotation(Vector3D u, Vector3D v) {
 
-    double normProduct = u.getRealNonZeroNorm() * v.getRealNonZeroNorm();
+    double normProduct = Vectors.checkedNorm(u) * Vectors.checkedNorm(v);
 
     double dot = u.dotProduct(v);
 
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 9f9bb03..2a1bfdd 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
@@ -121,7 +121,7 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
     /** {@inheritDoc} */
     @Override
     public Vector3D withNorm(double magnitude) {
-        final double invNorm = 1.0 / getRealNonZeroNorm();
+        final double invNorm = 1.0 / getCheckedNorm();
 
         return new Vector3D(
                     magnitude * getX() * invNorm,
@@ -132,12 +132,6 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
 
     /** {@inheritDoc} */
     @Override
-    public double getRealNonZeroNorm() {
-        return Vectors.ensureRealNonZeroNorm(getNorm());
-    }
-
-    /** {@inheritDoc} */
-    @Override
     public Vector3D add(Vector3D v) {
         return new Vector3D(
                     getX() + v.getX(),
@@ -205,7 +199,7 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
      *  or infinite
      */
     public Vector3D orthogonal() {
-        double threshold = 0.6 * getRealNonZeroNorm();
+        double threshold = 0.6 * getCheckedNorm();
 
         final double x = getX();
         final double y = getY();
@@ -244,7 +238,7 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
      */
     @Override
     public double angle(Vector3D v) {
-        double normProduct = getRealNonZeroNorm() * v.getRealNonZeroNorm();
+        double normProduct = getCheckedNorm() * v.getCheckedNorm();
 
         double dot = dotProduct(v);
         double threshold = normProduct * 0.9999;
@@ -413,7 +407,7 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
         // directly. This will produce the same error result as checking the actual norm since
         // Math.sqrt(0.0) == 0.0, Math.sqrt(Double.NaN) == Double.NaN and
         // Math.sqrt(Double.POSITIVE_INFINITY) == Double.POSITIVE_INFINITY.
-        final double baseMagSq = Vectors.ensureRealNonZeroNorm(base.getNormSq());
+        final double baseMagSq = Vectors.checkedNorm(base.getNormSq());
 
         final double scale = aDotB / baseMagSq;
 
@@ -428,6 +422,15 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
         return factory.apply(projX, projY, projZ);
     }
 
+    /** Returns the vector norm value, throwing an {@link IllegalNormException} if the value
+     * is not real (ie, NaN or infinite) or zero.
+     * @return the vector norm value, guaranteed to be real and non-zero
+     * @throws IllegalNormException if the vector norm is zero, NaN, or infinite
+     */
+    private double getCheckedNorm() {
+        return Vectors.checkedNorm(getNorm());
+    }
+
     /** Returns a vector with the given coordinate values.
      * @param x abscissa (first coordinate value)
      * @param y abscissa (second coordinate value)
@@ -469,7 +472,7 @@ public class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Ve
      * @throws IllegalNormException if the norm of the given values is zero, NaN, or infinite
      */
     public static Vector3D normalize(final double x, final double y, final double z) {
-        final double norm = Vectors.ensureRealNonZeroNorm(Vectors.norm(x, y, z));
+        final double norm = Vectors.checkedNorm(Vectors.norm(x, y, z));
         final double invNorm = 1.0 / norm;
 
         return new UnitVector(x * invNorm, y * invNorm, z * invNorm);
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 dc3b925..8c3c39b 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
@@ -112,7 +112,7 @@ public class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Ve
     /** {@inheritDoc} */
     @Override
     public Vector2D withNorm(double magnitude) {
-        final double invNorm = 1.0 / getRealNonZeroNorm();
+        final double invNorm = 1.0 / getCheckedNorm();
 
         return new Vector2D(
                     magnitude * getX() * invNorm,
@@ -122,12 +122,6 @@ public class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Ve
 
     /** {@inheritDoc} */
     @Override
-    public double getRealNonZeroNorm() {
-        return Vectors.ensureRealNonZeroNorm(getNorm());
-    }
-
-    /** {@inheritDoc} */
-    @Override
     public Vector2D add(Vector2D v) {
         return new Vector2D(getX() + v.getX(), getY() + v.getY());
     }
@@ -244,7 +238,7 @@ public class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Ve
      */
     @Override
     public double angle(Vector2D v) {
-        double normProduct = getRealNonZeroNorm() * v.getRealNonZeroNorm();
+        double normProduct = getCheckedNorm() * v.getCheckedNorm();
 
         double dot = dotProduct(v);
         double threshold = normProduct * 0.9999;
@@ -361,7 +355,7 @@ public class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Ve
         // directly. This will produce the same error result as checking the actual norm since
         // Math.sqrt(0.0) == 0.0, Math.sqrt(Double.NaN) == Double.NaN and
         // Math.sqrt(Double.POSITIVE_INFINITY) == Double.POSITIVE_INFINITY.
-        final double baseMagSq = Vectors.ensureRealNonZeroNorm(base.getNormSq());
+        final double baseMagSq = Vectors.checkedNorm(base.getNormSq());
 
         final double scale = aDotB / baseMagSq;
 
@@ -375,6 +369,15 @@ public class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Ve
         return factory.apply(projX, projY);
     }
 
+    /** Returns the vector norm value, throwing an {@link IllegalNormException} if the value
+     * is not real (ie, NaN or infinite) or zero.
+     * @return the vector norm value, guaranteed to be real and non-zero
+     * @throws IllegalNormException if the vector norm is zero, NaN, or infinite
+     */
+    private double getCheckedNorm() {
+        return Vectors.checkedNorm(getNorm());
+    }
+
     /** Returns a vector with the given coordinate values.
      * @param x abscissa (first coordinate value)
      * @param y abscissa (second coordinate value)
@@ -412,7 +415,7 @@ public class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Ve
      * @throws IllegalNormException if the norm of the given values is zero, NaN, or infinite
      */
     public static Vector2D normalize(final double x, final double y) {
-        final double norm = Vectors.ensureRealNonZeroNorm(Vectors.norm(x, y));
+        final double norm = Vectors.checkedNorm(Vectors.norm(x, y));
         final double invNorm = 1.0 / norm;
 
         return new UnitVector(x * invNorm, y * invNorm);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/internal/VectorsTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/internal/VectorsTest.java
index bf2c745..207df63 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/internal/VectorsTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/internal/VectorsTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.geometry.euclidean.internal;
 
 import org.apache.commons.geometry.core.GeometryTestUtils;
 import org.apache.commons.geometry.core.exception.IllegalNormException;
+import org.apache.commons.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.geometry.euclidean.threed.Vector3D;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -41,27 +43,48 @@ public class VectorsTest {
     }
 
     @Test
-    public void testEnsureFiniteNonZeroNorm() {
+    public void testCheckedNorm_normArg() {
         // act/assert
-        Assert.assertEquals(1.0, Vectors.ensureRealNonZeroNorm(1.0), EPS);
-        Assert.assertEquals(23.12, Vectors.ensureRealNonZeroNorm(23.12), EPS);
-        Assert.assertEquals(2e-12, Vectors.ensureRealNonZeroNorm(2e-12), EPS);
+        Assert.assertEquals(1.0, Vectors.checkedNorm(1.0), EPS);
+        Assert.assertEquals(23.12, Vectors.checkedNorm(23.12), EPS);
+        Assert.assertEquals(2e-12, Vectors.checkedNorm(2e-12), EPS);
 
-        Assert.assertEquals(-1.0, Vectors.ensureRealNonZeroNorm(-1.0), EPS);
-        Assert.assertEquals(-23.12, Vectors.ensureRealNonZeroNorm(-23.12), EPS);
-        Assert.assertEquals(-2e-12, Vectors.ensureRealNonZeroNorm(-2e-12), EPS);
+        Assert.assertEquals(-1.0, Vectors.checkedNorm(-1.0), EPS);
+        Assert.assertEquals(-23.12, Vectors.checkedNorm(-23.12), EPS);
+        Assert.assertEquals(-2e-12, Vectors.checkedNorm(-2e-12), EPS);
 
-        GeometryTestUtils.assertThrows(() -> Vectors.ensureRealNonZeroNorm(0.0),
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(0.0),
                 IllegalNormException.class, "Illegal norm: 0.0");
-        GeometryTestUtils.assertThrows(() -> Vectors.ensureRealNonZeroNorm(Double.NaN),
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Double.NaN),
                 IllegalNormException.class, "Illegal norm: NaN");
-        GeometryTestUtils.assertThrows(() -> Vectors.ensureRealNonZeroNorm(Double.POSITIVE_INFINITY),
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Double.POSITIVE_INFINITY),
                 IllegalNormException.class, "Illegal norm: Infinity");
-        GeometryTestUtils.assertThrows(() -> Vectors.ensureRealNonZeroNorm(Double.NEGATIVE_INFINITY),
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Double.NEGATIVE_INFINITY),
                 IllegalNormException.class, "Illegal norm: -Infinity");
     }
 
     @Test
+    public void testCheckedNorm_vectorArg() {
+        // act/assert
+        Assert.assertEquals(1.0, Vectors.checkedNorm(Vector1D.of(1.0)), EPS);
+        Assert.assertEquals(23.12, Vectors.checkedNorm(Vector1D.of(23.12)), EPS);
+        Assert.assertEquals(2e-12, Vectors.checkedNorm(Vector1D.of(2e-12)), EPS);
+
+        Assert.assertEquals(1.0, Vectors.checkedNorm(Vector1D.of(-1.0)), EPS);
+        Assert.assertEquals(23.12, Vectors.checkedNorm(Vector1D.of(-23.12)), EPS);
+        Assert.assertEquals(2e-12, Vectors.checkedNorm(Vector1D.of(-2e-12)), EPS);
+
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Vector3D.ZERO),
+                IllegalNormException.class, "Illegal norm: 0.0");
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Vector3D.NaN),
+                IllegalNormException.class, "Illegal norm: NaN");
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Vector3D.POSITIVE_INFINITY),
+                IllegalNormException.class, "Illegal norm: Infinity");
+        GeometryTestUtils.assertThrows(() -> Vectors.checkedNorm(Vector3D.NEGATIVE_INFINITY),
+                IllegalNormException.class, "Illegal norm: Infinity");
+    }
+
+    @Test
     public void testNorm1_oneD() {
         // act/assert
         Assert.assertEquals(0.0, Vectors.norm1(0.0), EPS);
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 048909e..8e1b797 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
@@ -150,27 +150,6 @@ public class Vector1DTest {
     }
 
     @Test
-    public void testGetRealNonZeroNorm() {
-        // act/assert
-        Assert.assertEquals(1.0, Vector1D.ONE.getNorm(), TEST_TOLERANCE);
-        Assert.assertEquals(3.0, Vector1D.of(3).getNorm(), TEST_TOLERANCE);
-        Assert.assertEquals(3.0, Vector1D.of(-3).getNorm(), TEST_TOLERANCE);
-    }
-
-    @Test
-    public void testGetRealNonZeroNorm_illegalNorm() {
-        // act/assert
-        GeometryTestUtils.assertThrows(() -> Vector1D.ZERO.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector1D.NaN.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector1D.POSITIVE_INFINITY.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector1D.NEGATIVE_INFINITY.getRealNonZeroNorm(),
-                IllegalNormException.class);
-    }
-
-    @Test
     public void testAdd() {
         // arrange
         Vector1D v1 = Vector1D.of(1);
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 5cee125..0997f57 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
@@ -192,27 +192,6 @@ public class Vector3DTest {
     }
 
     @Test
-    public void testGetRealNonZeroNorm() {
-        // act/assert
-        Assert.assertEquals(1.0, Vector3D.PLUS_X.getNorm(), EPS);
-        Assert.assertEquals(Math.sqrt(50), Vector3D.of(3, 4, 5).getNorm(), EPS);
-        Assert.assertEquals(Math.sqrt(50), Vector3D.of(-3, -4, -5).getNorm(), EPS);
-    }
-
-    @Test
-    public void testGetRealNonZeroNorm_illegalNorm() {
-        // act/assert
-        GeometryTestUtils.assertThrows(() -> Vector3D.ZERO.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector3D.NaN.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector3D.POSITIVE_INFINITY.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector3D.NEGATIVE_INFINITY.getRealNonZeroNorm(),
-                IllegalNormException.class);
-    }
-
-    @Test
     public void testAdd() {
         // arrange
         Vector3D v1 = Vector3D.of(1, 2, 3);
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 19b4814..f1855c3 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
@@ -170,27 +170,6 @@ public class Vector2DTest {
     }
 
     @Test
-    public void testGetRealNonZeroNorm() {
-        // act/assert
-        Assert.assertEquals(1.0, Vector2D.PLUS_X.getNorm(), EPS);
-        Assert.assertEquals(5.0, Vector2D.of(3, 4).getNorm(), EPS);
-        Assert.assertEquals(5.0, Vector2D.of(-3, -4).getNorm(), EPS);
-    }
-
-    @Test
-    public void testGetRealNonZeroNorm_illegalNorm() {
-        // act/assert
-        GeometryTestUtils.assertThrows(() -> Vector2D.ZERO.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector2D.NaN.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector2D.POSITIVE_INFINITY.getRealNonZeroNorm(),
-                IllegalNormException.class);
-        GeometryTestUtils.assertThrows(() -> Vector2D.NEGATIVE_INFINITY.getRealNonZeroNorm(),
-                IllegalNormException.class);
-    }
-
-    @Test
     public void testAdd() {
         // arrange
         Vector2D v1 = Vector2D.of(-1, 2);