Package elki.math.geometry
Class FilteredConvexHull2D
- java.lang.Object
-
- elki.math.geometry.FilteredConvexHull2D
-
public class FilteredConvexHull2D extends java.lang.ObjectAccelerate computing the convex hull with a simple filter.For this filter, we maintain a simple box that is guaranteed to be fully inside the convex hull. Points in this rectangle will be skipped.
TODO: allow using this with other bounding box algorithms, too.
- Since:
- 0.7.5
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private double[]bottomleftTop-left pointprivate double[]bottomrightTop-left pointprivate doublebottomyLeft boundprivate doubleleftxLeft boundprivate java.util.List<double[]>pointsThe current set of candidate points.private PolygonpolyComputed polygon.private doublerightxLeft boundprivate double[]topleftTop-left pointprivate double[]toprightTop-left pointprivate doubletopyLeft bound
-
Constructor Summary
Constructors Constructor Description FilteredConvexHull2D()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(double... point)Add a single point to the list (this does not compute the hull!)private booleancheckCandidate(double[] point)private booleancheckCandidateUpdate(double[] point)Check whether a point is inside the current bounds, and update the boundsprivate PolygoncomputeConvexHull()Compute the convex hull.PolygongetHull()Compute the convex hull, and return the resulting polygon.
-
-
-
Field Detail
-
points
private java.util.List<double[]> points
The current set of candidate points.
-
leftx
private double leftx
Left bound
-
rightx
private double rightx
Left bound
-
topy
private double topy
Left bound
-
bottomy
private double bottomy
Left bound
-
topleft
private double[] topleft
Top-left point
-
topright
private double[] topright
Top-left point
-
bottomright
private double[] bottomright
Top-left point
-
bottomleft
private double[] bottomleft
Top-left point
-
poly
private Polygon poly
Computed polygon.
-
-
Method Detail
-
add
public void add(double... point)
Add a single point to the list (this does not compute the hull!)- Parameters:
point- Point to add
-
computeConvexHull
private Polygon computeConvexHull()
Compute the convex hull.- Returns:
- resulting polygon
-
checkCandidate
private boolean checkCandidate(double[] point)
-
checkCandidateUpdate
private boolean checkCandidateUpdate(double[] point)
Check whether a point is inside the current bounds, and update the bounds- Parameters:
point- New point- Returns:
trueif the point is potentially on the hull
-
getHull
public Polygon getHull()
Compute the convex hull, and return the resulting polygon.- Returns:
- Polygon of the hull
-
-