[OpenSCAD] Improve rendering speed

Parkinbot rudolf at parkinbot.com
Wed Jun 8 05:00:48 EDT 2016

I've played around with this approach for a while
and connected it with some interpolation scheme
into a very general solution. 

Also this works astoundingly well, the solution completely ignores the
wicked self intersection problem, by leaving all burden to the user. It
executes amazingly fast for the price that it can not be formalized into a
general pattern without a lot of effort (also in time).

The implementation you show, could indeed find its way into the language
e.g. in the sense of a more flexible linear_extrude() taking a vector of
polygons plus a height for equi-distantanly or even a height vector for
freely Z-extruding along the polygon shapes. Also this is a linear scenario
the operator will have to fight with well-definedness of the polygon
1. each polygon has to be tested to be simple
2. the sequence has to be tested for self-intersection which is not trivial.
I guess, you will have to 
restrict the (simple) polygons to be convex, which is a strong restriction
and even then you will have to employ some intelligent scheme for
triangulation between the layers (see skin()). 

In my eyes, a first generalization step for language integration could be to
allow for a linear_extrude() with a height or/and a scale vector (or a
user-defined function) describing the Z coordinates and the scale of the
slices. Maybe also twisting could be done this way. 

Any *bending or rotation* will introduce non-linearity and a hole bunch of
self-intersection issues. 

Another much easier approach could be an operator that just piles a set of
3D-shapes on top (or aside) of each other using the first one (or z=0)  as
base. This will avoid the intersection and union problem by definition and
all knitting can be done before entering CGAL. See this example (which is
kept in 2D, because z-coordinate of a 3D shape cannot be quested in current
OpenSCAD to grand for non-interscection).

> Z_pile(100)
> {
>   square(10, center = true);
>   square(20, center = true);
>   square(30, center = true);
>   square(10, center = true);
> }
> module Z_pile(h = 100)
> {
>   echo($children); 
>   dh = h/$children; 
>  for(i=[0:$children-1])
>    translate([0, 0, i*dh])
>    linear_extrude(height = dh)
>     children(i); 
> }


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

More information about the Discuss mailing list