|
|
"Arie L. Stavchansky" wrote:
>
> Hi there,
>
> Is it possible to create a loop such that I create a object (let's say a
> sphere), then place that object into a declared array? After which I can
> manipulate an object depending on its place in the array?
You can describe the location of an object by storing it's coordinates
in an array and then use the data in the array with a while loop to
locate the objects. A simple example locates 5 spheres using an array -
#declare Dnum = 5;
#declare Data = array [Dnum][2]
{
{ 0, 0},
{-1,-1},
{ 1, 1},
{-1, 1},
{ 1,-1},
}
#declare Unit = sphere { 0,1 }
#declare Five_Spheres =
union {
#declare I=0;
#while (I < Dnum)
object { Unit
translate <Data[I][0],Data[I][1],0>
pigment{rgb 1}
}
#declare I=I+1;
#end
}
camera{location<0,0,-7>look_at 0}
light_source{<-10,10,-20>rgb 1}
object { Five_Spheres }
--
Ken Tyler
Post a reply to this message
|
|