I have a triangle mesh which contains millions of triangles. Currently in my data structure only the triangles and the vertices are stored. I want to reconstruct all the edges and stored them in a data container. The idea may be like this: Traverse all the triangles, get each two of its vertices, and create an edge between them. The question is the shared edge maybe created twice. So to overcome this problem, I need a data container EdgeContainer
to store the edges and it should have a function to check whether this edge has been already created. So it is like a map with multiple keys, but according to my question, this map should also have the following functions:
EdgeContainer(v1, v2)
should return the same result asEdgeContainer(v2, v1)
, wherev1
andv2
are the pointers to two vertices.EdgeContainer
should have a function likeEdgeContainer::Remove(v1)
, which will remove all edges incident to vertexv1
.- The implementation should be as efficient as possible.
Is there any existing library which can handle this?
map<Vertex, vector<Vertex>>
not suffice? – Nico SchertlerEdge
must be explicitly stored for further use, i.e. stores its length or some other attributes. Your proposal cannot handle it, can it? – C. Wangmap<Vertex, vector<Edge*>>
. – Nico Schertler