## A sphere that fits exactly into the space between 4 spheres that are in contact?

Very recently, I joined a Revit-related group in Linked-In: “Revit Users”. I think this was the first group about Revit that was created in Linked-In. It was founded by Brian Myers, who is also one of the moderators of the Augi Revit forums. Anyway, in his group, I found this question, about fitting a small sphere exactly between four bigger spheres that are all in contact to each other. I thought the question was interesting, so I decided to write an article about it, using Revit, of course.

First, I decided to study the geometry in 2D. I placed four circles of 1 unit of radius, and controlled their center points by parameters, with equal / equal constraints from the cross of reference planes at the origin. I also placed a smaller circle at the center. The radius of the bigger circles is controlled by a radial parameter named “R”, uppercase r. The radius of the small circle is controlled by another radial parameter named “r”, lowercase r. The horizontal and vertical distance between the centers of the bigger circles is controlled by a length parameter named “d” for distance. So, now, how do we know the values of “r”, “R”, and “d”, so that all 5 circles are in contact?

Well, if the bigger circles have to come together and meet at one point, the vertical and horizontal distance between their centers, when they touch, must be equal to the radius of the small circle “r”, plus the radius of the bigger circle “R”, as shown in this image, and the point where they meet should be located at the half of that distance, “d”. Therefore, to find that d/2 , we consider that segment as the side of a triangle, for which we know the hypotenuse, “R”, and the angle, which is 45 degrees. Therefore, d / 2 = R * cos (45) . Now we can find the value of “d” and “r” for any value of “R”.

Therefore, when R = 1.0 , d = 1.4142 , and r = 0.4142

In other words, 4 spheres that are in contact with each other have their centers separated by a distance that is equal to 1.4142 times their radii (R), and the radius (r) of a small circle located at the center of the bigger circles, and in contact with all four, is always 0.4142 times the radius (R) of the bigger circle.

Which allows us to simplify the formulas in the Revit family as:

If we apply those two formulas to the Revit family, now the 5 circles will be always in contact, for any value of R.

Now that we have the formulas, it is easier to re-create this in 3d, in another family, which we start with the generic adaptive template; here, we create the 3 parameters, write the formulas, and create a skeleton of reference planes in the plan view in the same way as we did in the 2d family. The difference is that we need to create a reference plane in elevation, controlled by a length parameter “R”, so that the height of the center of the spheres is the same radius of the bigger spheres. We should name the reference plane, such as “center”. Now we place reference points, 5 of them, at the intersection of the reference planes in n plan view, and then we lift these points to the “center” reference plane, by selecting the reference points and changing their host to be “center”. Before placing the spheres, we should verify that the points flex (move) properly if the parameters are changed.

To create the spheres, we can go to Insert > Load family > and look for “sphere.rfa” in the library’s Mass folder. To place each sphere at its correspondent point, we first must set that point’s horizontal plane as the current work-plane, and then place the sphere at the point. We do this 5 times, until we have 5 spheres. Then we select the 4 outer spheres, and tie their Radius parameter to the local “R” parameter. Then we select the central sphere, which is going to be smallest one, and tie its Radius parameter to the “r” parameter.

Now, if everything was done correctly, if “R” is changed to another value, all spheres should move inwards or outwards, but keeping their contact all the time.

I had no idea what this was for, but the problem got my attention. The original poster of the question said that this is for “petroleum engineering. studying the effect of grain size and packing on production and drilling”. Anyway, an interesting exercise of geometry to do in Revit. This is a view of the family, once loaded into a project, with some walls by phase, some materials, shaded view, and shadows.

This could be just the first phase of a bigger problem, though. How would you repeat this arrangement multiple times in X, Y, and Z, and how do you fit that arrangement in a box of certain dimensions?

hmm.. I see another article coming in the near future, about multiple instances of Divide & Repeat in three different planes.

This is a summary of this article, in motion:

See you in our next blog…

©* 2012 Planta1.com, inc. , Alfredo Medina | permission to reproduce this article is granted if the name of the author and the URL of this article receive proper credit.*