Class AbstractConvexHullGenerator2D
- java.lang.Object
-
- org.apache.commons.math3.geometry.euclidean.twod.hull.AbstractConvexHullGenerator2D
-
- All Implemented Interfaces:
ConvexHullGenerator2D,ConvexHullGenerator<Euclidean2D,Vector2D>
- Direct Known Subclasses:
MonotoneChain
abstract class AbstractConvexHullGenerator2D extends java.lang.Object implements ConvexHullGenerator2D
Abstract base class for convex hull generators in the two-dimensional euclidean space.- Since:
- 3.3
-
-
Field Summary
Fields Modifier and Type Field Description private static doubleDEFAULT_TOLERANCEDefault value for tolerance.private booleanincludeCollinearPointsIndicates if collinear points on the hull shall be present in the output.private doubletoleranceTolerance below which points are considered identical.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConvexHullGenerator2D(boolean includeCollinearPoints)Simple constructor.protectedAbstractConvexHullGenerator2D(boolean includeCollinearPoints, double tolerance)Simple constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.Collection<Vector2D>findHullVertices(java.util.Collection<Vector2D> points)Find the convex hull vertices from the set of input points.ConvexHull2Dgenerate(java.util.Collection<Vector2D> points)Builds the convex hull from the set of input points.doublegetTolerance()Get the tolerance below which points are considered identical.booleanisIncludeCollinearPoints()Returns if collinear points on the hull will be added as hull vertices.
-
-
-
Field Detail
-
DEFAULT_TOLERANCE
private static final double DEFAULT_TOLERANCE
Default value for tolerance.- See Also:
- Constant Field Values
-
tolerance
private final double tolerance
Tolerance below which points are considered identical.
-
includeCollinearPoints
private final boolean includeCollinearPoints
Indicates if collinear points on the hull shall be present in the output. Iffalse, only the extreme points are added to the hull.
-
-
Constructor Detail
-
AbstractConvexHullGenerator2D
protected AbstractConvexHullGenerator2D(boolean includeCollinearPoints)
Simple constructor.The default tolerance (1e-10) will be used to determine identical points.
- Parameters:
includeCollinearPoints- indicates if collinear points on the hull shall be added as hull vertices
-
AbstractConvexHullGenerator2D
protected AbstractConvexHullGenerator2D(boolean includeCollinearPoints, double tolerance)Simple constructor.- Parameters:
includeCollinearPoints- indicates if collinear points on the hull shall be added as hull verticestolerance- tolerance below which points are considered identical
-
-
Method Detail
-
getTolerance
public double getTolerance()
Get the tolerance below which points are considered identical.- Returns:
- the tolerance below which points are considered identical
-
isIncludeCollinearPoints
public boolean isIncludeCollinearPoints()
Returns if collinear points on the hull will be added as hull vertices.- Returns:
trueif collinear points are added as hull vertices, orfalseif only extreme points are present.
-
generate
public ConvexHull2D generate(java.util.Collection<Vector2D> points) throws NullArgumentException, ConvergenceException
Builds the convex hull from the set of input points.- Specified by:
generatein interfaceConvexHullGenerator<Euclidean2D,Vector2D>- Specified by:
generatein interfaceConvexHullGenerator2D- Parameters:
points- the set of input points- Returns:
- the convex hull
- Throws:
NullArgumentException- if the input collection isnullConvergenceException- if generator fails to generate a convex hull for the given set of input points
-
-