Triangulate MultiSurface #162
-
Hello, Should a multisurface be triangulated using earcut algorithm? So, an outerior ring and possible multiple interior rings? Or if not, how should it be triangulated? I am using C#. Kind regards, Bart |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
MultiSurfaces in CityJSON do no need to be triangulated (we use ISO 19107, which is summarised here), but they can. If you want to triangulate your surfaces, you can use cjio with the operator |
Beta Was this translation helpful? Give feedback.
-
You basically need to project each multisurface to 2D, triangulate, and then go back to 3D. The earcut algorithm should work as long as it supports holes, like in the Mapbox implementation. In C++, you could use the constrained triangulations in CGAL or Triangle. No idea about C#. |
Beta Was this translation helpful? Give feedback.
-
I am not entirely sure I understand the question, but if it's "how to triangulate a MultiSurface" then yes mapbox-earcut works for polygons with holes, but I found it to be producing collapsed triangles (area=0.0; or 3 points collinear). For Unity I assume this is not a problem though. As @kenohori pointed out, CGAL is perhaps a better option, but no C#... |
Beta Was this translation helpful? Give feedback.
-
Here unity implementation :-) |
Beta Was this translation helpful? Give feedback.
-
very nice! |
Beta Was this translation helpful? Give feedback.
I am not entirely sure I understand the question, but if it's "how to triangulate a MultiSurface" then yes mapbox-earcut works for polygons with holes, but I found it to be producing collapsed triangles (area=0.0; or 3 points collinear). For Unity I assume this is not a problem though.
As @kenohori pointed out, CGAL is perhaps a better option, but no C#...