-
Notifications
You must be signed in to change notification settings - Fork 90
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
Improve epsilon logic #8
base: master
Are you sure you want to change the base?
Conversation
This is really interesting. Did you pull these from a math reference, or did you derive them yourself? I really want to understand the ideas behind this, do you know how I could go about doing that? |
Sorry for the delay. I am using standard math results in plane geometry but i can not give you good reference written in english. Note that a possible solution to get rid of epsilon logic could be to use a arbitrary-length rational number library such as BigRational for example. |
Thanks for your help. I don't want to merge until my understanding is better. I will recommend people try these changes if they have epsilon issues in the meantime. Generally, I don't understand the impact of multiplying the epsilon value by something: return Math.abs(dx1 * dy2 - dx2 * dy1) <= eps * (n1 + n2); If I need more eyeballs looking at this problem. |
I add some details for the formula in |
This branch is more robust than the current master. Specifically, current master often generates polygons that violate epsilon, with generated sides less than fall below the epsilon length. This branch doesn't cure that completely, but reduces it greatly. |
I added these changes to a (near 1:1) C# port of PolyBoolJS. It immediately solved all "PolyBool: Zero-length segment detected; your epsilon is probably too small or too large" errors that I encountered with very small intersect operations. It did not break any of my tests and just simply appears to be more robust. |
This is an attempt to improve epsilon.js. Failing example of #3 should be correctly handled with an epsilon value less than 1e-14 and it seems that this does not break demo examples.