### kowalsk1's blog

By kowalsk1, history, 3 years ago,

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.

• -8

 » 3 years ago, # |   0 Auto comment: topic has been updated by kowalsk1 (previous revision, new revision, compare).
 » 3 years ago, # |   +3 If it was convex, you could make inequalities of form Ax+By+Cr>=0. For non-convex you need something different.
 » 3 years ago, # |   0 Binary search for R. if you choose R to be your radius check if size R circle fits inside.
•  » » 3 years ago, # ^ |   -8 You probably will need veronoi diagrams.
•  » » 3 years ago, # ^ |   0 How do you determine in which point should be center of the circle?
•  » » » 3 years ago, # ^ |   0 All right, I already understand how. If somebody still curious — visit this article.
 » 3 years ago, # |   0 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, # ^ |   0 Where's O(2^n) subpolygons...
•  » » » 3 years ago, # ^ | ← Rev. 4 →   0 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, # |   0 Btw, why did you not just google your question? I found answer for that in few minutes. Identical question on StackOverflow. There are few interesting answers, so I will not share single one. Research paper with different from suggested on StackOverflow approaches.