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/11/28 14:12:08 UTC

[commons-geometry] branch master updated (f95363f -> e2479de)

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

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


    from f95363f  Use constants defined in "Commons Numbers".
     new bb67350  Use "diamond" operator.
     new 33a9519  Merge "if" statements.
     new 8c1ac8e  Removed "onCut" check which at that point is always "true".
     new d7fb844  Avoid several method having identical implementation.
     new 110c707  Anonymous inner class replaced with lambda.
     new 97faa29  Duplicate "import" removed.
     new 775ea17  Simplify lambda expressions.
     new 4cdadae  Use "isEmpty()".
     new 0dd2ad4  Prefer method reference (over lambda).
     new ff86e4d  Indentation.
     new 219b00f  Spurious "throws" clauses.
     new e2479de  Spurious "transient" keyword.

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../core/partitioning/bsp/AbstractBSPTree.java     | 18 +++----
 .../precision/EpsilonDoublePrecisionContext.java   |  2 +-
 .../threed/enclosing/SphereGenerator.java          | 58 +++++++++++-----------
 .../euclidean/twod/enclosing/DiskGenerator.java    | 35 ++++++-------
 .../geometry/euclidean/internal/Vectors.java       |  2 +-
 .../geometry/euclidean/oned/RegionBSPTree1D.java   | 10 ++--
 .../commons/geometry/euclidean/threed/Plane.java   |  2 +-
 .../euclidean/threed/SphericalCoordinates.java     |  1 -
 .../geometry/euclidean/twod/PolarCoordinates.java  |  1 -
 .../commons/geometry/euclidean/twod/Polyline.java  |  6 +--
 .../twod/hull/AbstractConvexHullGenerator2D.java   |  3 +-
 .../geometry/euclidean/twod/hull/ConvexHull2D.java |  6 +--
 .../euclidean/twod/hull/ConvexHullGenerator2D.java |  3 +-
 .../euclidean/twod/hull/MonotoneChain.java         |  8 +--
 .../commons/geometry/hull/ConvexHullGenerator.java |  3 +-
 .../commons/geometry/spherical/oned/Point1S.java   |  5 +-
 .../geometry/spherical/oned/RegionBSPTree1S.java   |  5 +-
 .../spherical/twod/AbstractSubGreatCircle.java     |  2 +-
 .../geometry/spherical/twod/ConvexArea2S.java      |  4 +-
 19 files changed, 75 insertions(+), 99 deletions(-)


[commons-geometry] 09/12: Prefer method reference (over lambda).

Posted by er...@apache.org.
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 0dd2ad4964ef2d85973258858e3f586d573c8e27
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:54:23 2019 +0100

    Prefer method reference (over lambda).
    
    Reported by "sonarcloud.io".
---
 .../java/org/apache/commons/geometry/euclidean/twod/Polyline.java   | 6 +++---
 .../java/org/apache/commons/geometry/spherical/oned/Point1S.java    | 2 +-
 .../org/apache/commons/geometry/spherical/twod/ConvexArea2S.java    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java
index 236ac2e..9ef8a1c 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java
@@ -172,7 +172,7 @@ public class Polyline implements Iterable<Segment> {
         if (!isEmpty()) {
             final List<Segment> transformed = segments.stream()
                     .map(s -> s.transform(transform))
-                    .collect(Collectors.toCollection(() -> new ArrayList<>()));
+                .collect(Collectors.toCollection(ArrayList::new));
 
             return new Polyline(transformed);
         }
@@ -188,8 +188,8 @@ public class Polyline implements Iterable<Segment> {
     public Polyline reverse() {
         if (!isEmpty()) {
             final List<Segment> reversed = segments.stream()
-                    .map(s -> s.reverse())
-                    .collect(Collectors.toCollection(() -> new ArrayList<>()));
+                .map(Segment::reverse)
+                .collect(Collectors.toCollection(ArrayList::new));
             Collections.reverse(reversed);
 
             return new Polyline(reversed);
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
index c3f8fbe..0f8b006 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
@@ -353,7 +353,7 @@ public final class Point1S implements Point<Point1S> {
      * @throws IllegalArgumentException if the given string has an invalid format
      */
     public static Point1S parse(final String str) {
-        return SimpleTupleFormat.getDefault().parse(str, az -> Point1S.of(az));
+        return SimpleTupleFormat.getDefault().parse(str, Point1S::of);
     }
 
     /** Compute the signed shortest distance (angular separation) between two points. The return
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java
index 36f3241..7581b90 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/ConvexArea2S.java
@@ -258,8 +258,8 @@ public final class ConvexArea2S extends AbstractConvexHyperplaneBoundedRegion<Po
      */
     public static ConvexArea2S fromPath(final GreatArcPath path) {
         final List<GreatCircle> bounds = path.getArcs().stream()
-                .map(a -> a.getCircle())
-                .collect(Collectors.toList());
+            .map(GreatArc::getCircle)
+            .collect(Collectors.toList());
 
         return fromBounds(bounds);
     }


[commons-geometry] 11/12: Spurious "throws" clauses.

Posted by er...@apache.org.
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 219b00f96c2c55b506a1f8f8bfc687c592b75b90
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 15:07:16 2019 +0100

    Spurious "throws" clauses.
    
    Reported by "sonarcloud.io".
---
 .../java/org/apache/commons/geometry/euclidean/internal/Vectors.java  | 2 +-
 .../geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java   | 3 +--
 .../org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java | 4 +---
 .../commons/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java   | 3 +--
 .../java/org/apache/commons/geometry/hull/ConvexHullGenerator.java    | 3 +--
 5 files changed, 5 insertions(+), 10 deletions(-)

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 fa5cc8f..755eaeb 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
@@ -44,7 +44,7 @@ public final class Vectors {
      * @throws IllegalNormException if the given norm value is NaN, infinite,
      *  or zero
      */
-    public static double checkedNorm(final double norm) throws IllegalNormException {
+    public static double checkedNorm(final double norm) {
         if (!isRealNonZero(norm)) {
             throw new IllegalNormException(norm);
         }
diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
index 1f5d3f2..3e2330f 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
@@ -82,8 +82,7 @@ abstract class AbstractConvexHullGenerator2D implements ConvexHullGenerator2D {
 
     /** {@inheritDoc} */
     @Override
-    public ConvexHull2D generate(final Collection<Vector2D> points)
-            throws IllegalStateException {
+    public ConvexHull2D generate(final Collection<Vector2D> points) {
         Collection<Vector2D> hullVertices = null;
         if (points.size() < 2) {
             hullVertices = points;
diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
index 663729f..da716a3 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
@@ -50,9 +50,7 @@ public class ConvexHull2D implements ConvexHull<Vector2D> {
      * @param precision precision context used to compare floating point numbers
      * @throws IllegalArgumentException if the vertices do not form a convex hull
      */
-    public ConvexHull2D(final Vector2D[] vertices, final DoublePrecisionContext precision)
-        throws IllegalArgumentException {
-
+    public ConvexHull2D(final Vector2D[] vertices, final DoublePrecisionContext precision) {
         this.precision = precision;
 
         if (!isConvex(vertices)) {
diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
index 8f46189..ebe71fd 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
@@ -28,6 +28,5 @@ public interface ConvexHullGenerator2D extends ConvexHullGenerator<Vector2D> {
 
     /** {@inheritDoc} */
     @Override
-    ConvexHull2D generate(Collection<Vector2D> points) throws IllegalStateException;
-
+    ConvexHull2D generate(Collection<Vector2D> points);
 }
diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/ConvexHullGenerator.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/ConvexHullGenerator.java
index f3c013a..fdf40a7 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/ConvexHullGenerator.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/ConvexHullGenerator.java
@@ -29,7 +29,6 @@ import org.apache.commons.geometry.core.Point;
  * @see <a href="http://mathworld.wolfram.com/ConvexHull.html">Convex Hull (MathWorld)</a>
  */
 public interface ConvexHullGenerator<P extends Point<P>> {
-
     /**
      * Builds the convex hull from the set of input points.
      *
@@ -38,5 +37,5 @@ public interface ConvexHullGenerator<P extends Point<P>> {
      * @throws IllegalStateException if generator fails to generate a convex hull for
      * the given set of input points
      */
-    ConvexHull<P> generate(Collection<P> points) throws IllegalStateException;
+    ConvexHull<P> generate(Collection<P> points);
 }


[commons-geometry] 10/12: Indentation.

Posted by er...@apache.org.
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 ff86e4d06bc0ff2dbe02d5f560d84b607d8ca1d0
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:55:05 2019 +0100

    Indentation.
---
 .../threed/enclosing/SphereGenerator.java          | 56 +++++++++++-----------
 .../euclidean/twod/enclosing/DiskGenerator.java    | 33 ++++++-------
 2 files changed, 42 insertions(+), 47 deletions(-)

diff --git a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java
index 0b28f16..14cebc5 100644
--- a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java
+++ b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java
@@ -32,14 +32,12 @@ import org.apache.commons.numbers.fraction.BigFraction;
 /** Class generating an enclosing ball from its support points.
  */
 public class SphereGenerator implements SupportBallGenerator<Vector3D> {
-
     /** Base epsilon value. */
     private static final double BASE_EPS = 1e-10;
 
     /** {@inheritDoc} */
     @Override
     public EnclosingBall<Vector3D> ballOnSupport(final List<Vector3D> support) {
-
         if (support.isEmpty()) {
             return new EnclosingBall<>(Vector3D.ZERO, Double.NEGATIVE_INFINITY);
         } else {
@@ -50,15 +48,15 @@ public class SphereGenerator implements SupportBallGenerator<Vector3D> {
                 final Vector3D vB = support.get(1);
                 if (support.size() < 3) {
                     return new EnclosingBall<>(Vector3D.linearCombination(0.5, vA, 0.5, vB),
-                                                                    0.5 * vA.distance(vB),
-                                                                    vA, vB);
+                                               0.5 * vA.distance(vB),
+                                               vA, vB);
                 } else {
                     final Vector3D vC = support.get(2);
                     if (support.size() < 4) {
 
                         // delegate to 2D disk generator
                         final DoublePrecisionContext precision =
-                                new EpsilonDoublePrecisionContext(BASE_EPS * (norm1(vA) + norm1(vB) + norm1(vC)));
+                            new EpsilonDoublePrecisionContext(BASE_EPS * (norm1(vA) + norm1(vB) + norm1(vC)));
                         final Plane p = Plane.fromPoints(vA, vB, vC, precision);
                         final EnclosingBall<Vector2D> disk =
                                 new DiskGenerator().ballOnSupport(Arrays.asList(p.toSubspace(vA),
@@ -112,22 +110,22 @@ public class SphereGenerator implements SupportBallGenerator<Vector3D> {
                             c2[2].multiply(c2[2]).add(c3[2].multiply(c3[2])).add(c4[2].multiply(c4[2])),
                             c2[3].multiply(c2[3]).add(c3[3].multiply(c3[3])).add(c4[3].multiply(c4[3]))
                         };
-                        final BigFraction twoM11  = minor(c2, c3, c4).multiply(2);
-                        final BigFraction m12     = minor(c1, c3, c4);
-                        final BigFraction m13     = minor(c1, c2, c4);
-                        final BigFraction m14     = minor(c1, c2, c3);
+                        final BigFraction twoM11 = minor(c2, c3, c4).multiply(2);
+                        final BigFraction m12 = minor(c1, c3, c4);
+                        final BigFraction m13 = minor(c1, c2, c4);
+                        final BigFraction m14 = minor(c1, c2, c3);
                         final BigFraction centerX = m12.divide(twoM11);
                         final BigFraction centerY = m13.divide(twoM11).negate();
                         final BigFraction centerZ = m14.divide(twoM11);
-                        final BigFraction dx      = c2[0].subtract(centerX);
-                        final BigFraction dy      = c3[0].subtract(centerY);
-                        final BigFraction dz      = c4[0].subtract(centerZ);
-                        final BigFraction r2      = dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz));
+                        final BigFraction dx = c2[0].subtract(centerX);
+                        final BigFraction dy = c3[0].subtract(centerY);
+                        final BigFraction dz = c4[0].subtract(centerZ);
+                        final BigFraction r2 = dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz));
                         return new EnclosingBall<>(Vector3D.of(centerX.doubleValue(),
-                                                                                     centerY.doubleValue(),
-                                                                                     centerZ.doubleValue()),
-                                                                        Math.sqrt(r2.doubleValue()),
-                                                                        vA, vB, vC, vD);
+                                                               centerY.doubleValue(),
+                                                               centerZ.doubleValue()),
+                                                   Math.sqrt(r2.doubleValue()),
+                                                   vA, vB, vC, vD);
                     }
                 }
             }
@@ -141,18 +139,18 @@ public class SphereGenerator implements SupportBallGenerator<Vector3D> {
      * @return value of the minor computed has an exact fraction
      */
     private BigFraction minor(final BigFraction[] c1, final BigFraction[] c2, final BigFraction[] c3) {
-        return      c2[0].multiply(c3[1]).multiply(c1[2].subtract(c1[3])).
-                add(c2[0].multiply(c3[2]).multiply(c1[3].subtract(c1[1]))).
-                add(c2[0].multiply(c3[3]).multiply(c1[1].subtract(c1[2]))).
-                add(c2[1].multiply(c3[0]).multiply(c1[3].subtract(c1[2]))).
-                add(c2[1].multiply(c3[2]).multiply(c1[0].subtract(c1[3]))).
-                add(c2[1].multiply(c3[3]).multiply(c1[2].subtract(c1[0]))).
-                add(c2[2].multiply(c3[0]).multiply(c1[1].subtract(c1[3]))).
-                add(c2[2].multiply(c3[1]).multiply(c1[3].subtract(c1[0]))).
-                add(c2[2].multiply(c3[3]).multiply(c1[0].subtract(c1[1]))).
-                add(c2[3].multiply(c3[0]).multiply(c1[2].subtract(c1[1]))).
-                add(c2[3].multiply(c3[1]).multiply(c1[0].subtract(c1[2]))).
-                add(c2[3].multiply(c3[2]).multiply(c1[1].subtract(c1[0])));
+        return c2[0].multiply(c3[1]).multiply(c1[2].subtract(c1[3])).
+            add(c2[0].multiply(c3[2]).multiply(c1[3].subtract(c1[1]))).
+            add(c2[0].multiply(c3[3]).multiply(c1[1].subtract(c1[2]))).
+            add(c2[1].multiply(c3[0]).multiply(c1[3].subtract(c1[2]))).
+            add(c2[1].multiply(c3[2]).multiply(c1[0].subtract(c1[3]))).
+            add(c2[1].multiply(c3[3]).multiply(c1[2].subtract(c1[0]))).
+            add(c2[2].multiply(c3[0]).multiply(c1[1].subtract(c1[3]))).
+            add(c2[2].multiply(c3[1]).multiply(c1[3].subtract(c1[0]))).
+            add(c2[2].multiply(c3[3]).multiply(c1[0].subtract(c1[1]))).
+            add(c2[3].multiply(c3[0]).multiply(c1[2].subtract(c1[1]))).
+            add(c2[3].multiply(c3[1]).multiply(c1[0].subtract(c1[2]))).
+            add(c2[3].multiply(c3[2]).multiply(c1[1].subtract(c1[0])));
     }
 
     /** Compute the L<sub>1</sub> vector norm for the given set of coordinates.
diff --git a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java
index 885e089..83c5f43 100644
--- a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java
+++ b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java
@@ -26,11 +26,9 @@ import org.apache.commons.numbers.fraction.BigFraction;
 /** Class generating an enclosing ball from its support points.
  */
 public class DiskGenerator implements SupportBallGenerator<Vector2D> {
-
     /** {@inheritDoc} */
     @Override
     public EnclosingBall<Vector2D> ballOnSupport(final List<Vector2D> support) {
-
         if (support.isEmpty()) {
             return new EnclosingBall<>(Vector2D.ZERO, Double.NEGATIVE_INFINITY);
         } else {
@@ -41,8 +39,8 @@ public class DiskGenerator implements SupportBallGenerator<Vector2D> {
                 final Vector2D vB = support.get(1);
                 if (support.size() < 3) {
                     return new EnclosingBall<>(Vector2D.linearCombination(0.5, vA, 0.5, vB),
-                                                                    0.5 * vA.distance(vB),
-                                                                    vA, vB);
+                                               0.5 * vA.distance(vB),
+                                               vA, vB);
                 } else {
                     final Vector2D vC = support.get(2);
                     // a disk is 2D can be defined as:
@@ -70,25 +68,25 @@ public class DiskGenerator implements SupportBallGenerator<Vector2D> {
                         BigFraction.from(vA.getX()), BigFraction.from(vB.getX()), BigFraction.from(vC.getX())
                     };
                     final BigFraction[] c3 = new BigFraction[] {
-                            BigFraction.from(vA.getY()), BigFraction.from(vB.getY()), BigFraction.from(vC.getY())
+                        BigFraction.from(vA.getY()), BigFraction.from(vB.getY()), BigFraction.from(vC.getY())
                     };
                     final BigFraction[] c1 = new BigFraction[] {
                         c2[0].multiply(c2[0]).add(c3[0].multiply(c3[0])),
                         c2[1].multiply(c2[1]).add(c3[1].multiply(c3[1])),
                         c2[2].multiply(c2[2]).add(c3[2].multiply(c3[2]))
                     };
-                    final BigFraction twoM11  = minor(c2, c3).multiply(2);
-                    final BigFraction m12     = minor(c1, c3);
-                    final BigFraction m13     = minor(c1, c2);
+                    final BigFraction twoM11 = minor(c2, c3).multiply(2);
+                    final BigFraction m12 = minor(c1, c3);
+                    final BigFraction m13 = minor(c1, c2);
                     final BigFraction centerX = m12.divide(twoM11);
                     final BigFraction centerY = m13.divide(twoM11).negate();
-                    final BigFraction dx      = c2[0].subtract(centerX);
-                    final BigFraction dy      = c3[0].subtract(centerY);
-                    final BigFraction r2      = dx.multiply(dx).add(dy.multiply(dy));
+                    final BigFraction dx = c2[0].subtract(centerX);
+                    final BigFraction dy = c3[0].subtract(centerY);
+                    final BigFraction r2 = dx.multiply(dx).add(dy.multiply(dy));
                     return new EnclosingBall<>(Vector2D.of(centerX.doubleValue(),
-                                                                                 centerY.doubleValue()),
-                                                                    Math.sqrt(r2.doubleValue()),
-                                                                    vA, vB, vC);
+                                                           centerY.doubleValue()),
+                                               Math.sqrt(r2.doubleValue()),
+                                               vA, vB, vC);
                 }
             }
         }
@@ -100,9 +98,8 @@ public class DiskGenerator implements SupportBallGenerator<Vector2D> {
      * @return value of the minor computed has an exact fraction
      */
     private BigFraction minor(final BigFraction[] c1, final BigFraction[] c2) {
-        return      c2[0].multiply(c1[2].subtract(c1[1])).
-                add(c2[1].multiply(c1[0].subtract(c1[2]))).
-                add(c2[2].multiply(c1[1].subtract(c1[0])));
+        return c2[0].multiply(c1[2].subtract(c1[1])).
+            add(c2[1].multiply(c1[0].subtract(c1[2]))).
+            add(c2[2].multiply(c1[1].subtract(c1[0])));
     }
-
 }


[commons-geometry] 02/12: Merge "if" statements.

Posted by er...@apache.org.
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 33a9519e433c7bd0d373f0616a734af52cbbaeef
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 12:41:22 2019 +0100

    Merge "if" statements.
    
    Reported by "soundcloud.io".
---
 .../geometry/core/partitioning/bsp/AbstractBSPTree.java    | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
index 3825353..b5aa0e0 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
@@ -833,14 +833,12 @@ public abstract class AbstractBSPTree<P extends Point<P>, N extends AbstractBSPT
         /** {@inheritDoc} */
         @Override
         public int depth() {
-            if (depth == UNKNOWN_VALUE) {
-                // calculate our depth based on our parent's depth, if
-                // possible
-                if (parent != null) {
-                    final int parentDepth = parent.depth();
-                    if (parentDepth != UNKNOWN_VALUE) {
-                        depth = parentDepth + 1;
-                    }
+            // Calculate our depth based on our parent's depth, if possible.
+            if (depth == UNKNOWN_VALUE &&
+                parent != null) {
+                final int parentDepth = parent.depth();
+                if (parentDepth != UNKNOWN_VALUE) {
+                    depth = parentDepth + 1;
                 }
             }
             return depth;


[commons-geometry] 06/12: Duplicate "import" removed.

Posted by er...@apache.org.
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 97faa297e5d2b6133d1c2ca97d5aa19222f3dedf
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:14:07 2019 +0100

    Duplicate "import" removed.
    
    Reported by "sonarcloud.io".
---
 .../apache/commons/geometry/euclidean/threed/SphericalCoordinates.java | 1 -
 .../org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java   | 1 -
 .../main/java/org/apache/commons/geometry/spherical/oned/Point1S.java  | 3 +--
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java
index 9772f26..39acef9 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java
@@ -21,7 +21,6 @@ import org.apache.commons.geometry.core.Spatial;
 import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
 import org.apache.commons.geometry.euclidean.internal.Vectors;
 import org.apache.commons.geometry.euclidean.twod.PolarCoordinates;
-import org.apache.commons.numbers.angle.PlaneAngleRadians;
 
 /** Class representing <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system">spherical coordinates</a>
  * in 3 dimensional Euclidean space.
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java
index e2898d6..6857fcd 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java
@@ -19,7 +19,6 @@ package org.apache.commons.geometry.euclidean.twod;
 import org.apache.commons.numbers.angle.PlaneAngleRadians;
 import org.apache.commons.geometry.core.Spatial;
 import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
-import org.apache.commons.numbers.angle.PlaneAngleRadians;
 
 /** Class representing <a href="https://en.wikipedia.org/wiki/Polar_coordinate_system">polar coordinates</a>
  * in 2 dimensional Euclidean space.
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
index 1fea863..c3f8fbe 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java
@@ -19,6 +19,7 @@ package org.apache.commons.geometry.spherical.oned;
 import java.util.Comparator;
 import java.util.Objects;
 
+import org.apache.commons.numbers.angle.PlaneAngle;
 import org.apache.commons.numbers.angle.PlaneAngleRadians;
 import org.apache.commons.geometry.core.Point;
 import org.apache.commons.geometry.core.exception.GeometryValueException;
@@ -26,8 +27,6 @@ import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
 import org.apache.commons.geometry.euclidean.twod.PolarCoordinates;
 import org.apache.commons.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.numbers.angle.PlaneAngle;
-import org.apache.commons.numbers.angle.PlaneAngleRadians;
 
 /** This class represents a point on the 1-sphere, or in other words, an
  * azimuth angle on a circle. The value of the azimuth angle is not normalized


[commons-geometry] 01/12: Use "diamond" operator.

Posted by er...@apache.org.
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 bb673507a02c47887a3675b0d129fce8c0a5be3a
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 12:01:39 2019 +0100

    Use "diamond" operator.
    
    Reported by "sonarcloud.io".
---
 .../apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
index cb63df2..3825353 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
@@ -881,7 +881,7 @@ public abstract class AbstractBSPTree<P extends Point<P>, N extends AbstractBSPT
         /** {@inheritDoc} */
         @Override
         public Iterator<N> iterator() {
-            return new NodeIterator<P, N>(getSelf());
+            return new NodeIterator<>(getSelf());
         }
 
         /** {@inheritDoc} */


[commons-geometry] 07/12: Simplify lambda expressions.

Posted by er...@apache.org.
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 775ea17ea034aa686fe75d81b7dd074c9226d781
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:19:22 2019 +0100

    Simplify lambda expressions.
    
    Reported by "sonarcloud.io".
---
 .../commons/geometry/euclidean/oned/RegionBSPTree1D.java       | 10 +++-------
 .../commons/geometry/spherical/oned/RegionBSPTree1S.java       |  5 ++---
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
index 7d02293..346680a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
@@ -34,9 +34,8 @@ import org.apache.commons.geometry.core.partitioning.bsp.AbstractRegionBSPTree;
  */
 public final class RegionBSPTree1D extends AbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D> {
     /** Comparator used to sort BoundaryPairs by ascending location.  */
-    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR = (BoundaryPair a, BoundaryPair b) -> {
-        return Double.compare(a.getMinValue(), b.getMinValue());
-    };
+    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR =
+        (a, b) -> Double.compare(a.getMinValue(), b.getMinValue());
 
     /** Create a new, empty region.
      */
@@ -176,10 +175,7 @@ public final class RegionBSPTree1D extends AbstractRegionBSPTree<Vector1D, Regio
 
         final List<BoundaryPair> boundaryPairs = new ArrayList<>();
 
-        visitInsideIntervals((min, max) -> {
-            boundaryPairs.add(new BoundaryPair(min, max));
-        });
-
+        visitInsideIntervals((min, max) -> boundaryPairs.add(new BoundaryPair(min, max)));
         boundaryPairs.sort(BOUNDARY_PAIR_COMPARATOR);
 
         final List<Interval> intervals = new ArrayList<>();
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
index cec325e..15c8c54 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
@@ -36,9 +36,8 @@ import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
  */
 public class RegionBSPTree1S extends AbstractRegionBSPTree<Point1S, RegionBSPTree1S.RegionNode1S> {
     /** Comparator used to sort BoundaryPairs by ascending azimuth.  */
-    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR = (BoundaryPair a, BoundaryPair b) -> {
-        return Double.compare(a.getMinValue(), b.getMinValue());
-    };
+    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR =
+        (a, b) -> Double.compare(a.getMinValue(), b.getMinValue());
 
     /** Create a new, empty instance.
      */


[commons-geometry] 12/12: Spurious "transient" keyword.

Posted by er...@apache.org.
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 e2479de54f70ddfc4b254a95e3391440a2fe0ce2
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 15:11:01 2019 +0100

    Spurious "transient" keyword.
---
 .../org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
index da716a3..0d00176 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
@@ -42,7 +42,7 @@ public class ConvexHull2D implements ConvexHull<Vector2D> {
      * Line segments of the hull.
      * The array is not serialized and will be created from the vertices on first access.
      */
-    private transient Segment[] lineSegments;
+    private Segment[] lineSegments;
 
     /**
      * Simple constructor.


[commons-geometry] 04/12: Avoid several method having identical implementation.

Posted by er...@apache.org.
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 d7fb844a13c56823155e9797844ab345c3375691
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 13:48:15 2019 +0100

    Avoid several method having identical implementation.
    
    Aliases should call the "primary" method.
    
    Reported by "sonarcloud.io".
---
 .../commons/geometry/core/precision/EpsilonDoublePrecisionContext.java  | 2 +-
 .../main/java/org/apache/commons/geometry/euclidean/threed/Plane.java   | 2 +-
 .../apache/commons/geometry/spherical/twod/AbstractSubGreatCircle.java  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContext.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContext.java
index 1bc6213..dfc9b34 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContext.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/precision/EpsilonDoublePrecisionContext.java
@@ -56,7 +56,7 @@ public class EpsilonDoublePrecisionContext extends DoublePrecisionContext {
      */
     @Override
     public double getMaxZero() {
-        return epsilon;
+        return getEpsilon();
     }
 
     /** {@inheritDoc} **/
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 14b423f..4fa7081 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
@@ -149,7 +149,7 @@ public final class Plane extends AbstractHyperplane<Vector3D>
      * @see #getW()
      */
     public Vector3D getNormal() {
-        return w;
+        return getW();
     }
 
     /** {@inheritDoc} */
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/AbstractSubGreatCircle.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/AbstractSubGreatCircle.java
index 1a314fd..0c1ba26 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/AbstractSubGreatCircle.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/AbstractSubGreatCircle.java
@@ -46,7 +46,7 @@ abstract class AbstractSubGreatCircle
     /** {@inheritDoc} */
     @Override
     public GreatCircle getHyperplane() {
-        return circle;
+        return getCircle();
     }
 
     /** {@inheritDoc} */


[commons-geometry] 05/12: Anonymous inner class replaced with lambda.

Posted by er...@apache.org.
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 110c707464379e55bb5d9f48d955a980bf727228
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:08:47 2019 +0100

    Anonymous inner class replaced with lambda.
    
    Reported by "sonarcloud.io".
---
 .../commons/geometry/euclidean/twod/hull/MonotoneChain.java       | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

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 9a45066..2a50090 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
@@ -78,10 +78,7 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D {
         final List<Vector2D> pointsSortedByXAxis = new ArrayList<>(points);
 
         // sort the points in increasing order on the x-axis
-        Collections.sort(pointsSortedByXAxis, new Comparator<Vector2D>() {
-            /** {@inheritDoc} */
-            @Override
-            public int compare(final Vector2D o1, final Vector2D o2) {
+        Collections.sort(pointsSortedByXAxis, (o1, o2) -> {
                 final DoublePrecisionContext precision = getPrecision();
                 // need to take the tolerance value into account, otherwise collinear points
                 // will not be handled correctly when building the upper/lower hull
@@ -91,8 +88,7 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D {
                 } else {
                     return diff;
                 }
-            }
-        });
+            });
 
         // build lower hull
         final List<Vector2D> lowerHull = new ArrayList<>();


[commons-geometry] 03/12: Removed "onCut" check which at that point is always "true".

Posted by er...@apache.org.
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 8c1ac8e74cc22179848519f9258f95063101dff1
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 12:48:19 2019 +0100

    Removed "onCut" check which at that point is always "true".
    
    Reported by "sonarcloud.io".
---
 .../apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
index b5aa0e0..e204e2c 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
@@ -339,7 +339,7 @@ public abstract class AbstractBSPTree<P extends Point<P>, N extends AbstractBSPT
 
             if (onMinusSide || (onCut && cutBehavior == NodeCutRule.MINUS)) {
                 return findNode(start.getMinus(), pt, cutBehavior);
-            } else if (onPlusSide || (onCut && cutBehavior == NodeCutRule.PLUS)) {
+            } else if (onPlusSide || cutBehavior == NodeCutRule.PLUS) {
                 return findNode(start.getPlus(), pt, cutBehavior);
             }
         }


[commons-geometry] 08/12: Use "isEmpty()".

Posted by er...@apache.org.
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 4cdadae88b72f5edd4302f452dacacc57ae113d5
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:33:18 2019 +0100

    Use "isEmpty()".
    
    Reported by "sonarcloud.io".
---
 .../commons/geometry/euclidean/threed/enclosing/SphereGenerator.java    | 2 +-
 .../apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java
index 29ce8ee..0b28f16 100644
--- a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java
+++ b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/threed/enclosing/SphereGenerator.java
@@ -40,7 +40,7 @@ public class SphereGenerator implements SupportBallGenerator<Vector3D> {
     @Override
     public EnclosingBall<Vector3D> ballOnSupport(final List<Vector3D> support) {
 
-        if (support.size() < 1) {
+        if (support.isEmpty()) {
             return new EnclosingBall<>(Vector3D.ZERO, Double.NEGATIVE_INFINITY);
         } else {
             final Vector3D vA = support.get(0);
diff --git a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java
index 5af9b99..885e089 100644
--- a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java
+++ b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/euclidean/twod/enclosing/DiskGenerator.java
@@ -31,7 +31,7 @@ public class DiskGenerator implements SupportBallGenerator<Vector2D> {
     @Override
     public EnclosingBall<Vector2D> ballOnSupport(final List<Vector2D> support) {
 
-        if (support.size() < 1) {
+        if (support.isEmpty()) {
             return new EnclosingBall<>(Vector2D.ZERO, Double.NEGATIVE_INFINITY);
         } else {
             final Vector2D vA = support.get(0);