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

infinite loop in decomp #9

Open
makc opened this issue Aug 23, 2018 · 2 comments
Open

infinite loop in decomp #9

makc opened this issue Aug 23, 2018 · 2 comments

Comments

@makc
Copy link

makc commented Aug 23, 2018

or something that makes it pathologically slow:

                        var concavePolygon =
                            [
                               [8.506701527949408, -5.644336556342278],
                               [8.381300121570893, -6.808676269682801],
                               [8.593308091786604, -7.307181903188466],
                               [10.420617533158147, -8.765859313039982],
                               [12.179298508455794, -9.54478382111818],
                               [12.392753632051935, -9.69259565842458],
                               [12.550103732288154, -9.971123388711604],

                                [13.116831259916689, -9.77308275919102],
                                [13.779683167845178, -10.32537253615963],
                                [13.994641104567053, -10.27158839269665],
                                [14.319193079974866, -9.927854007472051],
                                [14.409695825989765, -9.66248864141151],
                                [14.326094888404041, -9.149005145166157],
                                [14.397728980729553, -8.898239412983857],
                                [14.976701652345255, -8.01431857421041],
                                [15.161213708335236, -7.232141297967173],
                                [15.015774793613819, -6.81465228562316],
                                [13.805676268945536, -6.390203862315247],
                                [13.60647004017097, -6.202602349251247],
                                [13.349711634656268, -5.892076457665607],
                                [13.16458732146697, -5.348712881724059],
                                [12.895862070692056, -5.410061602323695],
                                [12.563573390674136, -5.7334472750466015],
                                [11.891760263736687, -5.843890101286925],
                                [11.274549347033426, -5.724899302880986],
                                [10.587819408329743, -5.372616945485351],
                                [9.387516998851206, -5.387519162447352],
                                [8.653030998597279, -5.029260789111358],
                                [8.52673903629231, -5.404993335640029]
                            ];
                        decomp.makeCCW(concavePolygon);
                        var convexPolygons = decomp.decomp(concavePolygon); <-- this hangs the page
//                        var convexPolygons = decomp.quickDecomp(concavePolygon); <-- this is OK
@schteppe
Copy link
Owner

Yea, the .decomp() algorithm is really really slow. If you increase the number of points, you will notice how badly it scales. I don't think it's an infinite loop, it's just very slow. Use .quickDecomp instead.

@kujukuju
Copy link

I left it running on a 32 vertex polygon for the entire day and it didn't finish. Even if this isn't technically stuck in an infinite loop it effectively is.

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

3 participants