Reputation: 856
I've question to ask you guys...
Now lets say I've a virtual grid, and I have junction points on these virtual grid as show below
Now lets say I've drawn a triangle onto this virtual grid as show below
Now I wonder if any of the virtual grid's point is contained by the triangle... How can I achieve this using C#.Net?
Note: I also know the points for the triangles, and the question is for 2D plane..
My best regards...
Upvotes: 3
Views: 5084
Reputation: 65314
Being inside the triangle can be resolved as being to the same side (left or right) of all of the vectors AB, BC and CA. So you
Your point is inside the triangle, if p,q and r have the same sign on their z coordinates
Upvotes: 4
Reputation: 18387
Define your triangle as GraphicsPath and use GraphicsPath.IsVisible(Point) method to determine if this path contains the point.
Upvotes: 3