Skip to content
This repository was archived by the owner on Jan 25, 2026. It is now read-only.

Add better docs to Contours#32

Merged
jneem merged 3 commits intomainfrom
contour-docs
Nov 24, 2025
Merged

Add better docs to Contours#32
jneem merged 3 commits intomainfrom
contour-docs

Conversation

@jneem
Copy link
Owner

@jneem jneem commented Nov 20, 2025

No description provided.

Copy link
Contributor

@mlwilkerson mlwilkerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just a follow-up question, but I might also have spotted a little typo and suggested a correction.

/// │xxx╰─<╯xxx│
/// │xxxxxxxxxx│
/// ╰──────>───╯
/// ```
Copy link
Contributor

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?"

Copy link
Owner Author

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_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.

jneem and others added 2 commits November 21, 2025 12:29
Co-authored-by: Mike Wilkerson <11575183+mlwilkerson@users.noreply.github.com>
@jneem jneem merged commit 5b5592d into main Nov 24, 2025
9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants