discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

How to scale to fit dimensions (or get dimensions of object)?

NH
nop head
Tue, Aug 16, 2016 7:59 PM

The problem is that boolean operations like union and intersection are not
closed on the set of 3D manifolds. I.e.given two manifold objects the
results is not always a manifold object. CGAL can represent things like
infinitely thin slivers with no volume and operate on them. They are no
good for making STL files though and OpenScad can't import from a
non-manifold STL.

The intersection of two non overlapping volumes is empty. The intersection
of two volumes that share some 3D volume is a manifold object but if they
share just an edge or a single surface then it is a non manifold result
which is not empty.

On 16 August 2016 at 16:15, DIRO roys@iro.umontreal.ca wrote:

Hi!,
Le 2016-08-16 à 10:25, nop head a écrit :

Both mathematically define an infinitely thin shape, so it is not
surprising it is non manifold. What do you expect the result to be?

The result should be empty.
The whole point of openscad is generating valid 3D solids. Any shape with
0 volume is essentially 2d, not 3d, and should be removed.  Here is one
such invalid shape (use F6):

translate([1,0,0]) cube([1,1,2]);
intersection() {
translate([0,0,1]) cube();
cube();
}

By the way, if you import this stl into openscad, it will fail to render
(with F6), as openscad considers it invalid (as it should).

Sebastien

On 16 August 2016 at 14:20, DIRO roys@iro.umontreal.ca wrote:

Hi everyone,

When I run this code (with F6), I get an stl with an empty flat square,
which is not a valid volume...

Can anyone confirm this on some other version of Openscad? (I am 42
commits behind current master version)

intersection() {
translate([0,0,1]) cube();
cube();
}

The problem is that boolean operations like union and intersection are not closed on the set of 3D manifolds. I.e.given two manifold objects the results is not always a manifold object. CGAL can represent things like infinitely thin slivers with no volume and operate on them. They are no good for making STL files though and OpenScad can't import from a non-manifold STL. The intersection of two non overlapping volumes is empty. The intersection of two volumes that share some 3D volume is a manifold object but if they share just an edge or a single surface then it is a non manifold result which is not empty. On 16 August 2016 at 16:15, DIRO <roys@iro.umontreal.ca> wrote: > Hi!, > Le 2016-08-16 à 10:25, nop head a écrit : > > Both mathematically define an infinitely thin shape, so it is not > surprising it is non manifold. What do you expect the result to be? > > The result should be empty. > The whole point of openscad is generating valid 3D solids. Any shape with > 0 volume is essentially 2d, not 3d, and should be removed. Here is one > such invalid shape (use F6): > > translate([1,0,0]) cube([1,1,2]); > intersection() { > translate([0,0,1]) cube(); > cube(); > } > > > > By the way, if you import this stl into openscad, it will fail to render > (with F6), as openscad considers it invalid (as it should). > > Sebastien > > > On 16 August 2016 at 14:20, DIRO <roys@iro.umontreal.ca> wrote: > >> Hi everyone, >> >> When I run this code (with F6), I get an stl with an empty flat square, >> which is not a valid volume... >> >> Can anyone confirm this on some other version of Openscad? (I am 42 >> commits behind current master version) >> >> intersection() { >> translate([0,0,1]) cube(); >> cube(); >> } >> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
D
DIRO
Tue, Aug 16, 2016 10:10 PM

Le 2016-08-16 à 15:59, nop head a écrit :

The problem is that boolean operations like union and intersection are
not closed on the set of 3D manifolds. I.e.given two manifold objects
the results is not always a manifold object. CGAL can represent things
like infinitely thin slivers with no volume and operate on them. They
are no good for making STL files though and OpenScad can't import from
a non-manifold STL.

The intersection of two non overlapping volumes is empty. The
intersection of two volumes that share some 3D volume is a manifold
object but if they share just an edge or a single surface then it is a
non manifold result which is not empty.

You are right, but a non manifold geometry can be "regularized"  to a
3-manifold (see http://doc.cgal.org/latest/Nef_3/index.html#title3 ). It
is done by computing the boundary of the interior... (closure(),
interior(), regularization() ).
If openscad was using regularization after boolean operations, it would
output 3-manifolds that are printable, and would be able to import its
own stl without probem.
Anyway I tried to add regularization() and it works. So is there any
reason I missed why openscad doesn't regularize?

Sebastien

On 16 August 2016 at 16:15, DIRO <roys@iro.umontreal.ca
mailto:roys@iro.umontreal.ca> wrote:

 Hi!,

 Le 2016-08-16 à 10:25, nop head a écrit :
 Both mathematically define an infinitely thin shape, so it is not
 surprising it is non manifold. What do you expect the result to be?
 The result should be empty.
 The whole point of openscad is generating valid 3D solids. Any
 shape with 0 volume is essentially 2d, not 3d, and should be
 removed.  Here is one such invalid shape (use F6):

 translate([1,0,0]) cube([1,1,2]);
 intersection() {
     translate([0,0,1]) cube();
     cube();
 }
Le 2016-08-16 à 15:59, nop head a écrit : > The problem is that boolean operations like union and intersection are > not closed on the set of 3D manifolds. I.e.given two manifold objects > the results is not always a manifold object. CGAL can represent things > like infinitely thin slivers with no volume and operate on them. They > are no good for making STL files though and OpenScad can't import from > a non-manifold STL. > > The intersection of two non overlapping volumes is empty. The > intersection of two volumes that share some 3D volume is a manifold > object but if they share just an edge or a single surface then it is a > non manifold result which is not empty. You are right, but a non manifold geometry can be "regularized" to a 3-manifold (see http://doc.cgal.org/latest/Nef_3/index.html#title3 ). It is done by computing the boundary of the interior... (closure(), interior(), regularization() ). If openscad was using regularization after boolean operations, it would output 3-manifolds that are printable, and would be able to import its own stl without probem. Anyway I tried to add regularization() and it works. So is there any reason I missed why openscad doesn't regularize? Sebastien > > On 16 August 2016 at 16:15, DIRO <roys@iro.umontreal.ca > <mailto:roys@iro.umontreal.ca>> wrote: > > Hi!, > > Le 2016-08-16 à 10:25, nop head a écrit : >> Both mathematically define an infinitely thin shape, so it is not >> surprising it is non manifold. What do you expect the result to be? > The result should be empty. > The whole point of openscad is generating valid 3D solids. Any > shape with 0 volume is essentially 2d, not 3d, and should be > removed. Here is one such invalid shape (use F6): > > translate([1,0,0]) cube([1,1,2]); > intersection() { > translate([0,0,1]) cube(); > cube(); > } > >
TP
Torsten Paul
Wed, Aug 17, 2016 10:53 AM

You are right, but a non manifold geometry can be "regularized"
 to a 3-manifold.

I'm not sure that helps a lot. Making a wrong model technically
correct does not fix the core issue, or maybe I just misunderstand
what it's doing in detail.
What's the result for the example with that thin plane?

If openscad was using regularization after boolean operations,
it would output 3-manifolds that are printable, and would be
able to import its own stl without probem.

The main issue when importing STLs is zero-faces that are
currently not handled well as the face orientation is not defined.
Would that also be solved?

ciao,
Torsten.

Von: DIRO <roys@iro.umontreal.ca> > You are right, but a non manifold geometry can be "regularized" > to a 3-manifold. > I'm not sure that helps a lot. Making a wrong model technically correct does not fix the core issue, or maybe I just misunderstand what it's doing in detail. What's the result for the example with that thin plane? > If openscad was using regularization after boolean operations, > it would output 3-manifolds that are printable, and would be > able to import its own stl without probem. > The main issue when importing STLs is zero-faces that are currently not handled well as the face orientation is not defined. Would that also be solved? ciao, Torsten.
NH
nop head
Wed, Aug 17, 2016 11:20 AM

I think regularization would remove the zero volume entities, so the
resulting solids could be saved to STL and re-imported succesfully. They
don't match what the source code describes though.

On 17 August 2016 at 11:53, Torsten Paul Torsten.Paul@gmx.de wrote:

You are right, but a non manifold geometry can be "regularized"
to a 3-manifold.

I'm not sure that helps a lot. Making a wrong model technically
correct does not fix the core issue, or maybe I just misunderstand
what it's doing in detail.
What's the result for the example with that thin plane?

If openscad was using regularization after boolean operations,
it would output 3-manifolds that are printable, and would be
able to import its own stl without probem.

The main issue when importing STLs is zero-faces that are
currently not handled well as the face orientation is not defined.
Would that also be solved?

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I think regularization would remove the zero volume entities, so the resulting solids could be saved to STL and re-imported succesfully. They don't match what the source code describes though. On 17 August 2016 at 11:53, Torsten Paul <Torsten.Paul@gmx.de> wrote: > Von: DIRO <roys@iro.umontreal.ca> > > You are right, but a non manifold geometry can be "regularized" > > to a 3-manifold. > > > I'm not sure that helps a lot. Making a wrong model technically > correct does not fix the core issue, or maybe I just misunderstand > what it's doing in detail. > What's the result for the example with that thin plane? > > > If openscad was using regularization after boolean operations, > > it would output 3-manifolds that are printable, and would be > > able to import its own stl without probem. > > > The main issue when importing STLs is zero-faces that are > currently not handled well as the face orientation is not defined. > Would that also be solved? > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Wed, Aug 17, 2016 1:05 PM

Von: "nop head" nop.head@gmail.com

I think regularization would remove the zero volume entities,
so the resulting solids could be saved to STL and re-imported
succesfully. They don't match what the source code describes
though. 

Hmm, might be worth a try then, maybe as optional experimental
feature. Just running every model forcibly though a new CGAL
functions sounds a bit scary.

ciao,
Torsten.

Von: "nop head" <nop.head@gmail.com> > I think regularization would remove the zero volume entities, > so the resulting solids could be saved to STL and re-imported > succesfully. They don't match what the source code describes > though.  > Hmm, might be worth a try then, maybe as optional experimental feature. Just running every model forcibly though a new CGAL functions sounds a bit scary. ciao, Torsten.
NH
nop head
Wed, Aug 17, 2016 5:06 PM

Perhaps only regularize when cgal says simple is no

On Aug 17, 2016 2:06 PM, "Torsten Paul" Torsten.Paul@gmx.de wrote:

Von: "nop head" nop.head@gmail.com

I think regularization would remove the zero volume entities,
so the resulting solids could be saved to STL and re-imported
succesfully. They don't match what the source code describes
though.

Hmm, might be worth a try then, maybe as optional experimental
feature. Just running every model forcibly though a new CGAL
functions sounds a bit scary.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Perhaps only regularize when cgal says simple is no On Aug 17, 2016 2:06 PM, "Torsten Paul" <Torsten.Paul@gmx.de> wrote: > Von: "nop head" <nop.head@gmail.com> > > > I think regularization would remove the zero volume entities, > > so the resulting solids could be saved to STL and re-imported > > succesfully. They don't match what the source code describes > > though. > > > Hmm, might be worth a try then, maybe as optional experimental > feature. Just running every model forcibly though a new CGAL > functions sounds a bit scary. > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >