tri.mesh: Create a delaunay triangulation

Description Usage Arguments Value References See Also Examples

View source: R/tri.mesh.R

Description

This subroutine creates a Delaunay triangulation of a set of N arbitrarily distributed points in the plane referred to as nodes. The Delaunay triangulation is defined as a set of triangles with the following five properties:

1) The triangle vertices are nodes.

2) No triangle contains a node other than its vertices.

3) The interiors of the triangles are pairwise disjoint.

4) The union of triangles is the convex hull of the set of nodes (the smallest convex set which contains the nodes).

5) The interior of the circumcircle of each triangle contains no node.

The first four properties define a triangulation, and the last property results in a triangulation which is as close as possible to equiangular in a certain sense and which is uniquely defined unless four or more nodes lie on a common circle. This property makes the triangulation well-suited for solving closest point problems and for triangle-based interpolation.

The triangulation can be generalized to a constrained Delaunay triangulation by a call to add.constraint. This allows for user-specified boundaries defining a nonconvex and/or multiply connected region.

The operation count for constructing the triangulation is close to O(N) if the nodes are presorted on X or Y components. Also, since the algorithm proceeds by adding nodes incrementally, the triangulation may be updated with the addition (or deletion) of a node very efficiently. The adjacency information representing the triangulation is stored as a linked list requiring approximately 13N storage locations.

Usage

1
2
tri.mesh(x, y = NULL, duplicate = "error",
         jitter = 10^-12, jitter.iter = 6, jitter.random = FALSE)

Arguments

x

vector containing x coordinates of the data. If y is missing x should contain two elements $x and $y.

y

vector containing y coordinates of the data.

duplicate

flag indicating how to handle duplicate elements. Possible values are: "error" – default, "strip" – remove all duplicate points, "remove" – leave one point of duplicate points.

jitter

Jitter of amount of diff(range(XX))*jitter (XX=x or y) will be added to coordinates if collinear points are detected. Afterwards interpolation will be tried once again.

Note that the jitter is not generated randomly unless jitter.random is set to TRUE. This ensures reproducable results. interp of package akima uses the same jitter mechanism. That means you can plot the triangulation on top of the interpolation and see the same triangulation as used for interpolation, see examples for interp.

jitter.iter

number of iterations to retry with jitter, amount will be increased in each iteration by iter^1.5

jitter.random

logical, see jitter, defaults to FALSE

Value

An object of class "tri"

References

R. J. Renka (1996). Algorithm 751: TRIPACK: a constrained two-dimensional Delaunay triangulation package. ACM Transactions on Mathematical Software. 22, 1-8.

See Also

tri, print.tri, plot.tri, summary.tri, triangles, convex.hull, neighbours, add.constraint.

Examples

1
2
3
data(tritest)
tritest.tr<-tri.mesh(tritest$x,tritest$y)
tritest.tr

Example output

triangulation nodes with neigbours:
node: (x,y): neighbours
1: (0,0) [5]: 2 3 4 7 9 
2: (1,0) [5]: 1 3 5 8 10 
3: (0.5,0.15) [4]: 1 2 9 10 
4: (0.15,0.5) [4]: 1 7 9 12 
5: (0.85,0.5) [4]: 2 8 10 11 
6: (0.5,0.85) [4]: 7 8 11 12 
7: (0,1) [5]: 1 4 6 8 12 
8: (1,1) [5]: 2 5 6 7 11 
9: (0.35,0.35) [6]: 1 3 4 10 11 12 
10: (0.65,0.35) [5]: 2 3 5 9 11 
11: (0.65,0.65) [6]: 5 6 8 9 10 12 
12: (0.35,0.65) [5]: 4 6 7 9 11 
number of nodes: 12 
number of arcs: 29 
number of boundary nodes: 4 
boundary nodes:  1 2 7 8 
number of triangles: 18 
number of constraints: 0 

tripack documentation built on July 8, 2020, 5:59 p.m.

Related to tri.mesh in tripack...