POV-Ray : Newsgroups : povray.general : comma separated value file for data input : Re: comma separated value file for data input Server Time
8 May 2024 18:35:16 EDT (-0400)
  Re: comma separated value file for data input  
From: Warp
Date: 10 Feb 2007 09:09:42
Message: <45cdd225@news.povray.org>
Grassblade <nomail@nomail> wrote:
> Nifty! But it seems you have to know beforehand the number of data to be
> read, is there some way to have something similar to dimension_size?

  It's naturally impossible to know the amount of numbers in the input
file before the file has been parsed.
  There are two possible solutions:

  If you can make the program which creates the data file to store the
amount of values as the first value, that would be the easiest way of
automatically getting this value in the pov file.

  If that's just not possible, then you can simulate dynamic arrays in
povray by first creating an array of certain size, reading data into it,
and if it fills up, create a bigger array, copy the data from the old one
to this new one, and then continue reading values, and so on. In the end,
if an exact array (without unused values at the end) is needed, you can
create an array of that exact size and copy the data there.

-- 
                                                          - Warp


Post a reply to this message

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