Sign in to follow this  

Creating a triangle neighbor list and moving through it

This topic is 2050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Recursion?

[code]void lookAtFace(face node)
{
if(node.neighbor1 != NULL)
{
lookAtFace(neighbor1);
}
if(node.neighbor2 != NULL)
{
lookAtFace(neighbor2);
}

// Do something with this face
}[/code]

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. Edited by Dragonsoulj

Share this post


Link to post
Share on other sites

This topic is 2050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this