Hi!
Well, my problem is the following:
I have a point p(x|y) and three points a,b,c forming a triangle. How can I check, if the point p is in the triangle??
Maybe someone has a good, working function?
Please help!
TheBlob!

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Determine if a two dimensional point lies within the confines of a given
// two dimensional triangle.
//
// From Dr. Dobbs Journal, October, 2000

I have a simple method :
TEST the point P is in triangle ABC or not
add the area of PAB,PBC,PCA ,if the total is equal to the area of ABC ,then we know the point P is in the triangle ,otherwise is out.
right?

Iceman

12-07-2001, 08:06 AM

Sure, but benchmark it against the above algorithm and I am willing to bet that it looses in terms of raw performance. If you get a chance to do so please post the results here ... thx