Algorithm for joining circles into a polygon : <p>What is the best way of combining overlapping circles into polygons?</p>

<p>I am given a list of centre points of circles with a fixed diameter.</p>

<p><a href="https://i.stack.imgur.com/LE7b3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LE7b3.png" alt="Rendering of 5 random circles"></a></p>

<p>I need to join any overlapping circles together and output a list of points in the resulting polygon.
<a href="https://i.stack.imgur.com/bUeY9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bUeY9.png" alt="Rendering of desired output"></a></p>

<p>This seems like a fairly common problem (GIS systems, vectors, etc.). This is possible to do through the Google Maps API but I am looking for the actual algorithm.</p>

<p>I have tried to solve this problem by calculating points around each circle.
<a href="https://i.stack.imgur.com/xwvfU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xwvfU.png" alt="Rendering of 16 points on the circumference of each circle"></a></p>

<p>Then removing any points located inside any circle.
<a href="https://i.stack.imgur.com/Wor7I.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Wor7I.png" alt="enter image description here"></a></p>

<p>This gives me the correct list of points in the desired polygon.
<a href="https://i.stack.imgur.com/ww6yp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ww6yp.png" alt="Rendering of points on the desired polygon"></a></p>

<p>However, the order of the points is a problem with this solution. Each circle has its points stored in an array. To merge them correctly with 2 overlapping circles is relatively straight forward. However, when dealing with multiple overlapping circles it gets complicated.
<a href="https://i.stack.imgur.com/BQcIP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BQcIP.png" alt="enter image description here"></a></p>

<p>Hopefully you have some ideas to either make this solution work or of another algorithm that will achieve the desired result.</p>

<p>Thanks in advance!</p>
