|
![](/i/fill.gif) |
Warp wrote:
> Jim Kress <kre### [at] kressworks com> wrote:
>> What I want to do is make sure all triangle normals are pointing out of
>> the surface and all triangles are wound counter-clockwise.
[...]
> The latter method works like this: Since you know the right ordering of
> this triangle, you can know the right order for the three triangles
> adjacent to it (the two shared vertices in the adjacent triangle should be
> listed in reverse order than in this triangle; if they aren't, just swap
> them and there you are: it's fixed). Now you can do this process
> recursively to each of the two other triangles adjacent to the three
> triangles you just fixed (you have to ne able to mark triangles as "fixed"
> so that you know where to continue and where to stop).
> Which one of these two methods is better depends. It's quite clear that
> the raytracing method is much slower than the adjacent-triangle-checking
> method. On the other hand, the latter needs more memory (in pathological
> cases *huge* amounts of memory) because you need to do it recursively.
Sorry, but I can't completely agree with you. This approach isn't that bad.
What you want to do is to visit all triangles. What you describe is more or
less a depth-first search in the dual graph of the mesh. Since the mesh is
a simple closed surface, the graph (and its dual) has only a linear number
of edges. Space and time consumption of the graph traversal is linear in
the number of vertices, i.e. the best we can get.
Best regards
Thomas
Post a reply to this message
|
![](/i/fill.gif) |