<p>This is likely more complicated than you would prefer, but: Compute the medial axis, which immediately yields the largest disks that fit inside the polygon:
their centers are vertices (degree $\ge 3$) of the axis (see the
figure below).</p>

<blockquote>
  <p>Chin, Francis, Jack Snoeyink, and Cao An Wang. "Finding the medial axis of a simple polygon in linear time." <em>Discrete &amp; Computational Geometry</em> 21.3 (1999): 405-420.</p>
</blockquote>

<p><hr />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
<a href="https://i.sstatic.net/R2ZKK.png" rel="noreferrer"><img src="https://i.sstatic.net/R2ZKK.png" alt="medialax"></a>
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
<sup>
(Image from <a href="http://endl.ch/content/centerline" rel="noreferrer">Alexander Tsvyashchenko</a>.)
</sup></p>

<hr />

<p>See also, <a href="https://stackoverflow.com/a/4279633/387778">Largest circle inside a non-convex polygon</a> for an <em>ad hoc</em> approach
(whose correctness I did not attempt to verify).</p>

CC BY-SA 3.0
2017-11-04T13:14:09.480Z
2017-11-04T23:05:19.717Z
2017-11-04T23:05:19.717Z
Joseph O'Rourke
<p>How can I check if a polygon (can also be irregular) can completely contain a circle of a certain radius? I do not want to actually draw a circle inside the polygon but just a boolean outcome whether or not it can be fit. I need this for an application that I'm developing in Java. Note that I'm not looking for the inscribed circle, but the largest circle that a polygon can contain. I suppose there can be multiple circles with the same area.</p>

<p>Could someone share an algorithm or code snippet (any language is fine) or guide me to any relevant resource?</p>

<computational-geometry><polygon><clipping>
How can I check if a polygon can completely contain a circle of a certain radius?
user7413
# How can I check if a polygon can completely contain a circle of a certain radius?

(Asked by: username_0 on 2017-11-03)

How can I check if a polygon (can also be irregular) can completely contain a circle of a certain radius? I do not want to actually draw a circle inside the polygon but just a boolean outcome whether or not it can be fit. I need this for an application that I'm developing in Java. Note that I'm not looking for the inscribed circle, but the largest circle that a polygon can contain. I suppose there can be multiple circles with the same area.

Could someone share an algorithm or code snippet (any language is fine) or guide me to any relevant resource?

**Tags:** computational-geometry, polygon, clipping


---

## 1 answers

### Answer by username_1 on 2017-11-04. Score: 10 | Accepted answer

This is likely more complicated than you would prefer, but: Compute the medial axis, which immediately yields the largest disks that fit inside the polygon:
their centers are vertices (degree $\ge 3$) of the axis (see the
figure below).

> Chin, Francis, Jack Snoeyink, and Cao An Wang. "Finding the medial axis of a simple polygon in linear time." *Discrete & Computational Geometry* 21.3 (1999): 405-420.

---

         
[![medialax](https://i.sstatic.net/R2ZKK.png)](https://i.sstatic.net/R2ZKK.png)
  
         
(Image from [Alexander Tsvyashchenko](http://endl.ch/content/centerline).)

---

See also, [Largest circle inside a non-convex polygon](https://stackoverflow.com/a/4279633/387778) for an *ad hoc* approach
(whose correctness I did not attempt to verify).


---

