-
Notifications
You must be signed in to change notification settings - Fork 28
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
Refactor connect edges #10
Refactor connect edges #10
Conversation
I admit that I do not entirely get the changes to the algorithm, but that's what test-cases are for ;) I did a minor code-cleanup in master, mostly involving formatting and clippy. |
Thanks a lot for working on this @bluenote10! These bugs were the roadblock for me to consider replacing my usage of gpc with a Rust solution. |
This PR follows the ideas of w8r/martinez#113, combined with a few more fixes, and translated into a more Rust friendly structure. Basically the JS implementation was missing a key step of the Martinez algorithm in the second stage -- the implementation of the 4 possible cases for determining parent contours (Fig. 4 in the paper):
The idea is that for each start point of a contour we look at the lower ("previous in result") contour and check:
I also tried to document the ideas with code comments as best I could.
This PR fixes / affects:
Here is a visualization of all new / modified test cases:
test_cases.pdf
A few minor changes:
Float
trait. Omitting theDebug
/Display
traits fromFloat
doesn't do anyone a favor who gets to debugFloat
based code. Hope it is fine to extend the trait, becauseFloat
will be almost exclusively instantiated byf32
orf64
anyhow.scripts
subfolder. It is ~200 LOC and I thought it might be useful for anyone testing the algrithm. I have also documented how the test scheme works in a short readme.