Distance from a point to a polygon

后端 未结 5 1030
花落未央
花落未央 2020-12-02 13:42

I am trying to determine the distance from a point to a polygon in 2D space. The point can be inside or outside the polygon; The polygon can be convex or concave.

If

5条回答
  •  一向
    一向 (楼主)
    2020-12-02 14:18

    If you have a working point to line segment distance function, you can use it to calculate the distance from the point to each of the edges of the polygon. Of course, you have to check if the point is inside the polygon first.

提交回复
热议问题