From: Ruslan on
Hi. I want to apply some formulations on cubes that can be fitted inside a sphere.
for example if I have sphere for radius 3 cm, I need many 1cm side cubes inside sphere as much as possible with their location. Is there already code package ? for now I think it will take much time for me to write this. besides, for now I can not imagine an algorithm to apply.
any suggestion or help is appreciated,thanks
From: John D'Errico on
Ruslan <akle(a)mynet.com> wrote in message <1129896010.508297.1270540448637.JavaMail.root(a)gallium.mathforum.org>...
> Hi. I want to apply some formulations on cubes that can be fitted inside a sphere.
> for example if I have sphere for radius 3 cm, I need many 1cm side cubes inside sphere as much as possible with their location. Is there already code package ? for now I think it will take much time for me to write this. besides, for now I can not imagine an algorithm to apply.
> any suggestion or help is appreciated,thanks

Why would there be such a "package"? Homework
problems are best done without packages anyway.
From: Matt J on
Ruslan <akle(a)mynet.com> wrote in message <1129896010.508297.1270540448637.JavaMail.root(a)gallium.mathforum.org>...
> Hi. I want to apply some formulations on cubes that can be fitted inside a sphere.
> for example if I have sphere for radius 3 cm, I need many 1cm side cubes inside sphere as much as possible with their location. Is there already code package ? for now I think it will take much time for me to write this. besides, for now I can not imagine an algorithm to apply.
> any suggestion or help is appreciated,thanks
===========

Are the cubes all shifted versions of each other, or can they have different orientations too?


From: Ruslan on
they are all the same identical. 1cm of side. it can also be smaller than 1cm, which will result in more accurate results but slower in time.

I think it will not so important if cube intersect sphere smaller than about %25 in volume. meaning Its good to have at least %75 of cube inside sphere.

thanks...
From: ImageAnalyst on
On Apr 6, 9:07 am, Ruslan <a...(a)mynet.com> wrote:
> they are all the same identical. 1cm of side. it can also be smaller than 1cm, which will result in more accurate results but slower in time.
>
>  I think it will not so important if cube intersect sphere smaller than about %25 in volume. meaning Its good to have at least %75 of cube inside sphere.
>
> thanks...

---------------------------------------------------------------------------------------
A hint, if you are fortunate enough to have the Image Processing
Toolbox.

From the help for strel():

"SE = strel('ball', R, H, N) creates a nonflat, ball-shaped
structuring element (actually an ellipsoid) whose radius in the X-Y
plane is R and whose height is H. Note that R must be a nonnegative
integer, H must be a real scalar, and N must be an even nonnegative
integer. When N is greater than 0, the ball-shaped structuring element
is approximated by a sequence of N nonflat, line-shaped structuring
elements. When N equals 0, no approximation is used, and the
structuring element members consist of all pixels whose centers are no
greater than R away from the origin. The corresponding height values
are determined from the formula of the ellipsoid specified by R and H.
If N is not specified, the default value is 8."

The function "sum" will also be your friend.