public class ConvexHull2D extends java.lang.Object implements ConvexHull<Euclidean2D,Vector2D>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
private Segment[] |
lineSegments
Line segments of the hull.
|
private static long |
serialVersionUID
Serializable UID.
|
private double |
tolerance
Tolerance threshold used during creation of the hull vertices.
|
private Vector2D[] |
vertices
Vertices of the hull.
|
| Constructor and Description |
|---|
ConvexHull2D(Vector2D[] vertices,
double tolerance)
Simple constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Region<Euclidean2D> |
createRegion()
Returns a new region that is enclosed by the convex hull.
|
Segment[] |
getLineSegments()
Get the line segments of the convex hull, ordered.
|
Vector2D[] |
getVertices()
Get the vertices of the convex hull.
|
private boolean |
isConvex(Vector2D[] hullVertices)
Checks whether the given hull vertices form a convex hull.
|
private Segment[] |
retrieveLineSegments()
Retrieve the line segments from the cached array or create them if needed.
|
private static final long serialVersionUID
private final Vector2D[] vertices
private final double tolerance
private transient Segment[] lineSegments
public ConvexHull2D(Vector2D[] vertices, double tolerance) throws MathIllegalArgumentException
vertices - the vertices of the convex hull, must be orderedtolerance - tolerance below which points are considered identicalMathIllegalArgumentException - if the vertices do not form a convex hullprivate boolean isConvex(Vector2D[] hullVertices)
hullVertices - the hull verticestrue if the vertices form a convex hull, false otherwisepublic Vector2D[] getVertices()
getVertices in interface ConvexHull<Euclidean2D,Vector2D>public Segment[] getLineSegments()
private Segment[] retrieveLineSegments()
public Region<Euclidean2D> createRegion() throws InsufficientDataException
createRegion in interface ConvexHull<Euclidean2D,Vector2D>InsufficientDataException - if the number of vertices is not enough to
build a region in the respective spaceCopyright (c) 2003-2015 Apache Software Foundation