Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the smallest circle that encompasses other circles?

Tags:

c#

math

geometry

If a circle is defined by the X, Y of it's center and a Radius, then how can I find a Circle that encompasses a given number of circles? A single circle that is the smallest possible circle to completely contain 2 or more circles of any size and location.

At first I tried just encompassing 2 circles by finding the midpoint of the centers and that being the midpoint of the new circle while the radius was equal to the half of the radius of the 2 initial circles and half the distance between their centers, but somehow it always turned out to be a little off. The problem always seemed to be a problem with finding the radius, but I have such a headache about this I can't make it work.

I don't necessarily need a method for finding a circle that encompasses 3 or more circles. I can find a circle that encompasses 2, take that circle and encompass it with another, and another, and the final circle should encompass all circles given throughout the steps.

like image 788
Corey Ogburn Avatar asked Jan 18 '10 08:01

Corey Ogburn


1 Answers

There problem you have at hand is called Smallest enclosing sphere of spheres. I have written my thesis about it, see "Smallest enclosing ball of balls", ETH Zurich.

You can find a very efficient C++ implementation in the Computational Geometry Algorithms Library (CGAL) in package Bounding Volumes. (There is no need to use all of CGAL; just extract the required source and header files and you are up and running.)

Note: If you are looking for an algorithm to compute the smallest enclosing sphere of points only, there are other implementations out there, see this post.

like image 59
Hbf Avatar answered Sep 17 '22 12:09

Hbf