E01EAF (PDF version)
E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

E01EAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

SUBROUTINE E01EAF ( N, X, Y, TRIANG, IFAIL)
INTEGER  N, TRIANG(7*N), IFAIL
REAL (KIND=nag_wp)  X(N), Y(N)

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 C1 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 C1 interpolation method Rocky Mountain J. Math. 14 223–237

5  Parameters

1:     N – INTEGERInput
On entry: n, the number of data points.
Constraint: N3.
2:     XN – REAL (KIND=nag_wp) arrayInput
On entry: the x coordinates of the n data points.
3:     YN – REAL (KIND=nag_wp) arrayInput
On entry: the y coordinates of the n data points.
4:     TRIANG7×N – INTEGER arrayOutput
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:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry, N=value.
Constraint: N3.
IFAIL=2
On entry, all the x,y pairs are collinear.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

Not applicable.

9  Further Comments

The time taken for a call of E01EAF is approximately proportional to the number of data points, n. The routine is more efficient if, before entry, the x,y pairs are arranged in X and Y such that the x values are in ascending order.
The triangulation is encoded in TRIANG as follows:

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.

10.1  Program Text

Program Text (e01eafe.f90)

10.2  Program Data

Program Data (e01eafe.d)

10.3  Program Results

Program Results (e01eafe.r)

GnuplotProduced by GNUPLOT 4.6 patchlevel 3 0 5 10 15 20 0 5 10 15 20 25 Example Program Thiessen Triangulation for given Data Points gnuplot_plot_1

E01EAF (PDF version)
E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015