POV-Ray : Newsgroups : povray.general : Impossible stl file conversion! : Re: Impossible stl file conversion! Server Time
15 Sep 2025 08:10:52 EDT (-0400)
  Re: Impossible stl file conversion!  
From: Bald Eagle
Date: 10 Sep 2025 11:00:00
Message: <web.68c191b4a068c28cbe3debd925979125@news.povray.org>
"ingo" <nomail@nomail> wrote:

Yeah, sorry, I'm kinda thinking one thing and typing another.
I'm using too many systems at once and hopping between them all in rapid
succession.

> An annoyance of STL is that the number of faces is not given beforehand. Makes
> declaring arrays hard or one has to do a two pass run and count faces.

But we no longer have to declare the size of an array in SDL when constructing
one, unless it's a multidimensional array.

And I'm really talking about somehow doing this in the same way that we use
image_maps.  So we'd be doing this under the hood in c++.

So the thought process is actually more that what we feed the parser through SDL
when we make a mesh {} is nearly identical to the data structure of the ASCII
stl.  And so therefor it ought to be easy to bypass converting to SDL and just
read the triangle vertices in directly from the stl file.

So, I guess it would actually be

#declare MyObject = stl {"MyObject.stl"}

Now, whether or not we create a new keyword, or spruce up the mesh {} keyword to
allow something like  #declare MyObject = mesh {stl "MyObject.stl"} is something
that would be a decision for someone with more development experience than I.

Another idea is to code the conversion script into source - because it would be
nice to convert stl to mesh and save it as a file.  And convert both mesh {} and
stl to mesh2 {}.  And to have an array automatically populated with the triangle
vertices if desired.
(I'd also like to see a similar mechanism to populate an array with rgb data
from an image map and other related finction & pigment data)

So, I can envision both:
#declare MyObject = mesh {stl "MyObject.stl" make_array MyArray}
and
#declare MyObject = mesh2 {stl "MyObject.stl" make_arrays ...}
where there would some mechanism to specify what arrays for vertices, faces, and
normals would exist.

> A conversion script in a scripting lang is the way out.

I mean, yeah - I just hate all the extra steps, and the generation of a whole
new file that takes up space next to the original stl.

#read could probably use some fixing, and we all are intimately familiar with
the long-standing need to have some sort of data-typing mechanism.

- BW


Post a reply to this message

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