"Kima" <nomail@nomail> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> Thanks for sharing your script. It's quite sophisticated. Mine is messy :)
don't they all, always, start "messy"?! :-)
> For two reasons, I directly use fprintf():
> 1. The mesh may get large, and surely I will have stack overflow. Thus, I have
> to allocate the memory dynamically to keep all the data in memory. The memory
> footprint is trivial for the modern machines, but I considered to be safer to
> directly write them to the files.
> 2. When saving the data in raw forms (vectors), I can easily create other mesh
> formats from the separate files. It is unlikely, as I only use POV-Ray, but it's
> not a bad idea to keep the system flexible for future expansion.
I think your second point very important to bear in mind, always.
regarding the first, agree, memory storage is not going to be a concern. I also
appreciate the "hassle" aspect wrt managing (de-)allocation. sometimes one can
find a "tool for the job" in a library already installed on the system. if you
don't mind making your code depend on a library (shouldn't be a problem for
"personal" code), then, for instance, the 'glib' has an useful sounding 'GArray'
type which quote "Arrays are similar to standard C arrays, except that they grow
automatically as elements are added".
Post a reply to this message