# Re: [rp-ml] STL files

Date: Thu Dec 07 2006 - 02:15:19 EET

Quoting Caleb at Chinook Sailing Products <purchasing@chinooksailing.com>:

> "Yes - because they can't force the modelling of real solids! That is,
> they are not true solid modellers. So it's not surprising that they
> can't create a solid (except by luck) if they don't know what one is..."
>
>
> ...just to clarify: Are there REALLY any true solid modellers? My
> understanding has been that most - if not all "solid" modellers are just
> surface modellers which hide the underlying math from the user by applying a
> "solid" modelling interface paradigm..... no?

Well, there are a few completely CSG systems out there. But I suspect
that it's actually impossible to write a guaranteed bug-free solid
modeller (B-rep or CSG) in any machine that's Turing equivalent. (For
a discussion on one aspect of this see my piece in response to a user
query on the RepRap wiki at:

Most people who know what they are doing can crash any commercial CAD
system in fairly short order by giving it a piece of ill-conditioned
geometry to solve.

But the CAD systems all at least try to hack the more obvious and
well-understood problems, and they all implement solutions where there
are known (and often quite simple) answers. For the purpose of this
discussion that just means making a straightforward topological model
with the needed geometric data linked in, rather than trying to infer
the topology from floating point geometry with no structure.

If the file is always going to be triangles, then you store the genus
of the object, a list of vertex coordinates, then a list of triangles,
each one of which has six entries (in a cyclic order to define the
outward-pointing surface normal); the first three are the vertices of
the triangle, and the second three are the three other triangles across
each edge opposite the corresponding vertex.

You can move about that structure without doing any global searching,
and check it for topological solidity just from the triangle list and
genus (all integers), completely ignoring the vertex coordinates. The
only thing that can be wrong with it is if it self-intersects, which
does require the coordinates to be interrogated to check, and reduces
to the simple question, "Do any two triangles cut each other?"

Yours