Class PolygonTriangulator
- java.lang.Object
-
- org.locationtech.jts.triangulate.polygon.PolygonTriangulator
-
public class PolygonTriangulator extends java.lang.Object
Computes a triangulation of each polygon in aGeometry
. A polygon triangulation is a non-overlapping set of triangles which cover the polygon and have the same vertices as the polygon. The priority is on performance rather than triangulation quality, so that the output may contain many narrow triangles.Holes are handled by joining them to the shell to form a (self-touching) polygon shell with no holes. Although invalid, this can be triangulated effectively.
For better-quality triangulation use
ConstrainedDelaunayTriangulator
.- Author:
- Martin Davis
- See Also:
ConstrainedDelaunayTriangulator
-
-
Constructor Summary
Constructors Constructor Description PolygonTriangulator(Geometry inputGeom)
Constructs a new triangulator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometry
getResult()
Gets the triangulation as aGeometryCollection
of triangularPolygon
s.java.util.List<Tri>
getTriangles()
Gets the triangulation as a list ofTri
s.static Geometry
triangulate(Geometry geom)
Computes a triangulation of each polygon in a geometry.
-
-
-
Constructor Detail
-
PolygonTriangulator
public PolygonTriangulator(Geometry inputGeom)
Constructs a new triangulator.- Parameters:
inputGeom
- the input geometry
-
-
Method Detail
-
triangulate
public static Geometry triangulate(Geometry geom)
Computes a triangulation of each polygon in a geometry.- Parameters:
geom
- a geometry containing polygons- Returns:
- a GeometryCollection containing the triangle polygons
-
getResult
public Geometry getResult()
Gets the triangulation as aGeometryCollection
of triangularPolygon
s.- Returns:
- a collection of the result triangle polygons
-
-