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

Allow returning the source of edges from BoolOp. #1097

Open
andriyDev opened this issue Oct 22, 2023 · 0 comments
Open

Allow returning the source of edges from BoolOp. #1097

andriyDev opened this issue Oct 22, 2023 · 0 comments

Comments

@andriyDev
Copy link
Contributor

BoolOps take two (multi-)polygons, the subject and the clip and returns the union/intersection/XOR/difference of these as a new (multi-)polygon. It can be useful to know which edges in the result polygon come from which edges in the subject and the clip.

Example:
I have room A with wallpaper A, and a hallway C with wallpaper C. I want to attach these, so I take the union between room A's polygon and hallway C's polygon. Now what wallpaper do I assign to each wall in the union polygon?

Based on my understanding of the Martinez-Rueda-Feito algorithm:

  • When we create events initially, we can just attach some metadata saying which polygon (subject or clip) and which edge in that polygon the event polygons to.
  • Splitting an edge does not change this metadata. We can just copy it over from the existing edge.
  • Any overlapping edges that are detected need to store the metadata of both edges in them (so whichever edge is in the result will have the full information).
  • When linking up the result polygon, we just also store the metadata alongside it.

This does mean we require a little more memory per event, and returning this metadata will require an extra allocation. Perhaps we can avoid the extra memory allocation by adding a new trait: BoolOpsWithEdgeSource?

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

No branches or pull requests

1 participant