IDL

QGRID3

QGRID3

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.

; Create a dataset of N points.
n = 200
x = RANDOMU(seed, n)
y = RANDOMU(seed, n)
z = RANDOMU(seed, n)
; Create dependent variable.
f = x^2 - x*y + z^2 + 1
; Obtain a tetrahedra using the QHULL procedure.
QHULL, x, y, z, tet, /DELAUNAY
; Create a volume with dimensions [51, 51, 51]
; over the unit cube.
volume = QGRID3(x, y, z, f, tet, START=0, DIMENSION=51, $
   DELTA=0.02)
; Display the volume.
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.

; Create a dataset of N points.
n = 200
p = RANDOMU(seed, 3, n)
; Create dependent variable.
f = p[0,*]^2 - p[0,*]*p[1,*] + p[2,*]^2 + 1
; Obtain a tetrahedra.
QHULL, p, tet, /DELAUNAY
; Create a volume with dimensions [51, 51, 51] over the unit cube.
volume = QGRID3(p, f, tet, START=0, DIMENSION=51, DELTA=0.02)
; Display the volume.
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.

; Determine the path to the file.
file = FILEPATH('irreg_grid2.txt', $
   SUBDIRECTORY = ['examples', 'data'])
; Import the data from the file into a structure.
dataStructure = READ_ASCII(file)
; Get the imported array from the first field of
; the structure.
dataArray = TRANSPOSE(dataStructure.field1)
; Initialize the variables of this example from
; the imported array.
x = dataArray[*, 0]
y = dataArray[*, 1]
z = dataArray[*, 2]
data = dataArray[*, 3]
; Determine number of data points.
nPoints = N_ELEMENTS(data)
; Triangulate the Data with QHULL:
; Construct the convex hulls of the volume.
QHULL, x, y, z, tetrahedra, /DELAUNAY
; Initialize volume parameters.
cubeSize = [51, 51, 51]
; Grid the data into a volume.
volume = QGRID3(x, y, z, data, tetrahedra, START = 0, $
   DIMENSION = cubeSize, DELTA = 0.02)
; Display the results in the IVOLUME utility.
IVOLUME, volume
 

Click Render to display the volume data.

Derive the isosurface for mineral deposits with the data value of 2.5:

  1. Select Operations  > Volume  > Isosurface from the iVolume tool menu.
  2. Set the data value to 2.5
  3. Set the Mesh quality to 60%.
  4. 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


5.5

Introduced

See Also


QHULL

Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions