|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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 ?
regards
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 23/09/2018 à 11:02, kurtz le pirate a écrit :
> 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. But you have an array of array here.
#declare MyArray = array[3][n];
and you can have it your way.
#declare MyArray[0][i] = 1.23456;
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|