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

Fix bbox-clip point intersection handling #886

Merged
merged 1 commit into from
Aug 3, 2017
Merged

Fix bbox-clip point intersection handling #886

merged 1 commit into from
Aug 3, 2017

Conversation

tjdett
Copy link
Contributor

@tjdett tjdett commented Aug 2, 2017

In cases where only a single point touches the bounding box, it's possible for lineclip to return a line with multiple identical coordinates. For some cases it emits 4 coordinates, which is a zero-area polygon, and everything works fine. For the provided test case, it emits 3 coordinates.

This patch just sanity-checks the lineclip output so it only attempts to output polygons with at least 4 coordinates.

Ensure a polygon that has a single point touching the bounding box will
be handled without an error.
Copy link
Member

@DenisCarriere DenisCarriere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Makes sense to me!

@DenisCarriere
Copy link
Member

Thanks Tim for sending over a "bug" & a solution (PR) at the same time 👍

@DenisCarriere DenisCarriere added this to the 4.7.0 milestone Aug 3, 2017
@DenisCarriere DenisCarriere merged commit 5db975c into Turfjs:master Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants