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

Better boolean operations for V3 #7

Open
HarryStevens opened this issue Oct 17, 2019 · 5 comments
Open

Better boolean operations for V3 #7

HarryStevens opened this issue Oct 17, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@HarryStevens
Copy link
Owner

The current relationship methods return only booleans, i.e. if the relationship exists. Better would be to return where the relationship exists, or false if it does not exist.

The polygon relationship methods will likely be somewhat time consuming to implement. The most modern algorithms for performing boolean operations on polygons can be found here: http://www.cs.ucr.edu/~vbz/cs230papers/martinez_boolean.pdf

These will likely not be compatible with current methods, so it may be necessary to bump major versions.

@HarryStevens HarryStevens self-assigned this Oct 17, 2019
@HarryStevens
Copy link
Owner Author

HarryStevens commented Oct 17, 2019

It will likely also be necessary to implement a utility method called, say, polygonWind, polygonSort, or polygonOrder because the Martinez et al clipping algorithms require a polygon's vertices to be in counter-clockwise order.

Here's an implementation: https://observablehq.com/d/eaf3a3c863d34aee

@HarryStevens
Copy link
Owner Author

See also: http://sean.cm/a/polygon-clipping-pt1

@HarryStevens
Copy link
Owner Author

On simple polygons, see: https://en.wikipedia.org/wiki/Simple_polygon

@HarryStevens
Copy link
Owner Author

Fil's done it: https://observablehq.com/@d3/polygonclip

@HarryStevens HarryStevens added the enhancement New feature or request label Aug 10, 2020
@ianstormtaylor
Copy link

Would love to see this added to the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants