Conversation
mlwilkerson
left a comment
There was a problem hiding this comment.
Mostly just a follow-up question, but I might also have spotted a little typo and suggested a correction.
| /// │xxx╰─<╯xxx│ | ||
| /// │xxxxxxxxxx│ | ||
| /// ╰──────>───╯ | ||
| /// ``` |
There was a problem hiding this comment.
Yes, I do notice how the curves are oriented so that the set is always on the left. This also looks like a familiar illustration of how the nonzero fill rule works (in SVG, for example).
Isn't it the case that nonzero means that inside vs. outside is determined by the relative winding direction of these two curves (clockwise vs. counter-clockwise)? So, in this case, the hole is formed in the center (under nonzero fill rule) because the inner curve moves in the opposite direction (clockwise) of the outer curve (counter-clockwise).
In my understanding, with the evenodd fill rule winding directions don't matter.
Does this mean that the nonzero fill rule is baked in to how these Contours are built?
If so, would it be accurate for me to think of it like this: "Contours returned from binary_op() are guaranteed to follow the nonzero fill rule, and that's why they can be directly translated into SVG paths, where the nonzero fill rule is the default?"
There was a problem hiding this comment.
Yes, that's basically it. But to be more precise, the contours returned from binary_op always produce winding numbers of either 0 or 1, so it doesn't actually matter which fill rule you use for them.
In the example with a hole, if both of the contours were counter-clockwise then the inner hole would have a winding number of 2 and so it would be unfilled with an evenodd fill rule but filled with a nonzero fill rule. But because our inner contour is clockwise, the inner hole has a winding number of 0.
Co-authored-by: Mike Wilkerson <11575183+mlwilkerson@users.noreply.github.com>
No description provided.