Hello,
I’ve stumbled across an issue (I guess?) with polygons in Cesium.
When rendering polygons from PolygonHierarchy Cesium is triangulating the polygon with some kind of algorithm. With 3 point polygon it’s quite simple - points of hierarchy are the triangle - but when polygon has 3+ vertices the triangulation begins - I’ve been trying to get into that and try to extract rendered triangles for that polygon.
eg. for 4-vertex polygon there are 2 ways of triangulation - and Cesium choses one over another.
I want to get trios of vertices which represent rendered triangles for such a polygon.
Does anyone have an idea how can I achieve that?
Here’s an sandcastle example with b3dm and dummy polygon made on top of a building:
How can I get each of the rendered tiangles’?
You can set show to false for the tileset to fully see the polygon.
Thank you very much for sharing this with the community. I looked over your example, and I think a great next step would be to write this up as an issue on the CesiumJS GitHub page.
I have altered and expanded your code a little bit: Sandcastle
You have to dig a little deeper into Cesium to get to Cesium.PolygonPipeline.
That is not an issue in my opinion…you MUST triangulate a polygon, if its points are not on the same plane, otherwise you would create a non-planar surface
Hello Lennart,
Thanks a lot! I’ve found that pipeline when I tried to debug that triangulation - however my debugger wouldn’t stop on breakpoints inside (well, I guess it was webpack issue) so I decided to ask here.
I was aware of the triangulation process since it is impossible to show polygon of four 3D points that are non-coplanar. I’ve tried triangulation by myself, with trios of the first and following coordinates, however Cesium triangulation seemed to be a lot more accurate.
Thanks for the sandcastle example, I greatly appreciate your explanation!