Linear Sweep of a 2D Polygon

algorithmsareageometryplane-geometrypolygons

Suppose we have a 2D simple polygon (no self-intersection) on the $XY$ plane defined by $n$ vertices and a 2D vector $V=(A,B)$.
Is there an algorithm to detect if a generic point $P=(x,y)$ on the plane belongs to the area that is covered by the polygon when it "slides" along the line segment from $A$ to $B$?

Best Answer

The generated region is the so-called "Minkovski sum" $P'= P \oplus V$ of the polygon and the vector (that can be considered as a degenerated polygon). $P'$ is known to be still a (convex) polygon.

Therefore, the algorithm you are looking for amounts to combine 2 classical algorithms :

  • The algorithm giving the vertices of this Minkowski sum $P'$.

  • The algorithm testing whether a point is inside or outside a convex polygon .