ConstrainedDelaunayTriangulation
Computes a constrained Delaunay triangulation (CDT) of a Shape.
Every edge of every (closed) contour of shape is guaranteed to appear as an edge in the resulting triangulation, and triangles that fall outside the shape -- including triangles inside holes -- are discarded. Contours are combined using Shape's own containment rule (org.openrndr.shape.contains), so holes, islands inside holes, and compound shapes are all handled.
Internally this is built on Tripack, a direct port of the core algorithms of Robert Renka's TRIPACK (every contour edge is forced into an unconstrained Delaunay triangulation via repeated diagonal swapping), followed by discarding triangles whose centroid falls outside shape.
Parameters
a Shape whose contours are closed and consist solely of linear segments (see Shape.linear).
additional, unconstrained points to include in the triangulation, for example to refine/densify the mesh. Every point must lie inside shape.
Properties
Functions
The point nearest to query.
The positions of the nodes adjacent to pointIndex in the triangulation.
The resulting triangles as index triples into points, in counter-clockwise order.
The Voronoi diagram dual to this triangulation, with cells clipped to bounds.