In my XNA game, I needed to identify an irregular shape based on several Vector2 coordinates in a 2D space. The reason was to run a collision check (e.g. Rectangle.Intersects()).
For instance:
Vector2 point1 = new Vector(20,30);
Vector2 point2 = new Vector(60,30);
Vector2 point3 = new Vector(60,80);
Vector2 point4 = new Vector(40,90);
Vector2 point5 = new Vector(20,80);
will create a form that has paths from point1→ point2→ point3→ point4→ point5, then go back to point1.
However, I could not find the right solution for its implementation. Please help. Thank.
source
share