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

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

commit 4175c373baad75bf08336c9c1a4f3ab7b338cb4a
Author: Andreas <andreas.goss1...@gmail.com>
AuthorDate: Sat Jul 22 08:56:18 2023 +0200

    GEOMETRY-144
    
    Rename variables and deleted unnecessary assignment.
---
 .../commons/geometry/euclidean/twod/hull/ConvexHull2D.java    | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
index 7f93c9d5..2ac04683 100644
--- 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
@@ -448,17 +448,17 @@ public final class ConvexHull2D implements 
ConvexHull<Vector2D> {
 
             final Iterator<Vector2D> it = vertices.iterator();
 
+            Vector2D first = it.next();
             Vector2D p1 = it.next();
-            Vector2D p2 = it.next();
-            Vector2D p3;
+            Vector2D v1 = first.vectorTo(p1);
 
-            Vector2D v1 = p1.vectorTo(p2);
+            Vector2D p2;
             Vector2D v2;
 
             while (it.hasNext()) {
-                p3 = it.next();
+                p2 = it.next();
 
-                v2 = p2.vectorTo(p3);
+                v2 = p1.vectorTo(p2);
 
                 // negative signed areas mean a clockwise winding
                 if (precision.compare(v1.signedArea(v2), 0.0) < 0) {
@@ -466,7 +466,6 @@ public final class ConvexHull2D implements 
ConvexHull<Vector2D> {
                 }
 
                 p1 = p2;
-                p2 = p3;
                 v1 = v2;
             }
 

Reply via email to