POV-Ray : Newsgroups : povray.newusers : Beginners code doesn't run : Re: Beginners code doesn't run Server Time
19 Apr 2024 17:49:58 EDT (-0400)
  Re: Beginners code doesn't run  
From: Markus
Date: 2 Sep 2016 02:30:00
Message: <web.57c91c64786d177f4066f2170@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 01.09.2016 um 21:54 schrieb Markus:
>
> >     vertex_vectors {
> >         vec
> >
> > #declare i = 0;
> > #declare j = 0;
> > #while(i<n)
>
> you want to move the "#declare j = 0" into the outer loop.
>
> >     #while(j<m)
> >         #declare x1 = pow(i*r,5) * cos(5 * j * phi) - i * r * cos(j * phi);
> >         #declare y1 = pow(i * r,5) * sin(5 * j * phi) - i * r * sin(j * phi);
> >         #declare z1 = i*r + j*phi;
> >
> >         ,<x1,y1,z1>
> >
> >         #declare j = j + 1;
> >     #end
> >     #declare i = i + 1;
> > #end
>
> Also, presuming you are using POV-Ray 3.7, to avoid such mistakes you
> can instead use the `#for` statement, which initializes and increments
> the variable automatically.
>
> #for(i,0,n-1)
>   #for(j,0,m-1)
>     ...
>   #end
> #end

Thanks, this helped :-)


Post a reply to this message

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