Problem: Find the Delaunay triangulation of a projectable set of points
A 2d Delaunay triangulation is the triangulation of the projection of 3d points onto the XY-plane so that the resulting triangles are the "least sliver" ones of all possible triangulations.
A 2d Delaunay triangulation can not triangulate points with identical X and Y coordinates. Practically, this means that vertical or recessing walls or "caves" can not be triangulated.
However, if a projectable view on the points exists, you may apply a coordinate transformation on the points, triangulate and re-transform the points to obtain a valid triangulaton.
Solution using D#
- public static void DelaunayExample()
- {
- // Create a sample point set
- PointSet ps = SamplePoints.SupershapeStarfish(10000);
- // Instantiate a delaunay triangulation
- // Assign the point set to triangulate
- dt.TriangulationPoints = ps;
- // Triangulate the point set
- dt.Triangulate();
- // You may add points to the existing triangulation
- // Get the triangulation
- List<Triangle> triangles = dt.GetTriangles();
- // visualize: ---------------------------------------------------
- // Make a scene
- // Set the point style
- sc.PointDisplayMode = 0;
- sc.PointSize = 0;
- // Make a layer for the triangles
- // Make a layer for the triangulation points
- // Add the triangles and the triangulation points to the scene
- sc.Add(triangles, tLayer);
- sc.Add(dt.TriangulationPoints, pLay);
- // Output the scene as dxf
- sc.WriteDxf(@"c:\delaunay.dxf");
- }


