Jump to content
  • Advertisement
Sign in to follow this  
SmajlerKamil

Creating a triangle neighbor list and moving through it

This topic is 2354 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
Advertisement
Recursion?

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!