NAG CL Interfacee01eac (dim2_​triangulate)

Settings help

CL Name Style:

1Purpose

e01eac generates a triangulation for a given set of two-dimensional points using the method of Renka and Cline.

2Specification

 #include
 void e01eac (Integer n, const double x[], const double y[], Integer triang[], NagError *fail)
The function may be called by the names: e01eac, nag_interp_dim2_triangulate or nag_2d_triangulate.

3Description

e01eac creates a Thiessen triangulation with a given set of two-dimensional data points as nodes. This triangulation will be as equiangular as possible (Cline and Renka (1984)). See Renka and Cline (1984) for more detailed information on the algorithm, a development of that by Lawson (1977). The code is derived from Renka (1984).
The computed triangulation is returned in a form suitable for passing to e01ebc which, for a set of nodal function values, computes interpolated values at a set of points.

4References

Cline A K and Renka R L (1984) A storage-efficient method for construction of a Thiessen triangulation Rocky Mountain J. Math. 14 119–139
Lawson C L (1977) Software for ${C}^{1}$ surface interpolation Mathematical Software III (ed J R Rice) 161–194 Academic Press
Renka R L (1984) Algorithm 624: triangulation and interpolation of arbitrarily distributed points in the plane ACM Trans. Math. Software 10 440–442
Renka R L and Cline A K (1984) A triangle-based ${C}^{1}$ interpolation method Rocky Mountain J. Math. 14 223–237

5Arguments

1: $\mathbf{n}$Integer Input
On entry: $n$, the number of data points.
Constraint: ${\mathbf{n}}\ge 3$.
2: $\mathbf{x}\left[{\mathbf{n}}\right]$const double Input
On entry: the $x$ coordinates of the $n$ data points.
3: $\mathbf{y}\left[{\mathbf{n}}\right]$const double Input
On entry: the $y$ coordinates of the $n$ data points.
4: $\mathbf{triang}\left[7×{\mathbf{n}}\right]$Integer Output
On exit: a data structure defining the computed triangulation, in a form suitable for passing to e01ebc. Details of how the triangulation is encoded in triang are given in Section 9. These details are most likely to be of use when plotting the computed triangulation.
5: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6Error Indicators and Warnings

NE_ALL_DATA_COLLINEAR
On entry, all the $\left(x,y\right)$ pairs are collinear.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 3$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

Not applicable.

8Parallelism and Performance

e01eac is not threaded in any implementation.

The time taken for a call of e01eac is approximately proportional to the number of data points, $n$. The function is more efficient if, before entry, the $\left(x,y\right)$ pairs are arranged in x and y such that the $x$ values are in ascending order.
The triangulation is encoded in triang as follows:
• set ${j}_{0}=0$; for each node, $k=1,2,\dots ,n$, (using the ordering inferred from x and y)
• ${i}_{k}={j}_{k-1}+1$
• ${j}_{k}={\mathbf{triang}}\left[6×{\mathbf{n}}+k-1\right]$
• ${\mathbf{triang}}\left[\mathit{j}-1\right]$, for $\mathit{j}={i}_{k},\dots ,{\mathit{j}}_{k}$, contains the list of nodes to which node $k$ is connected. If ${\mathbf{triang}}\left[{j}_{k}-1\right]=0$ then node $k$ is on the boundary of the mesh.

10Example

In this example, e01eac creates a triangulation from a set of data points. e01ebc then evaluates the interpolant at a sample of points using this triangulation. Note that this example is not typical of a realistic problem: the number of data points would normally be larger, so that interpolants can be more accurately evaluated at the fine triangulated grid.
This example also demonstrates how to extract useful information from the data structure returned from e01eac. The provided function convex_hull returns, for the nodes on the boundary of the triangulation, the number of such nodes and the list of indices (ordered in anti-clockwise direction) for these nodes. The provided function triang2list returns: the number of triangles, the index of the vertices for each triangle, and whether the triangle has one or more edges on the boundary.

10.1Program Text

Program Text (e01eace.c)

10.2Program Data

Program Data (e01eace.d)

10.3Program Results

Program Results (e01eace.r)