-
Notifications
You must be signed in to change notification settings - Fork 126
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 overlapping boundaries #42
Comments
It seems, I have the problem of "intersecting outer boundaries". In the first example, when I split the overlapping edge (0,1) into:
triangulation works fine. Question: would it make sense to write a function in the Should I try to come up with an algorithm myself, or does anyone have this ready-made? |
Thank you for a good detailed issue, @ghorwin Configurations with boundary edges shared by hole and non-hole polygons are not supported by the hole-detection algorithm. I will later take a closer look at the hole-detection algorithm implementation and maybe propose ways to fix this in a more detailed reply. |
Since I have the bounding polygon available, I just need to process each line of said polygon, check against intersections with all other constraint edges and insert vertexes as needed. That seems to be a workable problem (I hope). |
After thinking more about handling overlapping boundaries I think it would be nice to have it in CDT so that removing holes always 'just works'. I started to prototype this functionality and hope to have a branch with the change this week (or next). |
That would be awesome. I'm ready for testing :-) |
I've done some proof-of-concept in the branch I will add a detailed explanation of how overlapping boundaries are handled and what to expect from it when there is time. So maybe it worth to wait for it. |
Hole-removal algorithmEach triangle is assigned 'layer depth' using iterative depth-peeling algorithm. Basic idea is that every time a fixed edge is crossed depth is incremented by 1. This approach does not work when boundaries overlap. As sometimes a fixed edge can separate non-subsequent layers (e.g., 1 and 3). Wrong triangle depths will be calculated. Idea behind the fixRecord how many times each edge was constrained. Notes
|
@ghorwin |
Super, works fine for my test cases. I'll put it into my app and will check, how well this works with potential rounding errors (i.e. when example geometry above is rotated with floating-point accuracy). Thanks! |
@ghorwin |
Thought, so. I'm currently working on such a pre-processing, but it turns out that a fuzzy intersection routine isn't easy that easy to write (efficiently). Once I have it ready, I'll post it here for reference. |
Fix is merged to |
I don't know how to specify the correct input to CDT for below's examples:
The left problem is a box with a hole aligned to the left side of the box (no shared points).
The right problem is a box with a hole inside that occupies the left half of the box.
The expected result in the right case is just 2 triangles, but I get 4 (the hole is kept as well):
For the left part the hole is also not detected:
What am I doing wrong?
Below is my test code. Mind the rotated x,y coordinate system when looking at the test coordinates below!
Test code:
The text was updated successfully, but these errors were encountered: