.TH TRIANGULATE l DATE
#ifdef SI
#define UNIT cm
#define LEN 15
#define SCALE \fB\-JM\fP1
#else
#define UNIT inch
#define LEN 6
#define SCALE \fB\-JM\fP6
#endif
.SH NAME
triangulate \- Perform optimal Delauney triangulation and gridding
.SH SYNOPSIS
\fBtriangulate\fP \fIinfiles\fP [ \fB\-G\fP\fIgrdfile\fP ] [ \fB\-H\fP ] [ \fB\-I\fP\fIx_inc\fP[m|c][/\fIy_inc\fP[m|c]] ] [ \fB\-J\fP\fIparameters\fP ] [ \fB\-M\fP[\fIflag\fP] ] 
[ \fB\-R\fP\fIwest/east/south/north\fP ] [ \fB\-V\fP ] [ \fB\-Z\fP ] [ \fB\-:\fP ] [ \fB\-b\fP[\fBi|o\fP][\fBd\fP] ]
.SH DESCRIPTION
\fBtriangulate\fP reads one or more ASCII [or binary] files (or standard input) containing x,y[,z] and
performs Delauney triangulation, i.e., it find how the points should be connected to give
the most equilateral triangulation possible.  If a map projection is chosen then it is applied before
the triangulation is calculated.  By default, the output is triplets of point id numbers
that make up each triangle.  The id numbers refer to the points position in the input file.
As an option, you may choose to create a multiple segment file that can be piped through
\fBpsxy\fP to draw the triangulation network.  If \fB\G \-I\fP are set a grid will be calculated based
on the surface defined by the planar triangles.
.TP
\fIinfiles\fP
Data files with the point coordinates in ascii (or binary; see \fB\-b\fP).  If no files are given the standard input is read.
.SH OPTIONS
#include "explain_-H.txt"
.B \-I
\fIx_inc\fP [and optionally \fIy_inc\fP] sets the grid  size for optional grid output (see \fB\-G\fP). Append m to indicate minutes or c to indicate seconds.
#include "explain_-j.txt"
.TP
.B \-M
Output triangulation network as multiple line segments separated by a record whose first
character is \fIflag\fP [>].  To plot, use \fBpsxy\fP with the \-M option (see Examples).
#include "explain_-R.txt"
#include "explain_-V.txt"
.TP
.B \-Z
Controls whether binary data file has two or three columns [2].  Ignored if \fB\-b\fP
is not set.
#include "explain_-t.txt"
.TP
.B \-b
Selects binary input and output mode.  Append \fBi\fP or \fBo\fP to select binary input or output only.  [Default
is ASCII].  Node ids are stored as binary 4-byte integer triplets.  Append \fBd\fP to indicate double precision for binary data
(if both binary input and output are selected they will have the same precision).  \fB\-bo\fP is ignored if \fB\-M\fP is selected.
.SH EXAMPLES
To triangulate the points in the file samples.xyz, store the triangle information in a binary file, and
make a grid for the given area and spacing, try
.br
.sp
triangulate samples.xyz \fB\-bo\fP \fB\-R\fP0/30/0/30 \fB\-I\fP2 \fB\-G\fPsurf.grd > samples.ijk
.br
.sp
To draw the optimal Delauney triangulation network based on the same file using a
LEN-UNIT-wide Mercator map, try
.br
.sp
triangulate samples.xyz \fB\-M \-R\fP-100/-90/30/34 SCALE | psxy \fB\-M \-R\fP-100/-90/30/34 SCALE
\fB\-W\fP2 \fB\-B\fP1 > network.ps
.SH SEE ALSO
gmt, pscontour
#include "refs.i"
Watson, D. F., 1982, Acord: Automatic contouring of raw data, \fIComp. & Geosci., 8\fP, 97\-101.
.br
