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

Return more information #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Return more information #13

wants to merge 1 commit into from

Conversation

rowanwins
Copy link
Owner

This branch explores returning some extra information for intersection points.

  • distance of intersection along segments (using a planar distance calc)
  • segment index of the segments

As it currently stands this would be a breaking change, although I could possibly expose the info via an option.

@hanneshdc
Copy link

Hey @rowanwins - I'd be really interested in this change. Returning the vertex ID would allow me to fix a common bug in the turf geospatial library's line split function: Turfjs/turf#1232

Currently that function relies on a buggy point-to-line search to find the vertex IDs, when it could be returned from this package instead.

I'm not a big fan of options changing the return type of a function, so instead consider a seperate function. I'd suggest the following API:

const sweepLine = require('sweepline-intersections');
// normal way:
const results1 = sweepLine(fc); // returns [number, number][]

// detailed results:
const results2 = sweepLine.detailed(fc);

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

Successfully merging this pull request may close these issues.

2 participants