POV-Ray : Newsgroups : povray.advanced-users : Distributing spheres of differnent sizes... : Re: Distributing spheres of differnent sizes... Server Time
2 Nov 2024 07:26:27 EDT (-0400)
  Re: Distributing spheres of differnent sizes...  
From: Michael Andrews
Date: 6 Jan 2000 11:12:18
Message: <3874BE81.F1F9ABA@reading.ac.uk>
Hi Rune,

Well here's my attempt at the problem:

Given that:
	r_i => radius of sphere i, 0 <= i <= n
	r_0 => radius of sphere at a
	r_n => radius of sphere at b, r_n >= r_0
	p_i => position of sphere i along vector ab
	p_0 => position of sphere at a
	p_n => position of sphere at b

Known values:
	a, b, r_0, n

Since the radii linearly decrease from a to b

	average(r_i) == (r_0 + r_n) / 2

thus average separation is

	vlength(p_n-p_0) / n == r_0 + r_n

so as long as r_0 is between 1/2 and 1 times the average separation as
limits

	r_n == vlength(p_n-p_0)/n - r_0

and

	r_i == r_0 + i*(r_n-r_0)/n

so 

	p_i == p_(i-1) + (p_n-p_0) * (r_(i-1) + r_i) / vlength(p_n-p_0), 1 <= i
<= n

Well, thats my solution anyway. I think it's right ...

	Bye for now,
		Mike Andrews.


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.
> 
> Anyone know how to do it?
> 
> Oh, if you haven't guessed yet, this is for my Inverse Kinematics Neck...
> 
> Greetings,
> 
> Rune
> 
> ---
> Updated December 22: http://rsj.mobilixnet.dk
> Containing 3D images, stereograms, tutorials,
> The POV Desktop Theme, 350+ raytracing jokes,
> miscellaneous other things, and a lot of fun!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.