POV-Ray : Newsgroups : povray.newusers : While loop challenged : Re: While loop challenged Server Time
15 May 2024 18:04:07 EDT (-0400)
  Re: While loop challenged  
From: James Holsenback
Date: 27 Mar 2014 20:35:47
Message: <5334c3e3@news.povray.org>
On 03/27/2014 07:27 PM, Bald Eagle wrote:
> I'm just trying to do a simple "display 1000 spheres with every RGB
> value in 0.1-unit increments" loop
> Looks like it works ok except for some reason my last block of 100
> spheres partially overlaps the 9th one.
>
> I REALLY ought to be better at this....
>
> ##################################################

well i'm getting 11 x 11 grids of spheres ... two ways to fix that 
change the value that you initially set Blue_, Red_, Green_ or look at 
your tests (#if clauses) ... later would be my choice ;-)

i'm going to stop here as i suspect that there are other foo's similar 
to the ones i've pointed out. i bet you can find them faster than me ;-)

btw: code you posted had undefined B error and wouldn't even parse. see 
below ...

>
>
> #declare Radius = 3;
> #declare Sphere = sphere {<0, 0, 0> Radius}
> //#declare Box = Round_Box_Union (<-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>,
> Radius)
>
>      #declare B = -300;
>      #declare Flag = 0;
> #declare Blue_ = 0;
>      #while (Blue_ <= 1)
>      #if (Blue_ < 0.3)
>          #declare Y = 250;
>      #end
>
>      #if (Blue_ > 0.3 & Blue_ < 0.6)
>          #if (Flag = 0)
>          #declare B = -300;
>          #declare Flag = Flag + 1;
>          #end
>          #declare Y = 150;
>      #end // end if
>
>      #if (Blue_ > 0.6)
>          #if (Flag = 1)
>          #declare B = -300;
>          #declare Flag = Flag + 1;
>          #end
>          #declare Y = 50;
>      #end
>
> #declare Red_ = 0;
>      #while (Red_ <= 1)
>
>      #declare Green_ = 0;
>      #declare X = 0;
>          #while (Green_ <= 1)

following line caused error and it appears that you've isolated B 
somehow ... i just added the declare for B from the above Blue_ test

>          object {Sphere texture { pigment {rgb <Red_, Green_, Blue_>}
> finish {phong 0.5} } translate <X+B, Y, 0>}
>          #declare Green_ = Green_ + 0.1;
>          #declare X = X + 8;
>          #end // end Green loop
>
>      #declare Red_ = Red_ + 0.1;
>      #declare Y = Y - 8;
>      #end // end Red loop
>
> #declare Blue_ = Blue_ + 0.1;
> #declare B = B + 110;
> #end

hope Iive given you enough of a nudge ... good luck!


Post a reply to this message

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