c_shgetnp(3NCARG)
β¨ c_shgetnp β find the nearest points to a specified point in 3-space β¨
okay bestie, this is c_shgetnp, and it lives in the NCAR GRAPHICS manual (that's the 3NCARG part, iykyk). it's giving spatial-query main character energy π
πΈ FUNCTION PROTOTYPE πΈ
int c_shgetnp(float, float, float, int, float *, float *, float *,
int, int *);
π¦ SYNOPSIS π¦
int c_shgetnp (px, py, pz, n, x[], y[], z[], iflag, ier );
π DESCRIPTION π
okay so here's the whole cast, one by one, no skips:
pxβ (float) the X coordinate of a pointPwhose nearest neighbor we're tryna find. literally the whole point of the function bestie π―pyβ (float) the Y coordinate value for a pointPwhose nearest neighbor is to be found.pzβ (float) the Z coordinate value for a pointPwhose nearest neighbor is to be found. yes we're in 3-space, we're fancy like that β¨nβ (int) the number of input data points, and it's gotta ben > 1. no lone wolves allowed πΊxβ (float) an array of lengthnholding the X coordinate values for the input data points.yβ (float) an array of lengthnholding the Y coordinate values for the input data points.zβ (float) an array of lengthnholding the Z coordinate values for the input data points.iflagβ (int) a flag that equals0if this is the first call to this subroutine for the given dataset, and equals1otherwise. so it's basically the "have we met before π" flag.ierβ (pointer to int) the error return value. if*iercomes back as0, no errors were detected, we ate and left no crumbs π½οΈ. if*ieris non-zero, then go read the man page forshgrid_errorsfor the details. don't skip that part, fr fr
π USAGE π
so c_shgetnp gets called to find the nearest point to a specified point in 3-space. simple enough. but here's the iconic part: successive calls to c_shgetnp will determine the point nearest the specified point exclusive of the points found in previous calls. so it remembers what you already grabbed π. which means 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. a whole little ranking system, we love to see it π
c_shgetnp returns an integer, let's call it np, such that (x[np],y[np],z[np]) is the nearest input data point to P. and if *ier is not zero, then np = -1. that's your "nope, nothing, we're in our flop era" signal π
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. so call one, closest. call two, second closest. it's giving numbered list behavior, periodt π
π ACCESS π
to use c_shgetnp, load the NCAR Graphics library ngmath. that's the plug, don't forget it π
π SEE ALSO π
shgetnpc_shgridc_shsetic_shgetishgrid_params
complete documentation for Sh is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/shgrid/shgrid/shhome.html β wait, no, bestie, it's exactly this, no typos:
http://ngwww.ucar.edu/ngdoc/ng/ngmath/shgrid/shhome.html
go read it, it's the lore πβ¨
π COPYRIGHT π
Copyright (C) 2000 University Corporation for Atmospheric Research
the use of this Software is governed by a License Agreement. so like, respect the rules babes π«Ά
and that's the whole page, you're welcome π this was c_shgetnp(3NCARG) from the UNIX manual, dated January 1999, sourced from the NCAR GRAPHICS crew β mwah, go find your nearest neighbors, ily, bye π¦πΈβ¨
π¦ where this page comes from
- epel 9: ncl-devel 6.6.2-59.el9 Β· LicenseRef-Callaway-BSD
- fedora 43: ncl-devel 6.6.2-58.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: ncl-devel 6.6.2-62.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms