Package elki.math.geometry
Class FilteredConvexHull2D
- java.lang.Object
-
- elki.math.geometry.FilteredConvexHull2D
-
public class FilteredConvexHull2D extends java.lang.Object
Accelerate 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[]
bottomleft
Top-left pointprivate double[]
bottomright
Top-left pointprivate double
bottomy
Left boundprivate double
leftx
Left boundprivate java.util.List<double[]>
points
The current set of candidate points.private Polygon
poly
Computed polygon.private double
rightx
Left boundprivate double[]
topleft
Top-left pointprivate double[]
topright
Top-left pointprivate double
topy
Left bound
-
Constructor Summary
Constructors Constructor Description FilteredConvexHull2D()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double... point)
Add a single point to the list (this does not compute the hull!)private boolean
checkCandidate(double[] point)
private boolean
checkCandidateUpdate(double[] point)
Check whether a point is inside the current bounds, and update the boundsprivate Polygon
computeConvexHull()
Compute the convex hull.Polygon
getHull()
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:
true
if 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
-
-