Sign in to follow this  
aperry

binary space partitioning!

Recommended Posts

aperry    122
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
jyk    2094
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
aperry    122
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

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