# How to add Spheres[] sequentially from the surface of preexisting spheres?

I'd like to connect many spheres, by adding a new sphere at some point that's sitting on the surface of a previous sphere. How could we do this?

Suppose I have a unit sphere and a point on it:

myShpere1=Sphere[];
myPoint1=SpherePoints[1];
Graphics3D[{myShpere1, Point[myPoint1]}]


How can we add a second sphere who's surface is touching the previous one at the random point, then a third sphere on a random point of the second sphere, and so on? (for any number of spheres, always choosing a new random point). On a related issue, do spheres have an orientation in MMA, as ellipsoids do? If so, how do we get the "vector/axis" of orientation?

Thanks!

spheres = Sphere[#, 1] & /@ NestList[
With[{rp = RandomPoint[Sphere[#, 1]]}, 2 rp - #] &, {0, 0, 0}, 5];


If you need the spheres to be self avoiding, then you could look into this question.

All spheres are oriented upward.

• You don't need to map Sphere[], since it can support multiple centers if the radius is fixed: Graphics3D[Sphere[NestList[With[{rp = RandomPoint[Sphere[#, 1]]}, 2 rp - #] &, {0, 0, 0}, 5], 1]] – J. M.'s technical difficulties Aug 5 at 14:55

NestList as in flinty's answer is a bit overkill. You can simply use Accumulate like this:

Graphics3D@Sphere@Accumulate[2 RandomPoint[Sphere[], 5]]


• Very cool! From @flinty answer I was able to get the coordinates of the points of sphere-sphere contact from the NestList. How could I get this info from your answer? – TumbiSapichu Jul 12 at 0:00
• @TumbiSapichu That's a great question for you to figure out, I think, to make sure that you truly understand the solution. It's not difficult. – C. E. Jul 12 at 0:01
• Ah, I see everything to the right of the accumulate is the points, the rest is just the plotting. I've just never used Accumulate so I though it'd do something weird. Thanks! – TumbiSapichu Jul 12 at 0:03