PPUNPO(3NCARG)

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

πŸ’– PPUNPO β€” bestie, let's union some polygons πŸ’–

okay so this is a page from the NCAR GRAPHICS manual (that's the manual name btw, hi), and PPUNPO is literally the moment you've been waiting for.


✨ NAME ✨

PPUNPO generates and returns the boundary of the "union" polygon β€” which is every single point that lives inside either or both of the clip polygon and the subject polygon. it's giving "the math is mathing" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

CALL PPUNPO (XCCP,YCCP,NCCP,XCSP,YCSP,NCSP,RWRK,IWRK,NWRK,URPP,IERR)

πŸ¦‹ C-BINDING SYNOPSIS πŸ¦‹

#include <ncarg/ncargC.h>

void c_ppunpo(
     float *xccp,
     float *yccp,
     int nccp,
     float *xcsp,
     float *ycsp,
     int ncsp,
     float *rwrk,
     int *iwrk,
     int nwrk,
     int (*urpp_)( float *xcra, float *ycra, int *ncra),
     int *ierr)

🌸 DESCRIPTION 🌸

okay bestie, here's the whole cast of characters. no skips, no skimming, we're doing all of them:

  • XCCP β€” (an input array of type REAL) this is the X coordinate array for the clip polygon. the clip one. X. yes.
  • YCCP β€” (an input array of type REAL) the Y coordinate array for the clip polygon. matching set, slay.
  • NCCP β€” (an input expression of type INTEGER) how many points are defining the clip polygon. count them, bestie.
  • XCSP β€” (an input array of type REAL) the X coordinate array for the subject polygon. different polygon, same energy.
  • YCSP β€” (an input array of type REAL) the Y coordinate array for the subject polygon. 🀝
  • NCSP β€” (an input expression of type INTEGER) the number of points defining the subject polygon.
  • RWRK β€” (a scratch array, dimensioned NWRK, of type REAL) it's a real workspace array. and listen β€” because of the way in which they are used, RWRK and IWRK may be EQUIVALENCEd (and, to save space, they should be). iconic space-saving behavior fr fr.
  • IWRK β€” (a scratch array, dimensioned NWRK, of type INTEGER) the integer workspace array. same deal as above: because of the way in which they are used, RWRK and IWRK may be EQUIVALENCEd (and, to save space, they should be). twins. πŸ’ž
  • NWRK β€” (an input expression of type INTEGER) the length of the workspace array(s). ngl it's a bit difficult to describe how much space might be required 😭. At the moment, I would recommend using NWRK equal to about ten times the total of the number of points in the input polygons and the number of intersection points. This situation will change with time; at the very least, I would like to put in an internal parameter that will tell one how much space was actually used on a given call, but I have not yet done so. (the author is being so real for admitting this, we love transparency ✨)
  • URPP β€” is the name of a user-provided routine to process the polygon-boundary pieces. This name must appear in an EXTERNAL statement in the routine that calls PPUNPO and the routine itself must have the following form:
     SUBROUTINE URPP (XCRA,YCRA,NCRA)
       DIMENSION XCRA(NCRA),YCRA(NCRA)
       ...(code to process a polygon boundary piece)...
       RETURN
     END

Each of the arguments XCRA and YCRA is a real array, dimensioned NCRA; the former holds the X coordinates, and the latter the Y coordinates, of a piece of the polygon boundary. It will be the case that XCRA(NCRA)=XCRA(1) and YCRA(NCRA)=YCRA(1). (closed loop, no gaps, we love a polygon that knows how to close a circle πŸ’…)

  • IERR β€” (an output variable of type INTEGER) comes back with the value zero if no errors occurred in the execution of PPUNPO, or with a small positive value if an error did occur. here's the decoder ring:
    • value 1 β†’ a degenerate clip polygon was detected 🚩
    • value 2 β†’ a degenerate subject polygon was detected 🚩
    • value 3 β†’ the workspace provided was too small 😭
    • values greater than 3 β†’ should be reported to the author, as they indicate some problem with the algorithm. not me catching strays in the algorithm...
Currently, if IERR is returned non-zero, one can be sure that no calls to URPP were executed; in the future, this could change, but, in that case, there will be an internal parameter allowing one to request the current behavior.

🌈 C-BINDING DESCRIPTION 🌈

The C-binding argument descriptions are the same as the FORTRAN argument descriptions. literally identical, no notes, we stan consistency 🫢


πŸ‘‘ USAGE πŸ‘‘

The FORTRAN statement

CALL PPUNPO (XCCP,YCCP,NCCP,XCSP,YCSP,NCSP,RWRK,IWRK,NWRK,URPP,IERR)

causes the formation of a union polygon (of the subject and clip polygons) and the delivery of that polygon's boundary, piece by piece, to the user-specified polygon-processing routine URPP. it's a little assembly line of polygon edges and honestly? obsessed. πŸ”₯


⭐ EXAMPLES ⭐

Use the ncargex command to see the following relevant examples: ppex01, tppack, c_ppex01. go look at them, they're right there, main character energy. πŸ“šβœ¨


🧚 ACCESS 🧚

To use PPUNPO or c_ppunpo, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. (that order. in that order. iykyk πŸ’…)


πŸ“ SEE ALSO πŸ“

Online: polypack, ppdipo, ppditr, ppinpo, ppintr, ppplcl, ppppap, ppuntr, ncarg_cbind.

Hardcopy: None. (the hardcopy said "no thoughts, head empty" πŸ™ˆ)


Copyright (C) 1987-2009
University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.

and that's the whole page bestie πŸŽ€ go union some polygons, you've got this. this was PPUNPO(3NCARG) from the NCAR Graphics manual, dated March 1995, and yes the UNIX manual footer is literally that β€” mwah, bye πŸ’–βœ¨πŸŒΈ
πŸ“¦ where this page comes from