POV-Ray : Newsgroups : povray.newusers : problem using rotate in a while loop : problem using rotate in a while loop Server Time
31 Jul 2024 02:21:10 EDT (-0400)
  problem using rotate in a while loop  
From: Suso Banderas
Date: 10 Feb 2003 17:12:09
Message: <pan.2003.02.10.22.12.09.759527@suso.org>
I'm trying to make a scene where several boxes form a circle and
are tangent to the circle.  in other words, each box would be
rotated a certain amount as they are placed around the circle.
I tried doing this with a while loop and a couple of variables. 
I can get the translation to work, but the rotate doesn't work.
What could I be doing wrong?  By the way, I already tried making
the box a declared object that is defined outside the while loop.
Thanks for your help.

#include "colors.inc"

light_source { <-10, 20, 0> color White }
light_source { <0, 50, 0> color White }


plane {
    y, -1
    pigment { checker color Black color White scale 5 rotate y*45 }
}

camera {
    location <0, 20, 0>
    look_at <0, 0, 0>
}

#declare rad = 10;     // radius of circle
#declare objects = 9;  // number of objects in circle
#declare position = 0;  // starting position
#declare increment = 2*pi / objects;  // increment between objects
#declare degree = 180/pi;  // Radian to degree conversion

#declare thisobject = box {
    <-1,-1,-1>
    <1,1,1>
    pigment { color Green }
    rotate <0,increment*degree,0>
}

#while (position < 2*pi)
    box {
        <-1,-1,-1>
        <1,1,1>
        pigment { color Green }
        rotate <0,increment*degree,0>  // rotate the box so that it is tangent.
        translate <cos(position)*rad, 0, sin(position)*rad>
    }
    #declare position = position + increment;
#end


Post a reply to this message

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