You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably in the category of just handling invalid input. See my comments below that seek to clarify the contract of the API. I'm willing to add a quick PR fix for this, depending on what the solution should be.
The above code causes the inner loop inside of connectEdges() to loop forever and crash the JS execution environment. (My loop guard PR is coming for this.)The first polygon only contain 2 points (3 including closing), so it's really just a line. If I add one more unique point to the first polygon, the test passes.
The question I have is whether you want to interpret this as valid input or not. I know the TurfJS people have asked for clipping functions that work with points and line segments. (Although, I think if we did pass a set of LineString coordinates, it should probably be just 2 levels of array depth.)
If it is valid input, I think you'd want execution to branch to a more trivial evaluation of the intersection, or at least a change that prevents connectEdges() from freaking out. Especially, if that helps avoid adding special case logic inside of loop-iterated code of connectEdges() (performance and readability).
If it's not valid input, I think it would be good to throw an early exception instead of descending into connectEdges().
The text was updated successfully, but these errors were encountered:
This is probably in the category of just handling invalid input. See my comments below that seek to clarify the contract of the API. I'm willing to add a quick PR fix for this, depending on what the solution should be.
The above code causes the inner loop inside of
connectEdges()
to loop forever and crash the JS execution environment. (My loop guard PR is coming for this.)The first polygon only contain 2 points (3 including closing), so it's really just a line. If I add one more unique point to the first polygon, the test passes.The question I have is whether you want to interpret this as valid input or not. I know the TurfJS people have asked for clipping functions that work with points and line segments. (Although, I think if we did pass a set of
LineString
coordinates, it should probably be just 2 levels of array depth.)If it is valid input, I think you'd want execution to branch to a more trivial evaluation of the intersection, or at least a change that prevents
connectEdges()
from freaking out. Especially, if that helps avoid adding special case logic inside of loop-iterated code ofconnectEdges()
(performance and readability).If it's not valid input, I think it would be good to throw an early exception instead of descending into
connectEdges()
.The text was updated successfully, but these errors were encountered: