|
|
On Fri, 12 Mar 1999 20:32:52 -0000, "Andrew Cocker"
<and### [at] acockerfreeservecouk> wrote:
>I want to try out arrays. My plan is to create a cube made up of, say, 20x20x20 tiny
>spheres. If I pick one of these spheres and designate it to be the centre of the
effect
>I'm trying to create, and scale it by a factor of 2, how do I make the surrounding
spheres
>get gradually smaller until 5 spheres away they are back to scale 1? I plan to
animate the
>effect so that the centre of the effect moves around inside the array of spheres.
Give this little macro the array coordinates of the sphere you are
defining and of the sphere at the center of the effect. At the proper
point in the sphere definition say:
scale Size(Mysphrx, Mysphry, Mysphrz, Mycentx, Mycenty, Mycentz)
#macro Size(_Xloc, _Yloc, _Zloc, _Cxloc, _Cyloc, _Czloc)
#local _Dist = min(min(abs(_Xloc - _Cxloc), abs(_Yloc -_Cyloc)),
abs(_Zloc - _Czloc));
#local _Scl = (5 - max(_Dist, 5)) / 5;
<_Scl, _Scl, _Scl>
#end
The macro will, of course, work with actual position coordinates as
well and for noninteger positions (with a Manhattan metric). To do
this for another range, replace every occurrence of 5 with a variable
and add that variable to the parameter list. This reduces the size
linearly. If you want to do inverse square or somesuch, or change the
metric, it is pretty simple. You can also easily modify it to wrap
around.
Jerry Anning
clem "at" dhol "dot" com
Post a reply to this message
|
|