DelaunayTriangulation

Creates the Delaunay triangulation of a set of points: the triangles that join them without crossing, as close to equilateral as possible, the base of a TIN surface from surveyed points. The triangles get the lowest and highest elevation of their vertices.

Details

The triangles are those of a Delaunay triangulation: the circle through the three vertices of a triangle contains no other point. Of all the triangulations of the points, it is the one with the largest smallest angle, so the triangles are as little slivered as the points allow, which makes it the usual base of a TIN (triangulated irregular network). The triangulation covers the convex hull of the points. Points in the same position are used once.

With an elevation, from the field fElev or else from the z of the points, the vertices of the triangles have it as z, and each triangle gets the lowest and the highest elevation of its vertices in the fields minelev and maxelev. The output has only these fields: the triangles don’t belong to a single point, so the other attributes of the points are not kept.

Parameters

Creates the Delaunay triangulation of a set of points: the triangles that join them without crossing, as close to equilateral as possible.

Toolbox folder: Vector Processing
Status: Certified
Keywords: vector, delaunay, triangulation, TIN
Authors: Andrea Antonello, Silvia Franceschi
Class: org.hortonmachine.modules.DelaunayTriangulation

Inputs

Parameter

Type

Unit

Default

Description

inMap

vector file

The input points map.

fElev

String

The optional field with the elevation of the points. If not set, the z of the points is used, if they have one.

Outputs

Parameter

Type

Unit

Description

outMap

output file

The output triangles map.

Example

The example triangulates the centroids of the sub-basins of BasinShape, made by VectorReshaper, with their mean elevation:

import org.hortonmachine.modules.DelaunayTriangulation
import org.hortonmachine.modules.VectorReshaper

// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"

// the centroids of the sub-basins of BasinShape, with their mean elevation
var reshaper = new VectorReshaper()
reshaper.inVector = folder + "subbasins.shp"
reshaper.pCql = "the_geom=centroid(the_geom)"
reshaper.outVector = folder + "subbasins_centroids.shp"
reshaper.process()

var delaunay = new DelaunayTriangulation()
delaunay.inMap = folder + "subbasins_centroids.shp"
// the elevation of the vertices of the triangles
delaunay.fElev = "avgelev"
delaunay.outMap = folder + "triangles.shp"
delaunay.process()

The 99 centroids give 184 triangles, which cover their convex hull. The triangles colored by the highest elevation of their vertices: the long ones on the borders join the outer centroids of the convex hull:

The Delaunay triangles between the centroids of the sub-basins, colored by their highest elevation