Previous Getting Started with IDL: Plotting Irregularly Gridded Data Next

The TRIANGULATE Procedure

The TRIANGULATE procedure constructs a Delaunay triangulation of a planar set of points. After a triangulation has been found for a set of irregularly-gridded data points, the TRIGRID function can be used to interpolate surface values to a regular grid.

  1. Open a window for viewing:
  2. WINDOW  
    

     

  3. To return a triangulation in the variable TR, enter the command:
  4. TRIANGULATE,X,Y,TR  
    

     

    The variable TR now contains a three-element by 54-element longword array (you may see this by typing "Help, TR" at the IDL Command Line).

     


    Note
    This is not always a 54-element array, it may vary based on the number of points.

     

  5. To produce a plot of the triangulation, shown below, enter the following commands:
  6. PLOT,X,Y,PSYM=1,TITLE='Triangulation'  
      
    FOR i=0,N_ELEMENTS(TR)/3 - 1 DO BEGIN & T= $
       [TR[*, i],TR[0, i]] & PLOTS,X[T],Y[T] & ENDFOR  
    

     

    Figure 10-2: The triangulation of the random values

    Figure 10-2: The triangulation of the random values

     

  7. Dismiss the graphics window
  8. WDELETE  
    

  IDL Online Help (March 06, 2007)