bezierjs icon indicating copy to clipboard operation
bezierjs copied to clipboard

Hang in intersect()

Open lgpmichael2 opened this issue 3 years ago • 1 comments

This causes intersect() to hang. In case it matters, running under Chrome or Firefox on Linux (If you can't reproduce I'll get version numbers)

var b1=new Bezier(-990182691,1254998779, -990147546.9832671,1254989458.4011576, -990112402.9665343,1254980137.8023152, -990077042.3730693,1254970329.841004);

var b2=new Bezier(-990119445.9004624,1254809042.4337204, -990123318.3336779,1254900644.1566606, -990153004.6668389,1254949711.5783303, -990182691,1254998779);

var intersects=b1.intersects(b2);

HANG

If all the values are changed to ints, this then returns ["0/0.99999"] - which is itself incorrect, but something I can work around and is close enough.

A hang though, I can't work around.

Any thoughts about how to sort this?

lgpmichael2 avatar Jul 20 '21 19:07 lgpmichael2

Hrm, I've been looking into the code and see you're doing a binary chop to detect joins. I'd think that'd be fast enough in a worst case scenario, but seemingly not. I'm going to investigate further and see what I come up with. It DOES un-hang after a while, but the worst-case scenario that I've found is that it took over 4 hours to process one intersect call, which had one intersect at its extremity.

lgpmichael2 avatar Jul 22 '21 16:07 lgpmichael2