POV-Ray : Newsgroups : povray.newusers : Beginners code doesn't run : Re: Beginners code doesn't run Server Time
20 Apr 2024 04:24:31 EDT (-0400)
  Re: Beginners code doesn't run  
From: clipka
Date: 1 Sep 2016 16:02:12
Message: <57c88944$1@news.povray.org>
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


Post a reply to this message

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