[OpenSCAD] Improve rendering speed

Ronaldo rcmpersiano at gmail.com
Thu Jun 9 11:00:50 EDT 2016

wolf wrote
> Self-intersection is not a problem for me, as I design by eye, and my eye
> will pick up any funny shapes immediately. Whether self-intersection is a
> problem with CGAL remains to be seen, as at some stage I will have to try
> to design a Klein bottle in OpenSCAD. If CGAL is true to its mathematical
> roots, then I do not foresee any problem in constructing the bottle, nor
> do I foresee restrictions regarding convex or concave slices. 

Wolf, change the first three lines of your code to:

> // Start user definable data
> $fn=100;
> Slices=200;
> SliceAngle=[for( i=[0:1:Slices-1]) 6.6*i];//1.8*i];         // angle by
> which each slice is tilted

and you get self-intersection (SI). It renders fine and fast. However, you
may get a CGAL warning that "PolySet has degenerate polygons". But if you
also change the last line to:

> intersection(){
>     polyhedron(VertexList,FacesList);
>     cube(100);
> }

you get in trouble. To find what caused the trouble may be a greater

> Were you aware of the gains in rendering speed that are achieved using
> this
> approach over the more conventional approach of using unions() or hulls()?
> Or that the faces list can be computer generated and need not be provided
> by
> the user?

Your slice approach to the spring modelling is the same of Oskar Linde's
sweep that encloses all the face list computations. A more general
construction is his skin that do the same. I have been using a similar more
general approach to model solids enclosed by Bezier surfaces and "almost"
planar faces. All face lists computation are inside a general module that
process the user meshes. It works provided that the surface patches created
by the user meet at boundaries and define a manifold. And that they have no
SI! So, a lot of care is left to user.

However, I don't see any approach that effectively avoid non-manifolds
created by users. With OpenSCAD union, you may build a non-manifold with two
cubes having only one vertex in common. Or intersecting to cubes with just
one face in common. But I agree that those are simpler to understand and
avoidable than other cases.

The only approach I know that deals well and naturally with SI is f-rep
(implicit representation). If carefully implemented it may "makeup" all
model singulaties.

View this message in context: http://forum.openscad.org/Improve-rendering-speed-tp17580p17617.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

More information about the Discuss mailing list