|
|
"Peter Popov" <pet### [at] vipbg> wrote in message
news:ieem8u0t8idha84hopud7dounirvola9kr@4ax.com...
> On Sat, 9 Mar 2002 21:19:30 -0500, "Parasonic"
> <par### [at] parasonicpar> wrote:
>
> >I'm making a wall of boxes (yes, boxes). I have made a set that I could
tile
> >(like bricks). What do I need to do to repeat this group of objects
sevreal
> >times?
>
> Use a #while loop. For example, here's your box 5 times along the x
> axis.
>
> #declare Brick = box { -1, 1 }
>
> #declare i=0;
> #while (i<5)
> object { Box translate 2.1*i*x }
> #declare i=i+1;
> #end
>
> If you want to repeat along two axes, for example along a plane, use
> nested loops.
I'll expand on that point with:
#declare Brick = box { -1, 1 pigment {rgb 1}}
#declare i=0;
#while (i<9)
#declare j=0;
#while (j<6)
#if (mod(j,2)=0) #declare k=1; #else #declare k=0; #end
object { Brick translate <2.1*i+k, 2.1*j,0> }
#declare j=j+1;
#end
#declare i=i+1;
#end
This is the nesting, j gets reset to 0 every time i is reiterated until i is
finished looping. So in this way you also get a height instead of just a
line.
From what it seems you're doing I guess the intended wall is to be staggered
for each successive box lined along top of the last line so you also need to
shift every other line half a box width. That's the mod(j,2) part; it will
either divide into even numbers leaving a 0 result or odd numbers leaving 1
remainder, thus tested against for whether or not to add a half box width.
> >Also, how does the sky sphere work? Someone told me how to get a
two-color
> >sky sphere:
>
> >Why is the scale 2? Why is the sphere *translated* on y (not rotated,
etc)?
>
> Look carefully at the code you posted. You're scaling and translating
> the pigment, not the sky sphere itself, and it's perfectly legal to do
> so.
Again, I'll expand on what Peter has said. The usual blend map type of the
gradient pattern causes a doubling of that pattern over the diameter of a
unit sphere centered at the y*0 plane, sky_sphere is essentially a infinite
sphere which is based on the sphere primitive as far as patterns are
concerned.
So, to get only the two colors without using them more than once you must
scale 2 and move that pattern up or down a unit distance in the case of y
direction. That covers a sphere just once (1 radius = 2 units diameter).
In many cases having the (gradient) sky showing only above a plane {y,0} for
example doesn't require you do such scaling and translating since you don't
see below the ground.
bob h
Post a reply to this message
|
|