POV-Ray : Newsgroups : povray.advanced-users : ?? : Re: ?? Server Time
4 Nov 2024 19:21:44 EST (-0500)
  Re: ??  
From: Noah A
Date: 1 Jul 1999 16:45:47
Message: <377BD34C.E8E286F1@powersurfr.com>
thanks unky ken

Ken wrote:

> Noah A wrote:
> >
> > what is this array thing and how's it work?
>
> An array is a method of storing data and then later using that stored date
> within a function or operation. For example I could predefine a string of
> numbers that I want to pass to a pigment statment. I could use an array
> to store those string and then later use them in the following way:
>
> #declare Dnum = 6;
> #declare Data = array [Dnum][5]
> { {0.60, 0.50, 0.3, 0.1, 0.66},
>   {0.70, 0.13, 0.4, 0.3, 0.55},
>   {0.60, 0.17, 0.5, 0.2, 0.44},
>   {0.70, 0.25, 0.6, 0.4, 0.33},
>   {0.60, 0.31, 0.7, 0.6, 0.22},
>   {0.70, 0.50, 0.8, 0.5, 0.11}}
>
>  #declare I=0;
>   #while (I < Dnum)
> #declare Acid_Trip =
>  pigment {
>   rgbft < Data[I][0], Data[I][1], Data[I][3], Data[I][4], Data[I][5] >
>   }
>   #declare I =I + 1;
>  #end
>
>   I could also use similar data to translate an object to a fixed number
> of points in space like so:
>
> #declare Dnum = 6;
> #declare Data = array [Dnum][3]
> { {  10.60, -10.50,  10.3},
>   { -10.70,  10.13, -10.4},
>   {  10.60, -10.17,  10.5},
>   { -10.70,  10.25, -10.6},
>   {  10.60, -10.31,  10.7},
>   { -10.70,  10.50, -10.8}}
>
>  #declare I = 0;
>   #while (I < Dnum)
>     sphere { < Data[I][0], Data[I][1], Data[I][3] >, 1
>    }
>   #declare I = I + 1;
>  #end
>
>   The above example should produce six spheres located in space corrosponding
> to the numbers stored in the array.
>
>   There are many other possibilities with this function and I have only
> just begun to explore them myself. In fact it is quite possible that my
> syntax is wrong but the basic idea is correct.
>
> --
> Ken Tyler
>
> mailto://tylereng@pacbell.net


Post a reply to this message

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