1PPPPAP(3NCARG) NCAR GRAPHICS PPPPAP(3NCARG)
2
3
4
6 PPPPAP - can be called to preprocess a polygon in such a way as to
7 remove certain peculiarities that can cause minor cosmetic errors in
8 the output from the routines that return trapezoids.
9
11 CALL PPPPAP (XCIP,YCIP,NCIP,NBTS)
12
14 #include <ncarg/ncargC.h>
15
16 void c_ppppap(float *xcip, float *ycip, int ncip, int nbts)
17
19 XCIP (an input/output array of type REAL) is the X coordinate
20 array for a polygon to be used as input to one of the
21 routines PPDITR, PPINTR, or PPUNTR. PPPPAP will alter the
22 contents of this array.
23
24 YCIP (an input/output array of type REAL) is the Y coordinate
25 arrays for a polygon to be used as input to one of the
26 routines PPDITR, PPINTR, or PPUNTR. PPPPAP will alter the
27 contents of this array.
28
29 NCIP (an input/output variable of type INTEGER) is the number of
30 points defining the input polygon. PPPPAP may reduce the
31 value of NCIP.
32
33 NBTS (an input expression of type INTEGER) is the number of
34 significant bits to be left unzeroed in the fractional part
35 of each coordinate. Generally, one would probably not want
36 to use a value less than 10 or 12. On a 32-bit machine on
37 which reals have 24-bit fractions, 18 may be a good choice;
38 on a 64-bit machine with 48-bit fractions, larger values
39 may be desirable.
40
42 The C-binding argument descriptions are the same as the FORTRAN
43 argument descriptions.
44
46 The FORTRAN statement
47
48 CALL PPPPAP (XCIP,YCIP,NCIP,NBTS)
49
50 causes preprocessing of the X and Y coordinates of the points defining
51 a polygon which is to be used as input to one of the principal POLYPACK
52 routines that produce trapezoids. The object is to cure an annoying
53 (but basically cosmetic) problem that sometimes occurs.
54
55 The nature of the problem is as follows: Sometimes, when adjacent
56 points have Y coordinates that differ only very slightly, there will
57 be, among the output trapezoids, degenerates, of essentially zero
58 height, that stick out to the left or right from the body of the
59 polygon of which each trapezoid is a part. This happens because, in the
60 calls to the user-defined trapezoid-processing routine URPT, the values
61 of DXLE and DXRE become very large and the difference between the
62 values of YCOT and YCOB becomes very small; in URPT, then, to get the X
63 coordinates at the ends of the top of the trapezoid, the very large
64 values and the very small values are multiplied together and the result
65 is highly inaccurate.
66
67 What PPPPAP does is this: Each of the input coordinates is first
68 modified by zeroing out all but the first NBTS bits of its fractional
69 part; then, any point with the same coordinates as the preceding point
70 is culled. This ensures that there are no adjacent points with X or Y
71 coordinates that are so nearly identical as to cause the observed
72 problem, but has little real effect on the values of the coordinates.
73
74 There are several reasons why this was not done automatically: 1)
75 Because it's a little time-consuming (zeroing the low-order bits in a
76 way that doesn't violate the FORTRAN-77 standard is a bit difficult),
77 it shouldn't be done if it doesn't have to be done, and the user may
78 have reason to know that the problem doesn't arise. 2) The problem may
79 arise in one of the polygons, but not the other (most likely, in the
80 subject polygon, but not in the clip polygon). 3) The user knows best
81 what precision needs to be maintained in the data.
82
84 Use the ncargex command to see the following relevant examples: ppex01,
85 tppack, c_ppex01.
86
88 To use PPPPAP or c_ppppap, load the NCAR Graphics libraries ncarg,
89 ncarg_gks, and ncarg_c, preferably in that order.
90
92 Online: polypack, ppdipo, ppditr, ppinpo, ppintr, ppplcl, ppunpo,
93 ppuntr, ncarg_cbind.
94
95 Hardcopy: None.
96
98 Copyright (C) 1987-2009
99 University Corporation for Atmospheric Research
100 The use of this Software is governed by a License Agreement.
101
102
103
104UNIX March 1995 PPPPAP(3NCARG)