Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different fill rules (even/odd supported, add positive-only, etc) #10

Open
velipso opened this issue Oct 7, 2017 · 4 comments

Comments

@velipso
Copy link
Owner

velipso commented Oct 7, 2017

Currently, the library is specifically coded to work with even/odd fill rule. It would be nice if there was an option for other fill rules.

@teoxoy
Copy link

teoxoy commented Oct 1, 2019

@voidqk can you give some guidance on implementing non-zero?

@velipso
Copy link
Owner Author

velipso commented Oct 1, 2019

Hmm, I don't know.

Assuming you read my tutorial on the algorithm (here), I think changing the fill rules should only change the fill annotation logic. Then the rest of the algorithm should work fine -- all line intersection, segment selection, and segment chaining would probably work unmodified.

The non-zero fill rule is harder because it uses winding of the input... that would mean you'd have to add some extra data to the segments for which direction they were facing (?). The current algorithm throws away winding information almost immediately. That's why the GeoJSON code has to reconstruct the winding.

Writing the current fill annotation logic took me a while to get right -- it was hard for me to reason through how toggling segments worked, etc. I think introducing winding would make that even harder to reason about.

I do suspect it's possible though, and maybe there is a clever insight that I'm missing to make it easy..?

Sorry I can't be of more help.

@teoxoy
Copy link

teoxoy commented Oct 2, 2019

Thanks for the info! I will take a deeper look into it in the coming days.

@teoxoy
Copy link

teoxoy commented Oct 14, 2019

Some requirements changed and it looks like support for non-zero is not needed anymore.
I think your comment is valuable for future work on this nonetheless.
Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants