Take intersection point of triangle as a,b,c
And the testing point as p
boolean SameSide(p,s,t ,u)
if s && p lies on same side //to check same side form equation
using t and u and then evaluate the value of point
return true //p&s,if both gives same
sign(+ve or -ve) value then they are on same side
else
return false
void PointInTriangle(p, a,b,c)
if (SameSide(p,a, b,c) && SameSide(p,b, a,c) && SameSide(p,c, a,b))
Inside the triange
else
outside triangle
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.