<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

ToBeReviewed/TRIANGULATION/

definetri.pro

Define a triangulation array like TRIANGULATE. But in a VERY SIMPLE CASE: the points are regularly-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
          *---*                        *---*
          |  +|                        |+  |
          | + |                        | + |
          |+  |                        |  +|
          *---*                        *---*

topdefinetri Utilities

result = definetri(nx, ny[, downward])

Return value

triangles is a 2d array and its dimensions are 3 and 2*(nx-1)*(ny-1). triangles is defined 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 undefined 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 defined by the index (in a nx*ny vector) of the lower-left corner of the rectangle.

Examples

IDL> triangles=definetri(3,3,[1,3]) triangles will be this kind of triangulation:
          *---*---*
          |+  |  +|
          | + | + |
          |  +|+  |
          *---*---*
          |  +|+  |
          | + | + |
          |+  |  +|
          *---*---*

Version history

Version

$Id: definetri.pro 371 2008-08-07 09:32:02Z pinsard $

History

sebastien Masson (smlod@ipsl.jussieu.fr) 4/3/1999

Statistics

McCabe cyclic 6
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.