POV-Ray : Newsgroups : povray.general : Reading mesh2 data from file Server Time
19 Apr 2024 08:43:54 EDT (-0400)
  Reading mesh2 data from file (Message 11 to 11 of 11)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: jr
Subject: Re: Reading mesh2 data from file
Date: 5 Jul 2021 06:40:00
Message: <web.60e2e029c54a2bf05e0fed26cde94f1@news.povray.org>
hi,

"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".


regards, jr.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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