You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2025/04/25 12:53:54 UTC

(commons-geometry) 20/25: sonar fix: merge if statements

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

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

commit dd037c7aa8b55f4e6bb5e55702c6df87c51dab01
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri Apr 25 13:14:37 2025 +0100

    sonar fix: merge if statements
---
 .../geometry/euclidean/twod/hull/ConvexHullBuilderTest.java       | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullBuilderTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullBuilderTest.java
index 016c417f..f35f6d2d 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullBuilderTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHullBuilderTest.java
@@ -570,11 +570,9 @@ class ConvexHullBuilderTest {
                     .addProduct(-d1.getY(), d2.getX()).getAsDouble();
             final int cmp = Precision.compareTo(cross, 0.0, TEST_EPS);
 
-            if (sign != 0 && cmp != sign) {
-                if (!includesCollinearPoints || cmp != 0) {
-                    // in case of collinear points the cross product will be zero
-                    return false;
-                }
+            if (sign != 0 && cmp != sign && (!includesCollinearPoints || cmp != 0)) {
+                // in case of collinear points the cross product will be zero
+                return false;
             }
 
             sign = cmp;