I have an array of Vector3 objects (Vector3[ ]) that form a polygon. And I have a point in space (Vector3). Can someone point me to a solution for finding the closest point on the polygon to the point in space? I have several polygons and I want to find the closest one to the point in space.
It isn’t exactly a trivial problem. First you need to determine if the point is inside the polygon, which means you need to know what constitutes the inside of the polygon. Then, if the point isn’t inside the polygon, you can do a point-line distance to find the closest point on each edge of the polygon to find the closest line, and the point on that line.
It’s been awhile since I used it, but I recall the Triangle.Net library had methods to generate polygons from points. I assume it would also have some methods to get closest point on the polygon to that point.