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

Support subsetting to polygons... #73

Open
ChrisBarker-NOAA opened this issue Aug 5, 2022 · 1 comment
Open

Support subsetting to polygons... #73

ChrisBarker-NOAA opened this issue Aug 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@ChrisBarker-NOAA
Copy link
Contributor

I know this is going to stay on the back burner for a while, but I hope we can keep it in mind -- so I thought I'd put in this issue.

I think subsetting to a polygon is a really import use-case -- there are times, where a rectangular subset might be massively larger and more complex than what is needed -- it can also create disconnected domains -- which I'm not sure are a real problem, but still ugly.

It's possible that keeping polygons in mind might lead to different design decisions -- it's also possible that it wouldn't be a huge lift: you could subset to the bounding box of the polygon first, and then subset tot he polygon with a less efficient algorithm -- maybe that would be good enough for a first pass.

@lukecampbell lukecampbell added the enhancement New feature or request label Aug 9, 2022
@lukecampbell
Copy link
Contributor

Jotting down some ideas before they're lost to time:

Ideas for algorithmic approach for 2D polygon subsetting:

  1. Mask all triangles whose axis-aligned bounding box doesn't intersect the axis-aligned bounding box of the query polygon.
  2. Get convex hull for query polygon
  3. Mask triangles external to convex hull using separating axis theorem approach

At this point we have a polygon, and masked most of the triangles that definitely don't intersect. Approaches from this point forward that could be explored:

  • Create delaunay triangulation of polygon and test remaining sets of triangles.
  • Or compute convex hull decomposition of polygon and do SAT test for each convex hull in the decomposition.

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