SHGETNP(3NCARG) NCAR GRAPHICS SHGETNP(3NCARG)

# NAME¶

SHGETNP - find the nearest points to a specified point in 3-space.

# SYNOPSIS¶

CALL SHGETNP (PX, PY, PZ, N, X, Y, Z, IFLAG, IWK, RWK, NP, IER)

# DESCRIPTION¶

(real,input) The X coordinate value for a point P whose nearest neighbor is to be found.
(real,input) The Y coordinate value for a point P whose nearest neighbor is to be found.
(real,input) The Z coordinate value for a point P whose nearest neighbor is to be found.
(real, input) An array containing the X coordinates of the input data points.
(real, input) An array containing the Y coordinates of the input data points.
(real, input) An array containing the Z coordinates of the input data points.
(integer, input) A flag that equals 0 if this is the first call to this subroutine for the given dataset and equals 1 otherwise.
(integer, input) An integer workspace dimensioned for at least 2*N.
(real, input) A real workspace dimensioned for at least 11*N+6.
(integer, output) An index such that (X(NP),Y(NP),Z(NP)) is the nearest input data point to P. NP = 0 if IER .NE. 0. On successive calls to this subroutine after the first (that is when IFLAG=1) you can find the Mth closest point to (PX,PY,PZ) with the Mth call. IWK and RWK should not be modified between calls to SHGETNP if you are wanting to find successive nearest neighbors.
(integer, output) An error return value. If IER is returned as 0, then no errors were detected. If IER is non-zero, then refer to the man page for shgrid_errors for details.

# USAGE¶

SHGETNP is called to find the nearest point to a specified point in 3-space. Successive calls to SHGETNP will determine the point nearest the specified point exclusive of the points found in previous calls, i.e. successive calls can be used to find the N nearest points for any N between one and the maximum number of points in the input dataset.

# ACCESS¶

To use SHGETNP, load the NCAR Graphics library ngmath.