Top Description Fields Constructors Methods
org.apache.commons.math3.geometry.euclidean.twod.hull

pack-priv abstract Class AbstractConvexHullGenerator2D

extends Object
implements ConvexHullGenerator2D
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHullGenerator2D, org.apache.commons.math3.geometry.hull.ConvexHullGenerator
Known Direct Subclasses
org.apache.commons.math3.geometry.euclidean.twod.hull.MonotoneChain
Imports
java.util.Collection, org.apache.commons.math3.exception.ConvergenceException, .MathIllegalArgumentException, .NullArgumentException, org.apache.commons.math3.geometry.euclidean.twod.Vector2D, org.apache.commons.math3.util.MathUtils

Abstract base class for convex hull generators in the two-dimensional euclidean space.
Since
3.3

Field Summary

Modifier and TypeField and Description
private static final double
DEFAULT_TOLERANCE

Default value for tolerance.

private final boolean
includeCollinearPoints

Indicates if collinear points on the hull shall be present in the output.

private final double
tolerance

Tolerance below which points are considered identical.

Constructor Summary

AccessConstructor and Description
protected
AbstractConvexHullGenerator2D(final boolean
indicates if collinear points on the hull shall be added as hull vertices
includeCollinearPoints
)

Simple constructor.

protected
AbstractConvexHullGenerator2D(final boolean
indicates if collinear points on the hull shall be added as hull vertices
includeCollinearPoints
,
final double
tolerance below which points are considered identical
tolerance
)

Simple constructor.

Method Summary

Modifier and TypeMethod and Description
protected abstract Collection<Vector2D>

Returns:

the convex hull vertices in CCW winding
findHullVertices
(Collection<Vector2D>
the set of input points
points
)

Find the convex hull vertices from the set of input points.

public ConvexHull2D
generate(final Collection<Vector2D>
the set of input points
points
)

Implements org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHullGenerator2D.generate.

Builds the convex hull from the set of input points.

public double

Returns:

the tolerance below which points are considered identical
getTolerance
()

Get the tolerance below which points are considered identical.

public boolean

Returns:

true if collinear points are added as hull vertices, or false if only extreme points are present.
isIncludeCollinearPoints
()

Returns if collinear points on the hull will be added as hull vertices.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_TOLERANCEback to summary
private static final double DEFAULT_TOLERANCE

Default value for tolerance.

includeCollinearPointsback to summary
private final boolean includeCollinearPoints

Indicates if collinear points on the hull shall be present in the output. If false, only the extreme points are added to the hull.

toleranceback to summary
private final double tolerance

Tolerance below which points are considered identical.

Constructor Detail

AbstractConvexHullGenerator2Dback to summary
protected AbstractConvexHullGenerator2D(final boolean includeCollinearPoints)

Simple constructor.

The default tolerance (1e-10) will be used to determine identical points.

Parameters
includeCollinearPoints:boolean

indicates if collinear points on the hull shall be added as hull vertices

AbstractConvexHullGenerator2Dback to summary
protected AbstractConvexHullGenerator2D(final boolean includeCollinearPoints, final double tolerance)

Simple constructor.

Parameters
includeCollinearPoints:boolean

indicates if collinear points on the hull shall be added as hull vertices

tolerance:double

tolerance below which points are considered identical

Method Detail

findHullVerticesback to summary
protected abstract Collection<Vector2D> findHullVertices(Collection<Vector2D> points)

Find the convex hull vertices from the set of input points.

Parameters
points:Collection<Vector2D>

the set of input points

Returns:Collection<Vector2D>

the convex hull vertices in CCW winding

generateback to summary
public ConvexHull2D generate(final Collection<Vector2D> points) throws NullArgumentException, ConvergenceException

Implements org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHullGenerator2D.generate.

Doc from org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHullGenerator2D.generate.

Builds the convex hull from the set of input points.

Parameters
points:Collection<Vector2D>

Doc from org.apache.commons.math3.geometry.hull.ConvexHullGenerator.generate.

the set of input points

Returns:ConvexHull2D

Doc from org.apache.commons.math3.geometry.hull.ConvexHullGenerator.generate.

the convex hull

Exceptions
NullArgumentException:

Doc from org.apache.commons.math3.geometry.hull.ConvexHullGenerator.generate.

if the input collection is null

ConvergenceException:

Doc from org.apache.commons.math3.geometry.hull.ConvexHullGenerator.generate.

if generator fails to generate a convex hull for the given set of input points

getToleranceback to summary
public double getTolerance()

Get the tolerance below which points are considered identical.

Returns:double

the tolerance below which points are considered identical

isIncludeCollinearPointsback to summary
public boolean isIncludeCollinearPoints()

Returns if collinear points on the hull will be added as hull vertices.

Returns:boolean

true if collinear points are added as hull vertices, or false if only extreme points are present.