kowalsk1's blog

By kowalsk1, history, 3 years ago, In English

Does anyone know an algorithm to solve the following problem:

Given a sequence of points in the plane that represent a polygon (not necessarily convex), output the maximum possible radius of a circle that can fit inside this polygon.

It would be good if it was below O(n2), but any references are welcome. Thanks ahead.

 
 
 
 
  • Vote: I like it
  • -8
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by kowalsk1 (previous revision, new revision, compare).

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

If it was convex, you could make inequalities of form Ax+By+Cr>=0. For non-convex you need something different.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Binary search for R. if you choose R to be your radius check if size R circle fits inside.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it -8 Vote: I do not like it

    You probably will need veronoi diagrams.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How do you determine in which point should be center of the circle?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      All right, I already understand how. If somebody still curious — visit this article.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In each vertex with reflex angle generate two new polygons without that vertex. Black is non-convex. Red and green are new polygons. And after having only convex ones get maximum of circles in each polygon. Algorithm at emaxx for convex.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Where's O(2^n) subpolygons...

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 4   Vote: I like it 0 Vote: I do not like it

      You right my first solution is too slow. I think shrink sides algorithm can be modified for non-convex by adding some vertices and redefining next and prev calculation based on the picture above.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Btw, why did you not just google your question? I found answer for that in few minutes.

  1. Identical question on StackOverflow. There are few interesting answers, so I will not share single one.
  2. Research paper with different from suggested on StackOverflow approaches.