Skip to content

Return more information#13

Open
rowanwins wants to merge 1 commit into
masterfrom
breaking-changes
Open

Return more information#13
rowanwins wants to merge 1 commit into
masterfrom
breaking-changes

Conversation

@rowanwins

Copy link
Copy Markdown
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
Copy Markdown

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