The runtime complexity is O(n log n), with n being the number of input points. If the point set is already sorted (by x-coordinate), the runtime complexity is O(n).
The implementation is not sensitive to collinear points on the hull. The parameter
includeCollinearPoints allows to control the behavior with regard to collinear points.
If true, all points on the boundary of the hull will be added to the hull vertices,
otherwise only the extreme points will be present. By default, collinear points are not added
as hull vertices.
The tolerance parameter (default: 1e-10) is used as epsilon criteria to determine
identical and collinear points.
| Access | Constructor and Description |
|---|---|
| public | |
| public | MonotoneChain(final boolean
whether collinear points shall be added as hull vertices includeCollinearPoints)Create a new MonotoneChain instance. |
| public | MonotoneChain(final boolean
whether collinear points shall be added as hull vertices includeCollinearPoints, final double tolerance below which points are considered identical tolerance)Create a new MonotoneChain instance. |
| Modifier and Type | Method and Description |
|---|---|
| public Collection | findHullVertices(final Collection<Vector2D>
the set of input points points)Implements abstract org. Find the convex hull vertices from the set of input points. |
| private void | updateHull(final Vector2D
the current point point, final List<Vector2D> the partial hull hull)Update the partial hull with the current point. |
| MonotoneChain | back to summary |
|---|---|
| public MonotoneChain() Create a new MonotoneChain instance. | |
| MonotoneChain | back to summary |
|---|---|
| public MonotoneChain(final boolean includeCollinearPoints) Create a new MonotoneChain instance.
| |
| MonotoneChain | back to summary |
|---|---|
| public MonotoneChain(final boolean includeCollinearPoints, final double tolerance) Create a new MonotoneChain instance.
| |
| findHullVertices | back to summary |
|---|---|
| public Collection Implements abstract org. Doc from org. Find the convex hull vertices from the set of input points.
| |
| updateHull | back to summary |
|---|---|
| private void updateHull(final Vector2D point, final List<Vector2D> hull) Update the partial hull with the current point. | |