discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Origami ship has Manifold problem

K
kitwallace
Sun, Apr 26, 2015 9:38 AM

The following script used in my origami ship
http://www.thingiverse.com/thing:753562 generates STL which RepetierHost
finds is not manifold - any ideas as to why?
/*  origami ship  Kit Wallace*/// length of bow from centrelb=15; //
height of bowhb=10;// width midshipswm=6; // height midshipshm=3; //
waterline length e.g. from centre eg. half length of bowwl=7.5; // width of
hull from centrewh=4; // height of sailh=15; //Thickness of
paperthickness=1;// sphere qualitysteps = 20;// overall scalescale=3;module
double(axis) {      union() {          children();          mirror(axis)
children();      }  }module plane(s,t=0.5) {    hull()    for (i=[0:len(s)
-1])      translate(s[i]) sphere(t/2);        }
p1=[lb,0,hb];p2=[wl,0,0];p3=[0,wm,hm];p5=[0,0,h];p4=[0,wh,0];module
ship_q(t) {  plane([p1,p2,p3],t);  plane([p2,p3,p4],t);
plane([p4,p2,p5],t);};$fn=steps;scale(scale)  difference() {
double([0,1,0])      double([1,0,0])          ship_q(thickness);  }

--
View this message in context: http://forum.openscad.org/Origami-ship-has-Manifold-problem-tp12491.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The following script used in my origami ship http://www.thingiverse.com/thing:753562 generates STL which RepetierHost finds is not manifold - any ideas as to why? /* origami ship Kit Wallace*/// length of bow from centrelb=15; // height of bowhb=10;// width midshipswm=6; // height midshipshm=3; // waterline length e.g. from centre eg. half length of bowwl=7.5; // width of hull from centrewh=4; // height of sailh=15; //Thickness of paperthickness=1;// sphere qualitysteps = 20;// overall scalescale=3;module double(axis) { union() { children(); mirror(axis) children(); } }module plane(s,t=0.5) { hull() for (i=[0:len(s) -1]) translate(s[i]) sphere(t/2); } p1=[lb,0,hb];p2=[wl,0,0];p3=[0,wm,hm];p5=[0,0,h];p4=[0,wh,0];module ship_q(t) { plane([p1,p2,p3],t); plane([p2,p3,p4],t); plane([p4,p2,p5],t);};$fn=steps;scale(scale) difference() { double([0,1,0]) double([1,0,0]) ship_q(thickness); } -- View this message in context: http://forum.openscad.org/Origami-ship-has-Manifold-problem-tp12491.html Sent from the OpenSCAD mailing list archive at Nabble.com.
K
kitwallace
Sun, Apr 26, 2015 10:10 AM

I think the problem boils down to unioned spheres at different angles
sphere(20);rotate([0,40,0]) sphere(20);

--
View this message in context: http://forum.openscad.org/Origami-ship-has-Manifold-problem-tp12491p12492.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I think the problem boils down to unioned spheres at different angles sphere(20);rotate([0,40,0]) sphere(20); -- View this message in context: http://forum.openscad.org/Origami-ship-has-Manifold-problem-tp12491p12492.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Sun, Apr 26, 2015 4:43 PM

If I render the unioned spheres script,

sphere(20);
rotate([0,40,0]) sphere(20);

then export as STL,
then import the STL into another model,

import("/Users/doug/spherebad.stl");

and render, then I get this error message:

Rendering Polygon Mesh using CGAL...

CGAL error in CGAL_Build_PolySet: CGAL ERROR: assertion violation!

Expr: check_protocoll == 0

File: /opt/local/include/CGAL/Polyhedron_incremental_builder_3.h

Line: 199

That's not good, right? OpenSCAD shouldn't write STL files that it can't
read.

On 26 April 2015 at 06:10, kitwallace kit.wallace@gmail.com wrote:

I think the problem boils down to unioned spheres at different angles

sphere(20);
rotate([0,40,0]) sphere(20);


View this message in context: Re: Origami ship has Manifold problem
http://forum.openscad.org/Origami-ship-has-Manifold-problem-tp12491p12492.html

Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.


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

If I render the unioned spheres script, sphere(20); rotate([0,40,0]) sphere(20); then export as STL, then import the STL into another model, import("/Users/doug/spherebad.stl"); and render, then I get this error message: Rendering Polygon Mesh using CGAL... CGAL error in CGAL_Build_PolySet: CGAL ERROR: assertion violation! Expr: check_protocoll == 0 File: /opt/local/include/CGAL/Polyhedron_incremental_builder_3.h Line: 199 That's not good, right? OpenSCAD shouldn't write STL files that it can't read. On 26 April 2015 at 06:10, kitwallace <kit.wallace@gmail.com> wrote: > I think the problem boils down to unioned spheres at different angles > > sphere(20); > rotate([0,40,0]) sphere(20); > > > ------------------------------ > View this message in context: Re: Origami ship has Manifold problem > <http://forum.openscad.org/Origami-ship-has-Manifold-problem-tp12491p12492.html> > > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> > at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
MK
Marius Kintel
Sun, Apr 26, 2015 8:44 PM

On Apr 26, 2015, at 06:10 AM, kitwallace kit.wallace@gmail.com wrote:

I think the problem boils down to unioned spheres at different angles
sphere(20);
rotate([0,40,0]) sphere(20);

The problem is that CGAL uses infinite precision when calculating unions. When converting back to floating point, some vertices get collapsed. Such collapsing may affect topology, and in this case it collapses a very small volume into a plane, similar to this: https://github.com/openscad/openscad/issues/1042#issuecomment-70279505

This breaks the manifoldness pre-condition for reading files back into CGAL (thus breaking import) and it trips manifold checks in external software.

To fix this we should post-process CGAL results to fix degenerate cases, or better; use a different CSG library.

-Marius

On Apr 26, 2015, at 06:10 AM, kitwallace <kit.wallace@gmail.com> wrote: > I think the problem boils down to unioned spheres at different angles > sphere(20); > rotate([0,40,0]) sphere(20); > The problem is that CGAL uses infinite precision when calculating unions. When converting back to floating point, some vertices get collapsed. Such collapsing may affect topology, and in this case it collapses a very small volume into a plane, similar to this: https://github.com/openscad/openscad/issues/1042#issuecomment-70279505 This breaks the manifoldness pre-condition for reading files back into CGAL (thus breaking import) and it trips manifold checks in external software. To fix this we should post-process CGAL results to fix degenerate cases, or better; use a different CSG library. -Marius