POV-Ray : Newsgroups : povray.general : #while loops and staggered offsets ? : Re: #while loops and staggered offsets ? Server Time
16 Nov 2024 01:16:52 EST (-0500)
  Re: #while loops and staggered offsets ?  
From: Ken
Date: 4 Nov 1998 20:49:19
Message: <364103BC.FD928188@pacbell.net>
For my next trick....
How would I go about getting each horizontal row to rise
0.2 in the y direction. I attempted the following and ended
up with a slope that should be equivelant to -x -y to +x +y
instead of a uniform -x +x -y to -x +x +y. I hope that made
since.
Perhaps this is a good graphic example of what happened.

   /
  /
 /
/


#declare Obj = box{-1,1 scale<.9,.2,1.5>pigment{rgb 1}}

#declare x2 =  0;
#declare z1 =  0;
#while  (z1 < 10)
  #declare x1 =  0;
  #while  (x1 < 10)
    object{Obj translate <x1+x2,x1*.2,z1>}
    #declare x1 = x1 + 1;
  #end
  #declare x2 = 0.5 - x2;
  #declare z1 = z1 + 1;
#end

Thanks again.

Ken Tyler

Ron Parker wrote:

> On Wed, 04 Nov 1998 13:49:09 -0800, Ken <tyl### [at] pacbellnet> wrote:
> >How would I create the same sort of grid where evey other
> >row in the z direction is offset by 0.5 in the x direction.
> >My intention is easying the pain of placing shingles on a
> >roof where it is important that the cracks of overlapping
> >rows do not line up while back filling the spaces that would
> >be left by doing so.
>
> //I switched your loops around so you won't have as many calculations.
>
> #declare x2 =  0;
> #declare z1 =  0;
> #while  (z1 < 10)
>   #declare x1 =  0;
>   #while  (x1 < 10)
>     object{Obj translate <x1+x2,0,z1>}
>     #declare x1 = x1 + 1;
>   #end
>   #declare x2 = 0.5 - x2;
>   #declare z1 = z1 + 1;
> #end


Post a reply to this message

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