c_shgetnp(3NCARG)

πŸ“¦ version 6.6.2, in epel 9, fedora 43, fedora 44

✨ 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 point P whose nearest neighbor we're tryna find. literally the whole point of the function bestie 🎯
  • py β€” (float) the Y coordinate value for a point P whose nearest neighbor is to be found.
  • pz β€” (float) the Z coordinate value for a point P whose 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 be n > 1. no lone wolves allowed 🐺
  • x β€” (float) an array of length n holding the X coordinate values for the input data points.
  • y β€” (float) an array of length n holding the Y coordinate values for the input data points.
  • z β€” (float) an array of length n holding the Z coordinate values for the input data points.
  • iflag β€” (int) a flag that equals 0 if this is the first call to this subroutine for the given dataset, and equals 1 otherwise. so it's basically the "have we met before πŸ‘€" flag.
  • ier β€” (pointer to int) the error return value. if *ier comes back as 0, no errors were detected, we ate and left no crumbs 🍽️. if *ier is non-zero, then go read the man page for shgrid_errors for 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 πŸŽ€

  • 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/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 (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