POV-Ray : Newsgroups : povray.newusers : loop in function : loop in function Server Time
5 Nov 2024 01:22:42 EST (-0500)
  loop in function  
From: Adrien Rebollo
Date: 25 Aug 2002 13:11:06
Message: <3d690faa$1@news.povray.org>
Hello,

I would like to define a function with a while loop inside, like this :

#declare my_array = array[Imax] {
	function ...
} // array of functions

#declare my_function = function {
	#local res = 0;
	#local I = 0;
	#while (I < Imax)
		#local res = res + my_array[I](x,y,z);
		#local I = I + 1;
	#end
	res
}

but povray complains about x, y and z being vectors, not floats.

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.

Adrien Rebollo


Post a reply to this message

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