ToBeReviewed/TRIANGULATION/
definetri.pro
Define a triangulation array like TRIANGULATE.
But in a VERY SIMPLE CASE:
the points are regulary-gridded on nx*ny array.
Find a Delaunay triangulation for this set of points is easy:
Points define (nx-1)*(ny-1) rectangles which we can cut in 2
triangles. cf. figure above
ny-1*---*---*. . . . . .*---*---*
| +| +| | +| +|
| + | + | | + | + |
|+ |+ | |+ |+ |
ny-2*---*---*. . . . . .*---*---*
. . . .
. . . .
. . . .
1*---*---*. . . . . .*---*---*
| +| +| | +| +|
| + | + | | + | + |
|+ |+ | |+ |+ |
0*---*---*. . . . . .*---*---*
0 1 2 nx-3 nx-2 nx-1
You have 2 ways to cut a rectangle:
1) the upward diagonal 2) the downward diagonal
*---* *---*
| +| |+ |
| + | | + |
|+ | | +|
*---* *---*
definetri
Utilities
result = definetri(nx, ny[, downward])
Return value
triangles is a 2d array and is dimensions are 3 and
2*(nx-1)*(ny-1)
triangles is define like in the TRIANGULATE procedure.
Parameters
nx
in
required
The x dimension array
ny
in
required
The y dimension array
downward
in
optional
When downward is undefine all rectangles are cut
in using the upward diagonal. Downward is a vector which
contains the rectangles numbers which are cut in using the
downward diagonal.
The rectangle number is define by the index (in a nx*ny
vector) of the lower-left corner of the rectangle.
Examples
triangles=definetri(3,3,[1,3])
triangles will be a this kind of triangulation:
*---*---*
|+ | +|
| + | + |
| +|+ |
*---*---*
| +|+ |
| + | + |
|+ | +|
*---*---*
Version history
Version
$Id: definetri.pro 157 2006-08-21 09:01:50Z navarro $
History
sebastien Masson (smlod@ipsl.jussieu.fr)
4/3/1999
Produced by IDLdoc 2.0 on Tue Aug 29 14:50:35 2006.