binary space partitioning!

Started by
1 comment, last by aperry 18 years, 9 months ago
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
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.)
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

This topic is closed to new replies.

Advertisement