DOKK / manpages / debian 12 / libncarg-dev / c_shgetnp.3ncarg.en
c_shgetnp(3NCARG) NCAR GRAPHICS c_shgetnp(3NCARG)

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

int c_shgetnp(float, float, float, int, float *, float *, float *,

int, int *);

int c_shgetnp (px, py, pz, n, x[], y[], z[], iflag, ier );

(float) The X coordinate value for a point P whose nearest neighbor is to be found.
(float) The Y coordinate value for a point P whose nearest neighbor is to be found.
(float) The Z coordinate value for a point P whose nearest neighbor is to be found.
(int) The number of input data points, n > 1.
(float) An array of length n containing the X coordinate values for the input data points.
(float) An array of length n containing the Y coordinate values for the input data points.
(float) An array of length n containing the Z coordinate values for the input data points.
(int) A flag that equals 0 if this is the first call to this subroutine for the given dataset and equals 1 otherwise.
(pointer to int) An error return value. If *ier is returned as 0, then no errors were detected. If *ier is non-zero, then look at the man page for shgrid_errors for details.

c_shgetnp is called to find the nearest point to a specified point in 3-space. Successive calls to c_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.

c_shgetnp returns an integer, say np, such that (x[np],y[np],z[np]) is the nearest input data point to P. np = -1 if *ier is not zero. On successive calls to this function after the first (that is when iflag=1) you can find the Mth closest point to (px,py,pz) with the Mth call.

To use c_shgetnp, load the NCAR Graphics library ngmath.

shgetnp, c_shgrid, c_shseti, c_shgeti, shgrid_params.

Complete documentation for Sh is available at URL
http://ngwww.ucar.edu/ngdoc/ng/ngmath/shgrid/shhome.html

Copyright (C) 2000
University Corporation for Atmospheric Research

The use of this Software is governed by a License Agreement.

January 1999 UNIX