Notifications
Clear all

[Closed] Bounding sphere for spheres

I know the thread name could sound strange, so I try to explain my problem. I have some number of spheres and would like to calculate an optimized bounding sphere containig al that spheres.

14 Replies

Ritter’s algorithm is a simple and fast algorithm that’s usually what is used for a non-optimal points enclosing sphere, you can use your spheres vertices as those points.

Someone wrote a script, not sure how it works though:

But I would like to have an optimized bounding sphere and for spheres this algorithm retuns a bad aproximation. For meshes and boxes it worcks fine.

Thesis:

CGAL doc:

https://doc.cgal.org/latest/Bounding_volumes/classCGAL_1_1Min__sphere__of__spheres__d.html

CGAL implantation:

Thanks, have already seen that CGAL APi, but have not found the sorces and even if I do porting that C/C++ code to maxscript will defently go over my maxscript abilities.
I think to have a solution for my problem, but after reading that other thread here, not shure if center of bounding box is also center of bounding sphere.

So I am going to try something like this

fn getBoundinRadius center spheres =(
rMax=0
for s in spheres do (
r=length(s.position-center)+s.radius
if r>rMax then rMax=r
)
return rMax
)

center is the center of the bounding box and used as center of the bounding sphere to. Can this worck?

Not at all.

OK, thanks for the example. However the reason the bounding sphere in your example is not optimized, seems to be because the center of bounding box and bounding sphere is not the same. The other algorithm, that uses distances between center of bounding box and every single vertex would give at least the same result or even worth. Unfortunatelly I have not found any way to get the real center of the bounding sphere.

!!??
Do what you want. It’s always the same with you.

P.S.: @KaaF has shown you a 183 pages PDF with a solution from a mathematician. Do you really think you can solve this problem by yourself in a such simple way?
Have you think in such a simple thing that the bounding box means absolutely nothing because it depends on the ortonormal axis [XYZ]?
Have you ever heard about the Problem of Apollonius? https://en.wikipedia.org/wiki/Problem_of_Apollonius
It’s basic geometry, just for three circles, and it’s not easy at all, and has nothing to do with rectangular bounding box.
In any case, silly me by answering you again. Never more.

Edit: by the way, you say you haven’t found any way to get the center of the bounding sphere… Of course!!! This is the problem to solve! Once you have the center, the radius is a children’s game!!!

Man, really not understanding why you always geting it wrong? I ageed with you, just wanted to know if there is posibly a way to improove my solution. I saw that 183 pages PDF with a solution from a mathematician, but such huge text in english, which is the most dificult language I know, is a problem for me. Really hope you understanding me right his time, if not I am really sory. Also apologize for the previous misunderstanding.

Page 1 / 2