POV-Ray : Newsgroups : povray.general : Dynamic arrays : Re: Dynamic arrays Server Time
13 Aug 2024 01:21:58 EDT (-0400)
  Re: Dynamic arrays  
From: Wayne Gordon
Date: 10 Dec 1998 01:14:49
Message: <366F690A.5BED@phoenix.net>
Margus Ramst wrote:
> 
> 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

I'd suggest an array of subarrays each of which would have a definite
predetermined size, but you'd still not know how many subarrays it would
take, so you're back to square one. Could you write all your samples to
a file and then be able to retrieve element [a] [b] by reading the Nth
value from the file by something like N = a x b?

Just an idea....


Post a reply to this message

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