This repository was archived by the owner on Jan 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Add better docs to Contours #32
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's basically it. But to be more precise, the contours returned from
binary_opalways 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.