POV-Ray : Newsgroups : povray.newusers : problem using rotate in a while loop : Re: problem using rotate in a while loop Server Time
31 Jul 2024 02:26:56 EDT (-0400)
  Re: problem using rotate in a while loop  
From: Johannes Dahlstrom
Date: 11 Feb 2003 05:26:35
Message: <3e48cfda@news.povray.org>
Suso Banderas wrote:

> Oh I get it now.  POV-Ray really functions reverse of what I expected.
> Being a programmer, I was expecting it to keep track of what the box's
> previous rotational angle was on the last iteration of the while loop.  I
> should have realized that I wasn't doing that with the position.  Thanks
> for your help.  Both of you.

Well, at each iteration it creates a new box from scratch, so... 
BTW, no need to resort to trigonometry here, just do the translation before 
rotation:

#declare Rad = 3;
#declare Rot = 0;
#while(Rot < 360)
  box {
   -1, 1
   pigment { rgb y }
   translate Rad*z;  
   rotate Rot*y
  }
  #declare Rot = Rot + 30;
#end


Post a reply to this message

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