POV-Ray : Newsgroups : povray.general : Array and vector functions? : Re: Array and vector functions? Server Time
6 Oct 2025 21:39:15 EDT (-0400)
  Re: Array and vector functions?  
From: Bald Eagle
Date: 4 Oct 2025 11:00:00
Message: <web.68e13664c4b396411f9dae3025979125@news.povray.org>
Ilya Razmanov <ily### [at] gmailcom> wrote:

> (sighing like an angry snake)

I will join you in the chorus.

> Ok, surely I can try transmitting
> arguments in unpacked form like function(array[0], array[1], array[2],
> etc).

You can, and can more easily do so using a loop.
So, write a macro to loop through all of your array indices, and that will work
just fine.
The only thing is, you only get to define that function with it's current array
values ONCE.   Because the function gets defined at parse time and cannot be
changed during render time.

> Once upon a time I even wrote function with 13 named arguments
> (for my Scale3xSFX implementation), but at list I didn't have to unpack
> them every time since they were named already...

Like I said, there are workarounds.
I needed something like this once or twice, and you can do a few interesting
things.
First, you can write a function that allows you to change which parts of the
array that use so that you're not constantly using them all.
Fn=function (N) { select (N, 0, 1, 0) * Array [1] + ....}
So if you write a function where the zeroes land on the array elements that you
want, then those are the only ones multiplied by 1.

You can also write spline functions.

WFP has experiments with using image_maps as a way to sort of store values in an
"array"



- BE


Post a reply to this message

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