Fix tessellation issues causing extra or invalid geometry (#515, #556)#566
Fix tessellation issues causing extra or invalid geometry (#515, #556)#566r-silveira wants to merge 4 commits intoxBimTeam:feature/netcorefrom
Conversation
|
Hi @r-silveira thanks for the investigation. I'm going to ask @Ibrahim5aad to take a look at this. While your solution may fix this issue I'm not 100% it's addressing the root cause, given this callback mechanic was introduced a few months ago and #515 pre-dates that. It feels like this workaround may just be masking the underlying cause, and the callback is intended to be optional (as it's for optimising meshes). It's a useful start as it should help us track the lower level issue with Vertexes |
|
I agree. I believe there might be an issue with how the inner contours are created: either something is being propagated incorrectly, or a vertex is being generated wrong. If I comment out that part (highlighted in red), the invalid triangles are no longer generated. Maybe this can help with the investigation. |
|
I was reviewing the code to understand it better, and I think the best solution, without using the callback, would be to set Here’s my reasoning: when tessellating faces with holes, the So, if the code looks like this ( we’d solve the issue without needing the callback. That’s what it seems to be to me. I might be wrong, of course, since it’s a complex piece of code and I’m still investigating because I also need this fix. |
…nsuring they are properly added to the mesh later


This PR fixes the long-standing tessellation issue in Xbim.Geometry where
faces generated by the XbimTesselator produced
incorrect triangles: multiple triangles sharing the same vertex
or producing extra geometry not present in the IFC source.
Root cause
The problem was caused by the absence of a
CombineCallbackin the call totess.Tessellate(). When the Tesselator creates new vertices during polygon mergingor hole stitching, it reuses the
Datafield of existing vertices. As aresult, new points received duplicated indices, producing degenerate or
visually distorted faces.
Fix
CombineCallbackthat creates a newContourVertexwith
Data = -1, ensuring that these new vertices are later added to theXbimTriangulatedMeshviaAddVertex().and no longer generate stray triangles or spikes.
Related issues
Impact
This change improves the robustness and correctness of tessellation for
IFC models imported from Revit and other authoring tools, particularly for
faces containing holes or complex boundaries.
Issue:


Fixed mesh:

My test model:


My test model:
LX000-Isolated_Test.zip