Getting edges from large number of triangles

Started by
1 comment, last by Mystery 19 years, 9 months ago
I am looking for a more efficient way to do this. Currently I have a thousand of different points which form triangles with one another. I need to extract out all the unique edges for these triangles(>10000 of them). My current solution is to check the 3 edges of each triangle against a vector which contains all the unique edges I have extracted so far. If it is not in there, I will add it to the vector else just abandon it. However program seems to run out of memory just doing that. :) Any bright ideas?
Advertisement
if you use indexes for the points, and you should if you dont want to waste memory. you can store each edge in a list, with the smaller index first, do a quicksort on it, and remove all entry's that are present more than once (because they are sorted you can check if your edge and the next edge in the list are identical...) this costs some memory but its the fastest way i know.


T2k
Is there a limit the number of elements a vector can hold? I think the number of edges from the triangles can come about to more than 20000.

This topic is closed to new replies.

Advertisement