algorithm - Can an ant walk towards or away from a point with a polygon obstacle? -
given polygon s , point p lies outside s, imagine ant can follow straight line towards or away p.
for shapes (fig. 1), there choice of p such ant can move unobstructed in @ least 1 of 2 possibilities: towards (t) p, or away (a) it. condition corresponds ray cast p intersecting perimeter of s 0 or 2 times.
however, same shape (fig. 2) there may points lead blocked (b) regions, ant bump polygon whichever direction tries move in. yet other shapes (fig. 3) there may no choice of p leads no blocked regions. having blocked regions corresponds rays cast p intersect perimeter of s more 2 times.
is there algorithm determines whether p exists satisfies condition given polygon s? if such points exist, can determine region contains them?
find concave corners of polygon obstacle. each corner, extend 2 edges infinitely. sector between these 2 rays, , (as nico schertler pointed out) point-reflected region of sector, define point must obstacle not hide corner form point's rays.
in example l-shaped obstacle, there 1 concave corner. sector between neighbouring edges (top right) , point-reflection (bottom left), form region (indicated in red), point must be.
in example u-shaped obstacle, there 2 concave corners, , 2 corresponding regions (red , blue) have overlap (purple). point must in purple region.
in example s-shaped obstacle, there 2 overlapping regions (purple). point must in 1 of these 2 regions.
in example h-shaped obstacle, red , blue region have overlap (purple) above horizontal beam of h, blue , green region have overlap (teal) right of horizontal beam, green , yellow region have overlap (lime) below horizontal beam, , yellow , red regions have overlap (orange) left of beam; however, there no overall overlap between 4 regions, , no place point can satisfy constraints.
Comments
Post a Comment