You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2023/09/04 01:04:20 UTC
[commons-geometry] 19/25: GEOMETRY-144
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 5bf0e9ad38c7ded6fbaac98b8f1f819193206835
Author: Andreas <an...@gmail.com>
AuthorDate: Sat Aug 12 20:13:35 2023 +0200
GEOMETRY-144
Since the given Collection of points is a PointSet equivalent points are
already filtered out.
---
.../commons/geometry/euclidean/twod/hull/ConvexHull2D.java | 12 +++---------
1 file changed, 3 insertions(+), 9 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 3b8710ce..62ec349e 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
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.List;
import org.apache.commons.geometry.core.ConvexHull;
+import org.apache.commons.geometry.core.collection.PointSet;
import org.apache.commons.geometry.euclidean.EuclideanCollections;
import org.apache.commons.geometry.euclidean.twod.ConvexArea;
import org.apache.commons.geometry.euclidean.twod.Lines;
@@ -139,8 +140,9 @@ public final class ConvexHull2D implements ConvexHull<Vector2D> {
private Vector2D maxY;
/** Collection of all remaining candidates for a convex hull. */
- private final Collection<Vector2D> candidates;
+ private final PointSet<Vector2D> candidates;
+ /** Points are tested against this quadrilateral */
private final List<Vector2D> quadrilateral;
/** A precision context for comparing points. */
@@ -391,14 +393,6 @@ public final class ConvexHull2D implements ConvexHull<Vector2D> {
* @param hull the partial hull
*/
private void updateHull(final Vector2D point, final List<Vector2D> hull) {
- if (hull.size() == 1) {
- // ensure that we do not add an identical point
- final Vector2D p1 = hull.get(0);
- if (p1.eq(point, precision)) {
- return;
- }
- }
-
while (hull.size() >= 2) {
final int size = hull.size();
final Vector2D p1 = hull.get(size - 2);