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:36:59 EDT (-0400)
  Re: Problem concerning the use of array indices inside functions  
From: Mark Weyer
Date: 2 May 2003 09:52:02
Message: <3EB277FF.2050209@informatik.uni-freiburg.de>
> ultimately POV-ray needs something like
> 
>    #declare F = function(x)
>    { Cube[int((x-X0)/StepX)]  }

I might get killed for proposing something so inefficient, but:
(I only treat one-dimensional array, the rest (including optimization
correction of errors, introduction of interpolation,...) I leave to you)

#declare F = function(x)
{
   #local I=1;
   #while (I<Max)

     select (x-X0-I*StepX, Cube[I-1],

     #local I=I+1;
   #end

   Cube[Max-1]

   #local I=1;
   #while (I<Max)

     )

     #local I=I+1:
   #end
}

-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

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