![]() |
| [[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]] |
|
|
#1 |
|
Member
Join Date: Oct 2004
Location: Roseville, CA
Posts: 41
|
The following code builds a list of edges for an arbitrary triangle mesh and has O(n) running time in the number of triangles n in the mesh. This is a high-powered version of the simpler snippet that was previously posted. This code came from http://www.terathon.com/code/edges.html.
The edgeArray parameter must point to a previously allocated array of Edge structures large enough to hold all of the mesh's edges. Code:
|
|
|
|
|
|
#2 |
|
Valued Member
Join Date: Aug 2004
Location: Norway
Posts: 200
|
Nice. I must say I'm very sceptical about the assumption:
..For each of these edges, the same edge should have already been found in the first pass for a different triangle .. but it is easily fixed (even though the models have no border you sometimes get meshes with border since the model might use several materials/shaders). I will not comment on the theoretical O(n^2) worst case, since most meshes probably have low valency at each vertex anyway. I might put up my O(NlogN) edge finder (which is somewhat nicer since it also checks that we have a 2-manifold for free, and fast since it's linear except for a sort), but I'm lazy and hate computers so I probably won't. Edit: Urgh, any edge finder can assure we have a 2-manifold for free... Time to go to bed.. -Si |
|
|
|
|
|
#3 | |
|
Member
Join Date: Oct 2004
Location: Roseville, CA
Posts: 41
|
Quote:
Ah, yes. I should probably have said that in a closed 2-manifold mesh, this is true. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|