POV-Ray : Newsgroups : povray.newusers : Decrement the number of objects as loop progresses : Re: Decrement the number of objects as loop progresses Server Time
4 Jul 2024 14:20:00 EDT (-0400)
  Re: Decrement the number of objects as loop progresses  
From: Jim Charter
Date: 13 Aug 2010 03:27:16
Message: <4c64f3d4@news.povray.org>
Haakon Meland Eriksen wrote:
> I would like to do something like this
> 
> *
> **
> ***
> **
> *
> 
> and decrement the number of objects in one direction as the loops progress. How
> can I do this correctly? This does not work.
> 
> #declare IndexX = 0;
> 
> #while (IndexX <= 9)
>         #declare EndZ = 9;
>         #declare IndexZ = 0;
> 
>         #while (IndexZ <= EndZ)
> 
>                 sphere {  <IndexX,1,IndexZ>, 0.1   texture {pigment{color Red}}}
>         #declare EndZ = EndZ - 1;
>         #declare IndexZ = IndexZ + 1;
> 
>         #end
> 
> #declare IndexX = IndexX + 1;
> #end
> 
> Cheers,
> Haakon
> 
> 
> 
> 
#declare X = -9;
#declare EndZ = -1;

#while (X <= 9)
   #if ( X < 0 )
     #declare EndZ = EndZ + 1;
   #else
     #declare EndZ = EndZ - 1;
   #end

   #declare Z = 0;
   #while (Z <= EndZ)
     sphere {  <X,1,Z>, 0.1   texture {pigment{color x}}}
     #declare Z = Z + 1;
   #end

   #declare X = X + 1;
#end


Post a reply to this message

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