POV-Ray : Newsgroups : povray.newusers : loop in function : Re: loop in function Server Time
5 Nov 2024 01:21:45 EST (-0500)
  Re: loop in function  
From: Christoph Hormann
Date: 25 Aug 2002 13:50:00
Message: <3D6918C8.6CC91DDA@gmx.de>
Adrien Rebollo wrote:
> 
> Hello,
> 
> I would like to define a function with a while loop inside, like this :
> 
> [...]
> 
> I know there is a sum(...) pattern which could achieve the same thing, but
> I put a sum for the example, it could be whatever loop in a function,
> which tries to use the x, y, z coordinates that fails.

You are mixing up the different levels in a POV-Script.  #declare/#local
work at parse time and not during rendering, therefore

#local res = res + my_array[I](x,y,z);

tries to assign a value to res while parsing and expects x, y and z to be
symbols for 1 unit vectors like elsewhere in a POV-Script.  

For how to use arrays of functions and loops in functions see the
'IC_Merge_Array()' macro in the IsoCSG include file.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

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