POV-Ray : Newsgroups : povray.advanced-users : How to a dome using double "#while" loops... Server Time
25 Nov 2024 21:25:34 EST (-0500)
  How to a dome using double "#while" loops... (Message 1 to 2 of 2)  
From:  Light Beam 
Subject: How to a dome using double "#while" loops...
Date: 6 Mar 2002 15:07:58
Message: <3c86771e@news.povray.org>
I want to create a dome with spheres, but it d'on't work like I want...
For this, I use :

// this scene must create a dome...

camera {  //  Camera StdCam
  location  <    -5.000,     -15.000,       7.000>
  sky       <    0.00000,     0.00000,     1.00000>
  up        <        0.0,         0.0,         1.0>
  right     <    1.35836,         0.0,         0.0>
  angle         40.00000
  look_at   <     0,      0,      0>
}

plane {z,0 pigment {color rgb <0.5, 0.5, 1>}}

#declare sphere_point = sphere {<0,0,0>0.15
                 pigment {color rgb 1}
                 no_shadow
                 }

// start of the loops...
#declare h = 0;
#declare sphere_number = 12;

#while (h < 361)
 object {sphere_point translate <0, 2, 0> rotate <0 , 0, h>}
 #declare h = h + (360 / sphere_number);
#end

#declare h = 0;
#declare sphere_number = 8;

#while (h < 361)
 object {sphere_point translate <0, 2, 0> rotate <30 ,0 , h>}
 #declare h = h + (360 / sphere_number);
#end

#declare h = 0;
#declare sphere_number = 4;

#while (h < 361)
 object {sphere_point translate <0, 2, 0> rotate <60 ,0 , h>}
 #declare h = h + (360 / sphere_number);
#end
// end of the loops

light_source {<-5, -5, 10> color rgb 1}

The problem is that I wanted to make it in a single loop... not 3 !
like this, but it doesn't work ! why ?

// this scene must create a dome...

camera {  //  Camera StdCam
  location  <    -5.000,     -15.000,       7.000>
  sky       <    0.00000,     0.00000,     1.00000>
  up        <        0.0,         0.0,         1.0>
  right     <    1.35836,         0.0,         0.0>
  angle         40.00000
  look_at   <     0,      0,      0>
}

plane {z,0 pigment {color rgb <0.5, 0.5, 1>}}

#declare sphere_point = sphere {<0,0,0>0.15
                 pigment {color rgb 1}
                 no_shadow
                 }

// start of the loop...
#declare h = 0;   /* horizontal rotation */
#declare hh = 0;  /* vertical rotation (half sphere) */
#declare sphere_number = 12;

#while (hh < 181)
#while (h < 361)
 object {sphere_point translate <0, 2, 0> rotate <0 , hh, h>}
 #declare h = h + (360 / sphere_number);
#declare hh = hh + (180 / sphere_number);
#end
#end

// end of the loop

light_source {<-5, -5, 10> color rgb 1}


I very don't understand !


Post a reply to this message

From: Slime
Subject: Re: How to a dome using double "#while" loops...
Date: 6 Mar 2002 23:00:56
Message: <3c86e5f8$1@news.povray.org>
> #while (hh < 181)
> #while (h < 361)
>  object {sphere_point translate <0, 2, 0> rotate <0 , hh, h>}
>  #declare h = h + (360 / sphere_number);
> #declare hh = hh + (180 / sphere_number);
> #end
> #end

Try moving the line

#declare hh = hh + (180 / sphere_number);

to the outside of the first while loop but the inside of the second while
loop. (inbetween the two "#end"s)

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

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