nag_2d_triangulate (e01eac) (PDF version)
e01 Chapter Contents
e01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_2d_triangulate (e01eac)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nage01.h>
void  nag_2d_triangulate (Integer n, const double x[], const double y[], Integer triang[], NagError *fail)

3  Description

nag_2d_triangulate (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 nag_2d_triang_bary_eval (e01ebc) 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  Arguments

1:     n IntegerInput
On entry: n, the number of data points.
Constraint: n3.
2:     x[n] const doubleInput
On entry: the x coordinates of the n data points.
3:     y[n] const doubleInput
On entry: the y coordinates of the n data points.
4:     triang[7×n] IntegerOutput
On exit: a data structure defining the computed triangulation, in a form suitable for passing to nag_2d_triang_bary_eval (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 which is demonstrated in Section 10.
5:     fail NagError *Input/Output
The NAG error argument (see Section 2.7 in How to Use the NAG Library and its Documentation).

6  Error Indicators and Warnings

NE_ALL_DATA_COLLINEAR
On entry, all the x,y pairs are collinear.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n3.
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.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

nag_2d_triangulate (e01eac) is not threaded in any implementation.

9  Further Comments

The time taken for a call of nag_2d_triangulate (e01eac) is approximately proportional to the number of data points, n. The function 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, nag_2d_triangulate (e01eac) creates a triangulation from a set of data points. nag_2d_triang_bary_eval (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.

10.1  Program Text

Program Text (e01eace.c)

10.2  Program Data

Program Data (e01eace.d)

10.3  Program Results

Program Results (e01eace.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

nag_2d_triangulate (e01eac) (PDF version)
e01 Chapter Contents
e01 Chapter Introduction
NAG Library Manual

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