API / geotoolkit / util / DelaunayTriangulator / DelaunayTriangulator
util.DelaunayTriangulator.DelaunayTriangulator
Class for triangulation of points using Delaunay algorithm.
The triangulation methods used in this class are based on:
- Implementation by Mapbox https://github.com/mapbox/delaunator, released under the ISC License
- Implementation by Paul Bourke ported to JS https://github.com/darkskyapp/delaunay-fast, released under public domain CC0 1.0 Licence
Constructors
Methods
▸ getClassName(): string
string
▸ Static getClassName(): string
string
▸ Static triangulate(vertices, is2d?): number[]
Triangulate the given points using Delaunay algorithm.
Different algorithms will be used if providing:
-
2D points (and setting the "is2d" option to true) will use the so-called "Delaunator" implementation. Note that the Z coordinate will be ignored.
See https://github.com/mapbox/delaunator. -
3D points (default or setting the "is2d" option to false) will use the so-called "Delaunay-Fast" implementation.
See https://github.com/darkskyapp/delaunay-fast.
| Name | Type | Description |
|---|---|---|
vertices | number[] | vertices |
Optional is2d | boolean | if the given array contains 2 or 3 values per point, false by default. The 3rd coordinate (Z) is ignored, but a different algorithm is used. |
number[]
triangle indices in the form [t1p1,t1p2,t1p3, t2p1,t2p2,t2p3, etc].
▸ Static triangulateSurface(vertices3D, options?): number[]
Triangulate the given 3D points using Delaunay algorithm (2D triangulation, Z coordinates will be ignored), this version works best for non-ordered point sets (that do not follow a row or column order layout).
This triangulation will produce more accurate results if the given points form a convex shape (ideally), but if not, concave artifacts can be filtered with the filtergaps options.
Because this triangulation algorithm only takes into account X and Y coordinates, users may want to pre-filter the points, or filter the generated indexed triangles based on potentially invalid Z values to avoid 3D issues.
The implementation used for this triangulation is https://github.com/mapbox/delaunator.
| Name | Type | Description |
|---|---|---|
vertices3D | number[] | 3D vertices. |
Optional options | TriangulateSurface | the triangulation options. |
number[]
triangle indices in the form [t1p1,t1p2,t1p3, t2p1,t2p2,t2p3, etc].