Hi also consider that I have 4 points and I will have 4 triangles how can I check these four triangles for each point that is the point within the triangles or not. thanks
Asked
Active
Viewed 813 times
0
-
possible duplicate of [How to determine a point in a triangle?](http://stackoverflow.com/questions/2049582/how-to-determine-a-point-in-a-triangle) – Cascabel Nov 17 '10 at 17:34
2 Answers
0
You need to find the equation for the line created by each side of the triangle, and then for each side, check whether the point in question is on the same side of this line as the third point in the triangle. If all three are on the same side, it is within the triangle. Add bounds checking for cases of a point falling ON one of your sides.

Wade Tandy
- 4,026
- 3
- 23
- 31