The QGRID3 function linearly interpolates the dependent variable values to points in a regularly sampled volume. Its inputs are a triangulation of scattered data points in three dimensions, and the value of a dependent variable for each point.
Note: QGRID3 accepts complex input but only utilizes the real part of any complex number.
Examples
For more information on using QGRID3, please see Additional Examples.
Example 1
This example interpolates a data set measured on an irregular grid.
n = 200
x = RANDOMU(seed, n)
y = RANDOMU(seed, n)
z = RANDOMU(seed, n)
f = x^2 - x*y + z^2 + 1
QHULL, x, y, z, tet, /DELAUNAY
volume = QGRID3(x, y, z, f, tet, START=0, DIMENSION=51, $
DELTA=0.02)
XVOLUME, BYTSCL(volume)
Syntax
Result = QGRID3( XYZ, F, Tetrahedra [, DELTA=vector ] [, DIMENSION=vector ] [, MISSING=value ] [, START=vector ] )
or
Result = QGRID3( X, Y, Z, F, Tetrahedra [, DELTA=array ] [, DIMENSION=array ] [, MISSING=value ] [, START=array ] )
Return Value
Result is a 3-dimensional array of either single or double precision floating type, of the specified dimensions.
Arguments
XYZ
This is a 3-by-n array containing the scattered points.
X, Y, Z
One-dimensional vectors containing the X, Y, and Z point coordinates.
F
The function value at each location in the form of an n-element vector.
Tetrahedra
A longword array containing the point indices of each tetrahedron, as created by QHULL.
Keywords
Note: Any of the keywords may be set to a scalar if all elements are the same.
DELTA
A scalar or three element array specifying the grid spacing in X, Y, and Z. If this keyword is not specified, it is set to create a grid of DIMENSION cells, enclosing the volume from START to [max(x), max(y), max(z)].
DIMENSION
A three-element array specifying the grid dimensions in X, Y, and Z. If only one or two elements are supplied, the first element is used for the missing elements. The dimensions must be greater than or equal to 2. If an element is less than 2, the default value of 25 is used for that dimension.
MISSING
The value to be used for grid points that lie outside the convex hull of the scattered points. The default is 0.
START
A three element array specifying the start of the grid in X, Y, and Z. Default value is [min(x), min(y), min(z)].
Additional Examples
Example 2
This example is similar to the previous one, however in this example we use a [3, n] array of points.
n = 200
p = RANDOMU(seed, 3, n)
f = p[0,*]^2 - p[0,*]*p[1,*] + p[2,*]^2 + 1
QHULL, p, tet, /DELAUNAY
volume = QGRID3(p, f, tet, START=0, DIMENSION=51, DELTA=0.02)
XVOLUME, BYTSCL(volume)
Example 3
The following example uses the data from the irreg_grid2.txt ASCII file. This file contains scattered three-dimensional data. This file contains bore hole data for a square mile of land; the bore hole samples were roughly taken diagonally from the upper left corner of the square to the lower right corner.
The QHULL procedure is used to triangulate the three-dimensional locations. The QGRID3 function uses the results from QHULL to grid the data into a volume, which we display in the IVOLUME tool.
file = FILEPATH('irreg_grid2.txt', $
SUBDIRECTORY = ['examples', 'data'])
dataStructure = READ_ASCII(file)
dataArray = TRANSPOSE(dataStructure.field1)
x = dataArray[*, 0]
y = dataArray[*, 1]
z = dataArray[*, 2]
data = dataArray[*, 3]
nPoints = N_ELEMENTS(data)
QHULL, x, y, z, tetrahedra, /DELAUNAY
cubeSize = [51, 51, 51]
volume = QGRID3(x, y, z, data, tetrahedra, START = 0, $
DIMENSION = cubeSize, DELTA = 0.02)
IVOLUME, volume
Click Render to display the volume data.
Derive the isosurface for mineral deposits with the data value of 2.5:
- Select Operations > Volume > Isosurface from the iVolume tool menu.
- Set the data value to 2.5
- Set the Mesh quality to 60%.
- Click OK.
Alternately, execute the following statements at the IDL command line to display the isosurface:
IVOLUME, volume
id = igetcurrent(TOOL=oTool)
idIso = oTool->FindIdentifiers('*Isosurface*', /OPERATIONS)
success=oTool->DoSetProperty(idIso, 'DECIMATE', 60)
success=oTool->DoSetProperty(idIso, '_ISOVALUE0', 2.5)
success=oTool->DoSetProperty(idIso, 'SHOW_EXECUTION_UI', 0)
success=oTool->DoAction(idIso)
Version History
See Also
QHULL