PPUNTR(3NCARG)
π PPUNTR β the union-polygon trapezoid machine β¨
okay bestie, so this is a page from the NCAR Graphics manual, and it's literally called PPUNTR π
it lives over in the 3NCARG section and it's giving very specific old-school FORTRAN energy. let's get into it π«Ά
β¨ NAME β¨
PPUNTR β generates and returns a set of trapezoids representing the interior of the "union" polygon, which consists of all points that are inside either or both of the clip polygon and the subject polygon. π¦
like⦠it's the math-girl version of "put the two shapes together and hand me the pieces". iconic.
β¨ SYNOPSIS β¨
CALL PPUNTR (XCCP,YCCP,NCCP,XCSP,YCSP,NCSP,RWRK,IWRK,NWRK,URPT,IERR)
π C-BINDING SYNOPSIS π
#include <ncarg/ncargC.h>
void c_ppuntr(
float *xccp,
float *yccp,
int nccp,
float *xcsp,
float *ycsp,
int ncsp,
float *rwrk,
int *iwrk,
int nwrk,
int (*urpt_)(float *xcbl,
float *xcbr,
float *ycob,
float *dxle,
float *dxre,
float *ycot),
int *ierr)
β¨ DESCRIPTION β¨
okay so here's every single argument, and no, we're not skipping any of them, that's not the vibe π
XCCPβ (an input array of typeREAL) is the X coordinate array for the clip polygon. πYCCPβ (an input array of typeREAL) is the Y coordinate array for the clip polygon. πNCCPβ (an input expression of typeINTEGER) is the number of points defining the clip polygon. π’XCSPβ (an input array of typeREAL) is the X coordinate array for the subject polygon. πΈYCSPβ (an input array of typeREAL) is the Y coordinate array for the subject polygon. πΈNCSPβ (an input expression of typeINTEGER) is the number of points defining the subject polygon. π’RWRKβ (a scratch array, dimensionedNWRK, of typeREAL) is a real workspace array. Because of the way in which they are used,RWRKandIWRKmay beEQUIVALENCEd (and, to save space, they should be). fr fr, do the equivalence, your memory will thank you πIWRKβ (a scratch array, dimensionedNWRK, of typeINTEGER) is an integer workspace array. Because of the way in which they are used,RWRKandIWRKmay beEQUIVALENCEd (and, to save space, they should be). πNWRKβ (an input expression of typeINTEGER) is the length of the workspace array(s). okay so here's the tea β: the routines that produce trapezoids use a lot less workspace than the ones that produce polygons. The amount of space used at a particular time during the execution of one of these routines is roughly ten or eleven times the number of intersections of a horizontal "scan line" with the edge segments making up the input polygons, plus about three times the number of points above the current scan line that are "local minima". (A "local minimum" is a point on one of the polygons that is connected to two other points on the polygon having larger Y coordinates than its own). and nglβ¦ I have not yet developed a rule of thumb for setting the value ofNWRK. π Ultimately, I would like to at least 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. (we're all waiting on that one, author bestie)URPTβ is the name of a user-provided routine to process the trapezoids. This name must appear in anEXTERNALstatement in the routine that callsPPUNTRand the routine itself must have the following form:
SUBROUTINE URPP (XCBL,XCBR,YCOB,DXLE,DXRE,YCOT)
...(code to process a trapezoid)...
RETURN
END
The bottom and top of the trapezoid are horizontal (parallel to the X axis); the arguments XCBL and XCBR define the X coordinates of its bottom left and bottom right corners, YCOB is the Y coordinate of its bottom edge, DXLE and DXRE are the inverses (dx/dy) of the slopes of its left and right edges, and YCOT is the Y coordinate of its top edge. The corners of the trapezoid are therefore as follows: (XCBL,YCOB), (XCBR,YCOB), (XCBL+DXLE*(YCOT-YCOB),YCOT), and (XCBR+DXRE*(YCOT-YCOB),YCOT). πΊβ¨
IERRβ (an output variable of typeINTEGER) is returned with the value zero if no errors occurred in the execution ofPPUNTR, or with a small positive value if an error did occur. The value 1 indicates that a degenerate clip polygon was detected, the value 2 that a degenerate subject polygon was detected, and the value 3 that the workspace provided was too small; values greater than 3 should be reported to the author, as they probably indicate some problem with the algorithm. π
IfIERRis returned non-zero, one can be sure that there have been no calls toURPTonly ifIERR = 1or2; otherwise, some trapezoids probably have been generated and delivered toURPT. π so like, check your error code before you assume nothing happened, okay?
π C-BINDING DESCRIPTION π
The C-binding argument descriptions are the same as the FORTRAN argument descriptions. π short and sweet, we love a consistent queen.
β¨ USAGE β¨
The FORTRAN statement
CALL PPUNTR (XCCP,YCCP,NCCP,XCSP,YCSP,NCSP,RWRK,IWRK,NWRK,URPT,IERR)
causes the formation of a union polygon (of the subject and clip polygons) and the delivery of trapezoids representing the interior of that polygon, one at a time, to the user-specified trapezoid-processing routine URPT. π
like, one trapezoid at a time. she's feeding them to you slowly. main character delivery service. π
β¨ EXAMPLES β¨
Use the ncargex command to see the following relevant examples: ppex01, tppack, c_ppex01. π go look, they're cute.
β¨ ACCESS β¨
To use PPUNTR or c_ppuntr, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. π
order matters, don't be chaotic.
β¨ SEE ALSO β¨
Online: polypack, ppdipo, ppditr, ppinpo, ppintr, ppplcl, ppppap, ppunpo, ncarg_cbind. π
Hardcopy: None. π (nothing on paper, it's a digital girlie era)
β¨ COPYRIGHT β¨
Copyright (C) 1987-2009 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.
okay that's the whole page bestie, no cap π«Ά this was the PPUNTR(3NCARG) manual page, straight from the NCAR GRAPHICS collection, last touched way back in March 1995 and stamped for UNIX. vintage but still slaying πβ¨π
π¦ where this page comes from
- debian bookworm: libncarg-dev 6.6.2.dfsg.1-1
- debian trixie: libncarg-dev 6.6.2.dfsg.1-10+b2
- ubuntu jammy: libncarg-dev 6.6.2-10build2
- ubuntu questing: libncarg-dev 6.6.2.dfsg.1-10build2
- ubuntu resolute: libncarg-dev 6.6.2.dfsg.1-12
- ubuntu stonking: libncarg-dev 6.6.2.dfsg.1-12build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms