|
![](/i/fill.gif) |
I wouldn't really call this a dynamic array.
For example, I recently created a macro that sampled an object (with
Superpatch) and stored the resulting points in an array. Since changing
the fineness of sampling and the sampled object varied the point count
substantially, but unpredictably, I could not easily choose a good
relationship between any sampling parameter and initial array size.
I would have to check constantly if the array has been filled; if it
has, I would have to do the array resize you described. Since I don't
know how many more points are generated, how large would the resizing
be? I would either have to add a very large chunk and consume a lot of
memory - or add a smaller chunk, potentially requiring many more (slow)
resizings.
The bottom line is: it's possible, yes, but rather inflexible.
Margus
Nieminen Mika wrote:
>
> I think it's perfectly possible to make dynamic arrays with pov language.
> In pseudocode something like this:
>
> // want to convert an array A with dimensions [2][3] to dimensions [4][5]
> copy the array A to a temporary array B
> undefine A
> declare A as an array of [4][5]
> copy the contents of array B to array A (#while-loops etc...)
> undefine B
>
> A resize_array()-macro should be quite easy to make this way...
>
> It's slow, I know, but at least it's not impossible.
>
> --
> main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
> *_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/
Post a reply to this message
|
![](/i/fill.gif) |