Reference Guide > G Routines > GRID_3D Function
  

GRID_3D Function
Returns a gridded, 2D array containing z values, given random x-, y-, z-coordinates (this function works best with sparse data points).
Usage
result = GRID_3D(points, grid_x, grid_y)
Input Parameters
pointsA (3, n) array containing the random x, y, z points to be gridded.
grid_x—The x dimension of the grid. The x values are scaled to fit this dimension.
grid_y—The y dimension of the grid. The y values are scaled to fit this dimension.
Returned Value
resultA gridded, 2D array containing z values.
Keywords
OrderThe order of the weighting function to use for neighborhood averaging. Points are weighted by the function:
w = 1.0 / (dist ^ Order)
where dist is the distance to the point. (Default: 2)
XMaxThe x-coordinate of the right edge of the grid. If omitted, maps the maximum x value found in the points(0, *) array to the right edge of the grid.
XMinThe x-coordinate of the left edge of the grid. If omitted, maps the minimum x value found in the points(0, *) array to the left edge of the grid.
YMaxThe y-coordinate of the top edge of the grid. If omitted, maps the maximum y value found in the points(1, *) array to the top edge of the grid.
YMinThe y-coordinate of the bottom edge of the grid. If omitted, maps the minimum y value found in the points(1, *) array to the bottom edge of the grid.
Discussion
GRID_3D uses an inverse distance averaging technique to interpolate missing data values for 3D gridding. The gridded array returned is suitable for use with the SURFACE, TV, and CONTOUR procedures.
GRID_3D is similar to FAST_GRID3. GRID_3D, however, works best with sparse data points (less than 1000 points) and is stable when extrapolating into large void areas. (FAST_GRID3 works best with dense data points; it is considerably faster, but slightly less accurate, than GRID_3D.)
Examples
These commands show 3D gridding with sparse data points.
; Generate and grid the data points.
points = INTARR(3, 10)
points(*, 0) = [1,1,2]
points(*, 1) = [1,1,3]
points(*, 2) = [9,9,5]
points(*, 3) = [9,8,0]
points(*, 4) = [4,9,6]
points(*, 5) = [0,9,9]
points(*, 6) = [3,7,15]
points(*, 7) = [5,6,-5]
points(*, 8) = [0,0,3]
points(*, 9) = [9,0,-1]
; Display the gridded data as a surface.
zval = GRID_3D(points, 48, 32, Order=2.0)
WINDOW, 0, Colors=128
TEK_COLOR
SURFR
SURFACE, zval, Bottom=WoColorConvert(6), Ax=30.0, Az=30.0, /T3d
See Also
FAST_GRID2, FAST_GRID3, FAST_GRID4, GRID_2D, GRID_4D, GRID_SPHERE
 
note
For information on the optional software package for advanced gridding, PV‑WAVE:GTGRID, contact your Rogue Wave account representative.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.