POV-Ray : Newsgroups : povray.general : Types of datas in array : Re: Types of datas in array Server Time
25 Apr 2024 15:17:17 EDT (-0400)
  Re: Types of datas in array  
From: clipka
Date: 23 Sep 2018 08:44:55
Message: <5ba78ac7$1@news.povray.org>
Am 23.09.2018 um 11:02 schrieb kurtz le pirate:
> Hi,
> 
> I have declared this simple array :
>   #declare MyArray  = array[n][3];
> 
> Then, i put some value on it :
> 
>   #declare MyArray[i][0] = 1.23456; float is OK
>   #declare MyArray[i][1] = int(rand(alea)); integer is OK
>   #declare MyArray[i][2] = rgb <a,b,c>; color not accepted.
>                                         float
required.
> 
> So, *all* the elements of the array must be of the *same type* ?
> By design ?

Yes; the reason probably being that (a) that's how arrays worked in most
programming languages (and still does in a lot) when arrays were added
to POV-Ray, and (b) it allows to keep the memory overhead to a minimum
(which was important back in the days).


In v3.8.0, this restriction /should/ have been lifted, as I had
implemented support for mixed-type arrays in late 2016. And the code to
/handle/ mixed-type arrays is in there alright. Weirdly enough, and as
I'm noticing only right now, the code to actually /create/ mixed-type
arrays seems to never have made it into the repository.


Post a reply to this message

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