Jump to content
  • Advertisement
Sign in to follow this  
aperry

binary space partitioning!

This topic is 4890 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 all, I'm trying to implement binary space partitioning in my opengl program. The problem that I'm having is that I'm not able to get the program to tell whether or not a triangle is in front or behind another one. My strategy was to find the normal of triangle A and if it intersects the plane in which triangle B is on then triangle B would be in front of it. That seems to work pretty well but the only case that it doesn't work is when the normal is parallel to the plane that triangle B is on. Is there a way around that or a better way to determine whether one triangle is in front of another? Thank you, Adam Perry

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Is there a way around that or a better way to determine whether one triangle is in front of another?
A standard method for classifying a polygon with respect to a plane is by finding the distance from each polygon vertex to the plane. If all distances are > 0, the polygon is in front of the plane; if all distances are < 0, the polygon is behind the plane; if some are > 0 and some are < 0, the polygon straddles the plane. (You'll also need to decide how to handle distances = 0.)

Share this post


Link to post
Share on other sites
THANK YOU VERY MUCH! I was having a lot of trouble with that and just couldn't think of any way to handle it. thanks for all of your help.
Adam Perry

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!