|
|
Rune wrote:
> Imagine a straight line from a to b. Along that line multiple spheres are
> centered. The spheres have different sizes. From a to b the radius of a
> sphere gets linearly smaller. I want a certain number of spheres to be on
> the line. The first sphere centered at a, and the last sphere on b. I want
> the spheres to be distributed along the line in a certain way. It must not
> be linearly but relative to the radii(sp?) of the spheres. That is, the
> smaller the spheres get, the smaller distance between them.
>
> What I can't figure out is how to calculate the points along the line at
> which the spheres must be centered.
>
> It may be possible to use some kind of forces to calculate it, but I would
> prefer "straight" math.
>
Here's something interesting, even if it's not what you're trying to
find.
I simplified the problem a bit by setting a=0, so we're looking at a
line segment from 0 to b on the number line.
I'm assuming that b is given, and also r_0, the radius of the sphere
with center 0, is given, and a positive integer n is given.
I'll label the centers c_0=0, c_1, c_2, c_3, ..., c_i, ..., c_n=b, so
there will actually be n+1 spheres centered on the segment. I'm also
assuming that the spheres are tangent to each other, and the radius
numbers are labeled r_0, r_1, ..., r_n. (r_0 is the given initial
radius.)
Here's the "linear dependence" of the radius on the center's position:
r_i = m * c_i + r_0. (note that at i=0, c_i=c_0=0, so r_0=r_0.)
The center of the "i" sphere is to the right of the "i-1" sphere by
distance r_{i-1}+r_i, so:
c_i = c_{i-1} + r_{i-1} + r_i.
From these two equations, we're trying to find the "unknown" center
points c_i. The only other unknown variable that showed up was the
slope "m" from the first equation.
Here's the solution I got:
c_i = ( ( (1+m)/(1-m) )^i - 1) * r_0 / m.
This isn't so bad, but there's still the problem of finding m.
At i=0, the solution is c_0= 0 * r_0 / m = 0, which we already knew.
At i=n, the solution is c_n = ( ( (1+m)/(1-m) )^n - 1) * r_0 / m, and
also we want to have c_n = b, so we can use this to find m:
b = ( ( (1+m)/(1-m) )^n - 1) * r_0 / m
simplifies into a polynomial equation:
m * b * (1-m)^n = ( (1+m)^n - (1-m)^n ) * r_0. (*)
Now, since b, r_0, and n were given, you can find m. Of course, this
isn't going to be pleasant for large n ("large" meaning more than 2)
and there are also going to be as many as n+1 solutions of (*), only
one of which is the m that will work.
Once you get the formula for c_i, you can plug it into the first
equation to get the radius r_i.
I tried this with r_0=4, b=10, and n=4, and got an approximate
solution m=-.3843543262. There should be 5 spheres, the first with
radius 4, and decreasing in radius (because m is negative), but all
tangent to each other until c_4=10.
In this set-up, the size r_n of the last sphere isn't an input, it's
an output determined entirely by r_0, n, and b. Another
interpretation of the calculation, which might be closer to your
intent, is that you could pick the slope m in advance, and use m, b,
and n to solve the polynomial solution (*) for r_0. (at m=0, the
spheres will be the same size, and (*) won't help, but there are
easier ways to solve that problem.)
Adam C.
Post a reply to this message
|
|