triangualize - ObjectVision/GeoDMS GitHub Wiki
Geometric functions triangualize
The triangualize function creates a Delaunay triangulation from a set of points.
triangualize(points: E->Point) -> E->Sequence<Point>
Computes a Delaunay triangulation of the input points. The Delaunay triangulation is a triangulation where no point is inside the circumcircle of any triangle - this maximizes the minimum angle of all triangles.
The result is a sequence of points for each input point, representing the triangles that include that point as a vertex. This is organized as a triangle fan around each point.
The Delaunay triangulation has important properties:
- It is unique (except for degenerate cases with co-circular points)
- It maximizes the minimum angle (avoids thin triangles)
- It is the dual graph of the Voronoi diagram
- The number of triangles is approximately 2n-5 for n points
| argument | description | type |
|---|---|---|
| points | Input point set to triangulate | E->Point |
Time complexity: O(n × log n) expected for well-distributed points using sweep line algorithm.
Worst case can be O(n²) for pathological distributions, but this is rare in practice.
Memory usage is O(n) for the triangulation structure.
- At least 3 non-collinear points are required for a valid triangulation
- All points must be defined (non-null)
- Duplicate points may cause issues
unit<uint32> SamplePoints: nrofrows = 100;
attribute<DPoint> location (SamplePoints); // random or measured points
// Create Delaunay triangulation
attribute<DPoint> triangles (poly, SamplePoints) := triangualize(location);
// The triangulation can be used for:
// - Terrain modeling (TIN)
// - Interpolation
// - Mesh generation
- Terrain modeling: Creating Triangulated Irregular Networks (TIN) from elevation samples
- Interpolation: Natural neighbor or linear interpolation over triangulated surfaces
- Mesh generation: Starting point for finite element meshes
- Spatial analysis: Identifying natural neighbors, computing Voronoi diagrams
- Geometric functions
- points2polygon - creates polygons from point sequences
5.0