Atlast I got it working :).
I found a very nice tutorial, I don't remember where because I was also playing around with memory and my windows failed to respond.
Anyway the important part of what was stated in the tutorial is to choose a random direction (left or right since that way slope is 0 for fastest perfermance) then count how many interesctions with the triangle/polygon there is. If there is an odd number than the point lies within the triangle if theres an even number then the point goes through the triangle.
if ( intersections & 1){
// odd, point inside
}
else
{
// even point outside
}
the only problem if there is an intersection at a vertex, I forgot how that was resolved.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement