In the current tesselator implementation, the Tesselate() method (see https://github.com/tpaviot/pythonocc-core/blob/master/src/Visualization/Tesselator.cpp#L139) generates a list of vertices as following (pseudo-code):
vertices = [
vertex1, # triangle 1
vertex2, # triangle 1
vertex3, # triangle 1
vertex4, # triangle 2
vertex5, # triangle 2
vertex6, # triangle 2
vertex7, # triangle 3
etc.
]
As a consequence, the vertex indices list is:
indices = [0, 1, 2,
3, 4, 5,
6, 7, 8, etc.]
With this representation, vertex4 and vertex1 maybe the same vertex (i.e. the thee coords X, Y and Z are equal).
I would like to get a shared vertices representation, where all vertices are different. This would become, for instance:
vertices = [
vertex1, # in this list, all vertices are different
vertex2,
vertex3,
vertex4,
vertex5,
etc.
]
With a slightly changed index list:
indices = [0, 1, 2,
2, 1, 3,,
4, 0, 2, etc.]
Generate the second representation (Shared vertices) from the first (triangle soup) is highly costly : traverse the vertices list, try to find identical vertices, replace the related index into thze indices list. It's an o(n!) algorithm.
So my question here : has anyone generated a "Shared Vertices Representation" directly from a BRepMesh_IncrementalMesh and BRep_Tool::Triangulation ?
@rainman110 @aothms @sfotis any advice ?
FYI it would allows much lighter meshes (I especially thinnk about x3d files for instance).
In the current tesselator implementation, the
Tesselate()method (see https://github.com/tpaviot/pythonocc-core/blob/master/src/Visualization/Tesselator.cpp#L139) generates a list of vertices as following (pseudo-code):As a consequence, the vertex indices list is:
With this representation, vertex4 and vertex1 maybe the same vertex (i.e. the thee coords X, Y and Z are equal).
I would like to get a shared vertices representation, where all vertices are different. This would become, for instance:
With a slightly changed index list:
Generate the second representation (Shared vertices) from the first (triangle soup) is highly costly : traverse the vertices list, try to find identical vertices, replace the related index into thze indices list. It's an o(n!) algorithm.
So my question here : has anyone generated a "Shared Vertices Representation" directly from a BRepMesh_IncrementalMesh and BRep_Tool::Triangulation ?
@rainman110 @aothms @sfotis any advice ?
FYI it would allows much lighter meshes (I especially thinnk about x3d files for instance).