NAME:definetri
PURPOSE: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
*---* *---*
| /| |\ |
| / | | \ |
|/ | | \|
*---* *---*
CATEGORY: to understand how TRIANGULATE and TRIANGULATION work!
CALLING SEQUENCE:triangles=definetri(nx, ny [,downward])
INPUTS: nx and ny are the array dimensions
OPTIONAL INPUTS:
downward: 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.
KEYWORD PARAMETERS:
OUTPUTS:
triangles is a 2d array and is dimensions are 3 and
2*(nx-1)*(ny-1)
triangles is define like in the TRIANGULATE procedure.
OPTIONAL OUTPUTS:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
EXAMPLE:
triangles=definetri(3,3,[1,3])
triangles will be a this kind of triangulation:
*---*---*
|\ | /|
| \ | / |
| \|/ |
*---*---*
| /|\ |
| / | \ |
|/ | \|
*---*---*