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 00:32:27 EDT (-0400)
  Re: Problem concerning the use of array indices inside functions  
From: Jaap Frank
Date: 2 May 2003 12:45:01
Message: <3eb2a08d@news.povray.org>
> Jaap Frank wrote:
> >   Is there a way to circumvent this problem
>
> No, arrays are a parse time language element in POV-Ray and can not be
> used in (render time) user defined functions.  This is a very common
> misunderstanding about user defined functions.  Although they look similar
> in syntax to the normal script they are completely different.  An 'sqrt()'
> in a function for example has nothing to do with an 'sqrt()' elsewhere in
> SDL.

If you take this literally then this means you can't use arrays inside functions,
but I know that you can use them because my interpolation functions are
full with them, but they all have fixed indices.
I suppose you mean that POV-ray needs to know what the array indices are
at parse time and that it is not possible to fill in the correct indices on the
fly
during rendering.

I remember -it was in the seventies that I coded in machine language on a
Z80 processor (I know it's ancient, but I doubt that the principal is changed)
- that this can be done on the fly using indirect referencing a variable where
the indirect address gives the offset in the variable field. Maybe this was a
speciality of this processor, because I've heard that the famous 8086
processor that came later was not so advanced compared to this processor.
I suppose that the modern processors have this possibility too, but that the
way the arrays are reached in memory, this is already in use and we need
now indirect indirect referencing or something like that to do this.

But never the less, thanks for your reaction,

Jaap Frank


Post a reply to this message

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