POV-Ray : Newsgroups : povray.binaries.utilities : Array Patch! : Re: Array Patch! Server Time
28 Jul 2024 16:25:27 EDT (-0400)
  Re: Array Patch!  
From: Twyst
Date: 27 Jan 1998 14:09:15
Message: <34ce31ac.0@news.povray.org>
Ronald L. Parker wrote in message <34c### [at] 100233>...
>On Sat, 13 Dec 1997 11:25:50 -0700, Jamis Buck <buc### [at] csbyuedu>
>wrote:
>
>>OK!  I've just finished coding and briefly testing a patch for POVRay
>>that supports ARRAYS!
>
>How do your arrays work?  Can you put any object, texture, halo,
>camera, or whatever definition into each element of the array, or are
>they limited to mundane things like numbers and vectors?  I'd like to
>see something like this:
>
>#declare Stuff=array[20]
>#declare Stuff[0]=sphere{...}
>#declare Stuff[1]=texture{...}
>
>Is that possible in your implementation?
>

heheh.. That's EXACTLY how it's implemented!
You can do multi-dimensional arrays as well..
Here's the (sparse) docs we have for it:

Arrays are declared as follows:
  #declare <identifier> = array[ <size> ]
       examples:
          #declare my_array = array[ 25 ]
          #declare p12      = array[ array_size ]
Elements in an array are accessed and assigned as follows:
  #declare <identifier>[ <index ] = <blah blah blah>
       examples:
          #declare my_array[ 13 ] = my_sphere_object
          #declare p12[ idx ] = <13,y_var,zvals[idx]>
          #declare temp = my_array[ 14 ]
Arrays may be nested to create multi-dimensional arrays as well,
as follows:
  examples:
     #declare my_array[ 0 ] = array[ 10 ]
     #declare my_array[ 0 ][ 0 ] = 15
Note: to create such a multi-dimensional arrays, you must iteratively
create each level (see the arraytest2.pov file for an example of how
this might be done).
The size of an array may be accessed with the upper_bound function,
as follows:
  examples:
     #declare my_size = upper_bound( my_array )

Twyst================================
EFnet and NewNet #povray Channel Operator
Website: http://twyst.home.ml.org
E-Mail: twy### [at] v-wavecom
=====================================


Post a reply to this message

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