Hi everyone, i'm having a number of vertices, normals and idencities just like in OBJ file. Now i've group the faces by the sides: 6 sides- positive X, positive Y, positiveZ, negative X, neg Y, neg Z. Now i'd like to do a faces neighbor list in every group. I have done something like this:
every triangle could have two neighbors, if it doesn't have the neighbor is null:
struct face
{
face neighbor1;
face neighbor2;
vec3 P1,P2,P3
}
Now i have neighbors, this could be done by iterating all triangles, but how i can go through all faces?
Creating a triangle neighbor list and moving through it
Recursion?
Assuming I understand correctly and you have something like a parent and 2 "children". I feel like I am missing something, but this could be a start.
EDIT: I am. Have to handle the end of the triangles where you have exhausted this part of the tree.
void lookAtFace(face node)
{
if(node.neighbor1 != NULL)
{
lookAtFace(neighbor1);
}
if(node.neighbor2 != NULL)
{
lookAtFace(neighbor2);
}
// Do something with this face
}
Assuming I understand correctly and you have something like a parent and 2 "children". I feel like I am missing something, but this could be a start.
EDIT: I am. Have to handle the end of the triangles where you have exhausted this part of the tree.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement