PPDITR(3NCARG)
π PPDITR π β the NCAR Graphics girlie's guide
ok so bestie, welcome to PPDITR(3NCARG), one of the NCAR Graphics pack π this one's from the polypack friend group and it is genuinely so useful, no cap.
β¨ NAME β¨
PPDITR β generates and returns a set of trapezoids representing the interior of the "difference" polygon, which consists of all points that are inside the subject polygon but not inside the clip polygon. it's giving βοΈ subject minus clip βοΈ and honestly? iconic.
πΈ SYNOPSIS πΈ
CALL PPDITR (XCCP,YCCP,NCCP,XCSP,YCSP,NCSP,RWRK,IWRK,NWRK,URPT,IERR)
π¦ C-BINDING SYNOPSIS π¦
for the C girlies π
#include <ncarg/ncargC.h>
void c_ppditr(
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 π
ok so here's everybody in the cast, one by one, no skips π
XCCPβ (an input array of typeREAL) is the X coordinate array for the clip polygon. the clip poly's x's, periodt.YCCPβ (an input array of typeREAL) is the Y coordinate array for the clip polygon. and its y's, matching energy β¨NCCPβ (an input expression of typeINTEGER) is the number of points defining the clip polygon. how many points, bestie? that many.XCSPβ (an input array of typeREAL) is the X coordinate array for the subject polygon. the main character polygon's x's πYCSPβ (an input array of typeREAL) is the Y coordinate array for the subject polygon. its y's, slaying alongside.NCSPβ (an input expression of typeINTEGER) is the number of points defining the subject polygon. count 'em.RWRKβ (a scratch array, dimensionedNWRK, of typeREAL) is a real workspace array. and listen: because of the way in which they are used,RWRKandIWRKmay beEQUIVALENCEd β and, to save space, they should be. be efficient babe, it's free real estate π«ΆIWRKβ (a scratch array, dimensionedNWRK, of typeINTEGER) is an integer workspace array. same deal: because of the way in which they are used,RWRKandIWRKmay beEQUIVALENCEd, and to save space they should be. twin behavior fr fr π―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 here's the honest part, bestie, the author says: "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 love a transparent king πURPTβ is the name of a user-provided routine to process the trapezoids. this name must appear in anEXTERNALstatement in the routine that callsPPDITR, and 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). math? ate. π
IERRβ (an output variable of typeINTEGER) is returned with the value zero if no errors occurred in the execution ofPPDITR, or with a small positive value if an error did occur. the value1indicates that a degenerate clip polygon was detected, the value2that a degenerate subject polygon was detected, and the value3that the workspace provided was too small; values greater than3should be reported to the author, as they probably indicate some problem with the algorithm. and hmm, important: 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. watch out bestie π«£
π C-BINDING DESCRIPTION π
the C-binding argument descriptions are the same as the FORTRAN argument descriptions. copy-paste energy but make it official β¨
π USAGE π
the FORTRAN statement
CALL PPDITR (XCCP,YCCP,NCCP,XCSP,YCSP,NCSP,RWRK,IWRK,NWRK,URPT,IERR)
causes the formation of a difference polygon (the subject polygon minus the clip polygon) and the delivery of trapezoids representing the interior of that polygon, one at a time, to the user-specified trapezoid-processing routine URPT. drip-feed those trapezoids, babe π§
π EXAMPLES π
use the ncargex command to see the following relevant examples: ppex01, tppack, c_ppex01. go look, they're cute, i promise π
π§ ACCESS π§
to use PPDITR or c_ppditr, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. order matters bestie, don't be chaotic π€
π₯ SEE ALSO π₯
- Online:
polypack,ppdipo,ppinpo,ppintr,ppplcl,ppppap,ppunpo,ppuntr,ncarg_cbind. - Hardcopy: None.
π COPYRIGHT π
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!! this one's from the UNIX manual, dated March 1995 π ty for reading, mwah, go clip some polygons πβ¨π¦
π¦ 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