Original Post
Let's say I have the triangle ABC and the point P (all in 2D). I want to check if the point P is inside the triangle ABC. So I need to calculate:
cosangle1 = Dot(P - A, P - B) / Magnitude(P - A) * Magnitude(P - B);
cosangle2 = Dot(P - B, P - C) / Magnitude(P - B) * Magnitude(P - C);
cosangle3 = Dot(P - C, P - A) / Magnitude(P - C) * Magnitude(P - A);
sum = cosangle1 + cosangle2 + cosangle3;
And now I have a question: what will be the sign of 'sum' if the point is inside the triangle and what if it is outside?
[edited by - TheVoid on April 28, 2003 6:04:11 AM]
