public class ConformingDelaunayTriangulator extends Object
A conforming Delaunay triangulation is a true Delaunay triangulation. In it each constraint segment is present as a union of one or more triangulation edges. Constraint segments may be subdivided into two or more triangulation edges by the insertion of additional sites. The additional sites are called Steiner points, and are necessary to allow the segments to be faithfully reflected in the triangulation while maintaining the Delaunay property. Another way of stating this is that in a conforming Delaunay triangulation every constraint segment will be the union of a subset of the triangulation edges (up to tolerance).
A Conforming Delaunay triangulation is distinct from a Constrained Delaunay triangulation. A Constrained Delaunay triangulation is not necessarily fully Delaunay, and it contains the constraint segments exactly as edges of the triangulation.
A typical usage pattern for the triangulator is:
ConformingDelaunayTriangulator cdt = new ConformingDelaunayTriangulator(sites, tolerance);
// optional
cdt.setSplitPointFinder(splitPointFinder);
cdt.setVertexFactory(vertexFactory);
cdt.setConstraints(segments, new ArrayList(vertexMap.values()));
cdt.formInitialDelaunay();
cdt.enforceConstraints();
subdiv = cdt.getSubdivision();
| Constructor and Description |
|---|
ConformingDelaunayTriangulator(Collection
Creates a Conforming Delaunay Triangulation based on the given unconstrained initial vertices.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enforceConstraints()
Enforces the supplied constraints into the triangulation.
|
void |
formInitialDelaunay()
Computes the Delaunay triangulation of the initial sites.
|
Collection |
getConstraintSegments()
Gets the
Segments which represent the constraints.
|
Geometry |
getConvexHull()
Gets the convex hull of all the sites in the triangulation, including constraint vertices.
|
List |
getInitialVertices()
Gets the sites (vertices) used to initialize the triangulation.
|
KdTree |
getKDT()
Gets the
KdTree which contains the vertices of the triangulation.
|
QuadEdgeSubdivision |
getSubdivision()
Gets the
QuadEdgeSubdivision which represents the triangulation.
|
double |
getTolerance()
Gets the tolerance value used to construct the triangulation.
|
ConstraintVertexFactory |
getVertexFactory()
Gets the
ConstraintVertexFactory used to create new constraint vertices at split points.
|
void |
insertSite(Coordinate
Inserts a site into the triangulation, maintaining the conformal Delaunay property.
|
void |
setConstraints(List
Sets the constraints to be conformed to by the computed triangulation.
|
void |
setSplitPointFinder(ConstraintSplitPointFinder
Sets the
ConstraintSplitPointFinder to be used during constraint enforcement.
|
void |
setVertexFactory(ConstraintVertexFactory
Sets a custom
ConstraintVertexFactory to be used to allow vertices carrying extra information to be created.
|
public ConformingDelaunayTriangulator(CollectioninitialVertices, double tolerance)
initialVertices - a collection of
ConstraintVertex
tolerance - the distance tolerance below which points are considered identical
public void setConstraints(Listsegments, List segVertices)
ConstraintVertexes) forming the constraints must also be supplied. Supplying it explicitly allows the ConstraintVertexes to be initialized appropriately(e.g. with external data), and avoids re-computing the unique set if it is already available.
segments - a list of the constraint
Segments
segVertices - the set of unique
ConstraintVertexes referenced by the segments
public void setSplitPointFinder(ConstraintSplitPointFindersplitFinder)
ConstraintSplitPointFinder to be used during constraint enforcement. Different splitting strategies may be appropriate for special situations.
splitFinder - the ConstraintSplitPointFinder to be used
public double getTolerance()
public ConstraintVertexFactorygetVertexFactory()
public void setVertexFactory(ConstraintVertexFactoryvertexFactory)
ConstraintVertexFactory to be used to allow vertices carrying extra information to be created.
vertexFactory - the ConstraintVertexFactory to be used
public QuadEdgeSubdivisiongetSubdivision()
QuadEdgeSubdivision which represents the triangulation.
public KdTreegetKDT()
KdTree which contains the vertices of the triangulation.
public ListgetInitialVertices()
public CollectiongetConstraintSegments()
Segments which represent the constraints.
public GeometrygetConvexHull()
public void insertSite(Coordinatep)
p - the location of the site to insert
public void formInitialDelaunay()
public void enforceConstraints()
ConstraintEnforcementException - if the constraints cannot be enforced