File indexing completed on 2024-04-14 14:11:10

0001 /*
0002 ** Author: Eric Veach, July 1994.
0003 **
0004 */
0005 
0006 #ifndef __sweep_h_
0007 #define __sweep_h_
0008 
0009 #include "mesh.h"
0010 
0011 /* __gl_computeInterior( tess ) computes the planar arrangement specified
0012  * by the given contours, and further subdivides this arrangement
0013  * into regions.  Each region is marked "inside" if it belongs
0014  * to the polygon, according to the rule given by tess->windingRule.
0015  * Each interior region is guaranteed be monotone.
0016  */
0017 int __gl_computeInterior(GLUtesselator *tess);
0018 
0019 /* The following is here *only* for access by debugging routines */
0020 
0021 #include "dict.h"
0022 
0023 /* For each pair of adjacent edges crossing the sweep line, there is
0024  * an ActiveRegion to represent the region between them.  The active
0025  * regions are kept in sorted order in a dynamic dictionary.  As the
0026  * sweep line crosses each vertex, we update the affected regions.
0027  */
0028 
0029 struct ActiveRegion
0030 {
0031     GLUhalfEdge *eUp;       /* upper edge, directed right to left */
0032     DictNode *nodeUp;       /* dictionary node corresponding to eUp */
0033     int windingNumber;      /* used to determine which regions are
0034                                  * inside the polygon */
0035     GLboolean inside;       /* is this region inside the polygon? */
0036     GLboolean sentinel;     /* marks fake edges at t = +/-infinity */
0037     GLboolean dirty;        /* marks regions where the upper or lower
0038                                  * edge has changed, but we haven't checked
0039                                  * whether they intersect yet */
0040     GLboolean fixUpperEdge; /* marks temporary edges introduced when
0041                                  * we process a "right vertex" (one without
0042                                  * any edges leaving to the right) */
0043 };
0044 
0045 #define RegionBelow(r) ((ActiveRegion *)dictKey(dictPred((r)->nodeUp)))
0046 #define RegionAbove(r) ((ActiveRegion *)dictKey(dictSucc((r)->nodeUp)))
0047 
0048 #endif