POV-Ray : Newsgroups : povray.advanced-users : Problem concerning the use of array indices inside functions : Re: Problem concerning the use of array indices inside functions Server Time
29 Jul 2024 06:14:07 EDT (-0400)
  Re: Problem concerning the use of array indices inside functions  
From: Jaap Frank
Date: 5 May 2003 14:26:10
Message: <3eb6acc2$1@news.povray.org>
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:3eb67edc@news.povray.org...
> In article <3eb2b23c@news.povray.org> , "Jaap Frank" <jjf### [at] xs4allnl> wrote:
>
> No, because the arrays only exist during parse time, while functions persist
> until the end of the render.  Of course it can be done with various hacks
> and changes or a million other ways, but that is not the point of anybody
> here:  The point is that it is not implemented for reasons that have nothing
> to do with the practical inability to implement it, which seems to be what
> you keep thinking is the problem.

No offence Thorsten, but there are things that may be obviously for you or
the other programmers, but were not for me. I couldn't know that during the
render the array references are gone. If you think that the array references
are still there, then it seems not too difficult to reach them during rendering.
I suppose that one of the reasons is, is to free up memory for other tasks.

Because I need a high order interpolation and I don't want to throw away
months of work, I've decided to build a binary tree of function that contain
all the array values. I estimate that it will come to around 40 thousand
rather small functions.

Because of this discussion I've a couple of questions and a thought:

1. If a function(x,y,z) {} is used for a media inside a media_container,
   are the x,y and z then relative to the container or absolute in the scene?
   I have the impression that they are relative to the container that you
   declare. Is that correct? I can't find any hint about this in the manual.

2. If you 'undefine' a function or variable, is the memory then available
   for new functions or variables. (This could be handy if you reach your
   memory limit.) I suppose it is, but is it?

3. If more people would like to have arrays inside functions, then I've
   thought about the following function:

            function(index) { choose(index, item, [[item], ..] ) }

  with:   item = float | function
            index = which one do you want of this row
  If functions are allowed, then more dimensional arrays are possible.

   I hope that this can be made with the function building system of
   POV-ray. If so, I hope that someone is willing to implement this.
   I can't do it myself.

Thank you for your explanation. I've learned something new again.

Jaap Frank


Post a reply to this message

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