Remove duplicate vertices in Prism object#1905
Remove duplicate vertices in Prism object#1905oskooi wants to merge 1 commit intoNanoComp:masterfrom
Prism object#1905Conversation
|
Wouldn't one want to only consider consecutive vertices? |
|
Also, shouldn't this happen in libctl in the low-level constructor? |
This is true in the case of a GDS file for which the shapes must be weakly simple polygons. This means that the polygon has segments which can intersect but not cross. This also means that representing holes requires connecting their boundary to the boundary of the enclosing shape which can give rise to duplicate vertices that are not consecutive. In the general definition of a prism which involves convexity, any duplicate vertex would need to be removed whether it is consecutive or not.
Sure, we can move this feature to libctl and then add a test in Meep. |
Does the issue described in #1520 actually extend to the case of having any duplicated vertices? I only showed the segfault with the duplicated first / last vertex while having subpixel smoothing enabled. Though, I could also see how there would be issues with having consecutive vertices. Support for GDS-style polygons in the prism strikes me as being particularly useful given #1501, but if you do want to move forward with this approach, I would suggest raising an error instead of silently removing vertices. This would be quite confusing for users. |
|
To me, a polygon with duplicate consecutive vertices seems like a well-defined limiting case, that seems like a polygon with one fewer vertex. (e.g. the limit of a quadrilateral as a side length goes to zero should be a triangle, not an error) |
|
e.g. matlab |
Closes #1520.