Distance from a point to a polygon
Posted
by
clwen
on Stack Overflow
See other posts from Stack Overflow
or by clwen
Published on 2012-06-11T16:15:48Z
Indexed on
2012/06/11
16:40 UTC
Read the original article
Hit count: 284
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 the point is within the polygon or outside the polygon with a distance smaller than a user-defined constant d
, the procedure should return True
; False
otherwise.
I have found a similar question: Distance from a point to a polyhedron or to a polygon. However, the space is 2D in my case and the polygon can be concave, so it's somehow different from that one.
I suppose there should be a method simpler than offsetting the polygon by d
and determining it's inside or outside the polygon.
Any algorithm, code, or hints for me to google around would be appreciated.
© Stack Overflow or respective owner