pub enum FillRule {
EvenOdd,
NonZero,
Positive,
Negative,
}Expand description
The Clipper Library supports 4 filling rules: Even-Odd, Non-Zero, Positive and Negative. These rules are base on the winding numbers (see below) of each polygon sub-region, which in turn are based on the orientation of each path. Orientation is determined by the order in which vertices are declared during path construction, and whether these vertices progress roughly clockwise or counter-clockwise.
Winding numbers for polygon sub-regions can be derived using the following algorithm:
-
From a point that’s outside a given polygon, draw an imaginary line through the polygon.
-
Starting with a winding number of zero, and beginning at the start of this imaginary line, follow the line as it crosses the polygon.
-
For each polygon contour that you cross, increment the winding number if the line is heading right to left (relative to your imaginary line), otherwise decrement the winding number.
-
And as you enter each polygon sub-region, allocate to it the current winding number.
-
Even-Odd: Only odd numbered sub-regions are filled
-
Non-Zero: Only non-zero sub-regions are filled
-
Positive: Only sub-regions with winding counts > 0 are filled
-
Negative: Only sub-regions with winding counts < 0 are filled
For more details see FillRule.
Variants§
EvenOdd
Even-Odd filling rule
NonZero
Non-Zero filling rule
Positive
Positive filling rule
Negative
Negative filling rule