ComputationalGeometry
PolygonTriangulation
triangulate a simple polygon
Calling Sequence
Parameters
Description
Examples
Compatibility
PolygonTriangulation(polygon)
PolygonTriangulation(polygon,option)
polygon
-
a list of two element lists or an n by 2 Matrix representing a simple polygon in either clockwise or counterclockwise order
option
(optional) keyword option of the form method=name
The PolygonTriangulation command computes a triangulation of a simple polygon.
The method option specifies the triangulation algorithm used. method can be either earclipping or monotone. The default method is earclipping.
The monotone method is faster for large polygons, but the earclipping method is more likely to produce better quality triangulations.
The triangles are returned as a list of three element lists; each inner list specifies the three vertices of a triangle as integer references into the input polygon list or Matrix.
Except for the first vertex and the last vertex, the polygon should not contain duplicate vertices.
with⁡ComputationalGeometry:
xy≔391,374,240,431,252,340,374,320,289,214,134,390,68,186,154,259,161,107,435,108,208,148,295,160,421,212,441,303
plots:-display⁡plottools:-polygon⁡xy,style=line
t≔PolygonTriangulation⁡xy,method=monotone
t≔3,1,2,4,3,1,14,4,1,5,14,4,13,5,14,5,8,6,12,13,5,12,5,8,11,12,8,9,10,11,9,11,8,7,8,6
plots:-display⁡map⁡x↦plottools:−polygon⁡xyx,style=line,t
The ComputationalGeometry[PolygonTriangulation] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Download Help Document