NAG FL Interface
e01eaf (dim2_triangulate)
1
Purpose
e01eaf generates a triangulation for a given set of two-dimensional points using the method of Renka and Cline.
2
Specification
Fortran Interface
Integer, Intent (In) |
:: |
n |
Integer, Intent (Inout) |
:: |
ifail |
Integer, Intent (Out) |
:: |
triang(7*n) |
Real (Kind=nag_wp), Intent (In) |
:: |
x(n), y(n) |
|
C Header Interface
#include <nag.h>
void |
e01eaf_ (const Integer *n, const double x[], const double y[], Integer triang[], Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
e01eaf_ (const Integer &n, const double x[], const double y[], Integer triang[], Integer &ifail) |
}
|
The routine may be called by the names e01eaf or nagf_interp_dim2_triangulate.
3
Description
e01eaf 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
e01ebf which, for a set of nodal function values, computes interpolated values at a set of points.
4
References
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 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 interpolation method Rocky Mountain J. Math. 14 223–237
5
Arguments
-
1:
– Integer
Input
-
On entry: , the number of data points.
Constraint:
.
-
2:
– Real (Kind=nag_wp) array
Input
-
On entry: the coordinates of the data points.
-
3:
– Real (Kind=nag_wp) array
Input
-
On entry: the coordinates of the data points.
-
4:
– Integer array
Output
-
On exit: a data structure defining the computed triangulation, in a form suitable for passing to
e01ebf. 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 which is demonstrated in
Section 10.
-
5:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
-
On entry, all the pairs are collinear.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
Not applicable.
8
Parallelism and Performance
e01eaf is not threaded in any implementation.
The time taken for a call of
e01eaf is approximately proportional to the number of data points,
. The routine is more efficient if, before entry, the
pairs are arranged in
x and
y such that the
values are in ascending order.
The triangulation is encoded in
triang as follows:
- set ; for each node, , (using the ordering inferred from x and y)
- , for , contains the list of nodes to which node is connected. If then node is on the boundary of the mesh.
10
Example
In this example,
e01eaf creates a triangulation from a set of data points.
e01ebf 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 e01eaf. The provided routine 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 routine 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.1
Program Text
10.2
Program Data
10.3
Program Results