Skip to content
Last updated

API / geotoolkit / util / DelaunayTriangulator / DelaunayTriangulator

Class: DelaunayTriangulator

util.DelaunayTriangulator.DelaunayTriangulator

Class for triangulation of points using Delaunay algorithm.<br> The triangulation methods used in this class are based on:<ul> <li>Implementation by Mapbox https://github.com/mapbox/delaunator, released under the ISC License</li> <li>Implementation by Paul Bourke ported to JS https://github.com/darkskyapp/delaunay-fast, released under public domain CC0 1.0 Licence</li> </ul> This algorithm triangulates a set of 2D points, and is also capable of triangulating 3D points on the XY plane (by ignoring Z values)<br>

Table of contents

Constructors
  • [new DelaunayTriangulator()](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.util.delaunaytriangulator.delaunaytriangulator.md#new delaunaytriangulator())
Methods

Contents

Constructors

new DelaunayTriangulator()

• new DelaunayTriangulator()

Methods

getClassName

▸ getClassName(): string

Returns

string


getClassName

▸ Static getClassName(): string

Returns

string


triangulate

▸ Static triangulate(vertices, is2d?): number[]

Triangulate the given points using Delaunay algorithm.<br> Different algorithms will be used if providing: <ul><li> 2D points (and setting the "is2d" option to true) will use the so-called "Delaunator" implementation. Note that the Z coordinate will be ignored.<br> See https://github.com/mapbox/delaunator. </li><li> 3D points (default or setting the "is2d" option to false) will use the so-called "Delaunay-Fast" implementation.<br> See https://github.com/darkskyapp/delaunay-fast. </li></ul>

Parameters

Name Type Description
verticesnumber[]vertices
Optional is2dbooleanif 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.

Returns

number[]

triangle indices in the form [t1p1,t1p2,t1p3, t2p1,t2p2,t2p3, etc].


triangulateSurface

▸ 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).<br> 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.<br> 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.<br> The implementation used for this triangulation is https://github.com/mapbox/delaunator.

Parameters

Name Type Description
vertices3Dnumber[]3D vertices.
Optional optionsTriangulateSurfacethe triangulation options.

Returns

number[]

triangle indices in the form [t1p1,t1p2,t1p3, t2p1,t2p2,t2p3, etc].