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

Another union ring problem :) - Unable to complete output ring starting at .... #83

Open
Tracked by #1
pentacular opened this issue Aug 7, 2019 · 4 comments
Open
Tracked by #1
Labels
bug Something isn't working

Comments

@pentacular
Copy link

union(...[[[[-13.659807482533342,15.000000000000004],[-4.619397662556434,-1.9134171618254447],[-9.750026667063697,15.000000000000004],[-13.659807482533342,15.000000000000004]]],[[[-9.750026667063697,15.000000000000004],[-4.903926402016152,-0.9754516100806383],[-6.477371050357451,15.000000000000004],[-9.750026667063697,15.000000000000004]]]]);

Unable to complete output ring starting at [-13.659807482533342, 15.000000000000004]. Last matching segment found ends at [-9.750026667063697, 15.000000000000004].

@pentacular
Copy link
Author

Seems to also occur in current master.

@mfogel mfogel changed the title Another union ring problem :) Another union ring problem :) - Unable to complete output ring starting at .... Aug 7, 2019
@mfogel
Copy link
Owner

mfogel commented Aug 7, 2019

Thanks for the failing coordinates @pentacular, I've reproduced the failure on my side

@mfogel mfogel added the bug Something isn't working label Aug 7, 2019
@pentacular
Copy link
Author

Ok, I think that I understand the problem a little better now.

If we reduce the mantissa of the floats involved, by trimming the number of significant digits, the problem disappears.

e.g.

polygonClipping.union(...[[[[-13.65980,15.00000],[-4.61939,-1.91341],[-9.75002,15.00000],[-13.65980,15.00000]]],[[[-9.75002,15.00000],[-4.90392,-0.97545],[-6.47737,15.00000],[-9.75002,15.00000]]]]);

works fine.

Which leads me to think that this is due to numeric instability.

@mfogel
Copy link
Owner

mfogel commented Aug 15, 2019

Re: numeric instability - most of the bugs in this repo turn out to be related somehow to the joys of floating point math.

I've verified this bug is still happening with the latest on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants