[OpenSCAD] Unusual hull() and minkowski modelling

Parkinbot rudolf at parkinbot.com
Sat Jun 18 21:49:08 EDT 2016


Ronaldo 

As a programmer, I wouldn't call all that a 'trick'. It's a full-grown
backdoor, and in its implication it is quite similar to the C-style loop,
which unwillingly imports imperative style programming into OpenSCAD. The
only difference: Those defective objects currently tend to destabilize the
system. See it as a bug or a feature, there has to be found a solution, how
to treat that door. One can close it with just a bunch of extra checks. Or
one can open it, and will change the language - to the positive I admit -
but at what price, and of what gain. It will be a lot, a lot, of work, to
implement that seamlessly. Will people start printing dots and lines then?
Or write their own slicers or even draw cartoons?

Let me remind you that this would mean for instance to release 2D shapes
into 3D, which I proposed some time ago in another thread. I remember the
restrained reaction. 
The interface between 2D and 3D for now is linear_extrude(),
rotate_extrude(), and projection(). Did I forget something? Polygon and
Polyhedron are constructors interfacing between vectors of points and
solids. A polygon is always closed into 2D. A polyhedron may be ... anything
(see below).  That's it. 
Boolean operations as well as hull and minkowski() are defined for both
worlds, but currently not meant to process a mixture of both types of
operands.

Others will know better than me, how the extra dimensions will/can fit into
OpenSCAD2. 

We are talking about backdoors. There seems a much more stable, built-in
constructor for all this things - which obviously refuses to work with
minkowski, but hull() seems to be its friend. 

@Marius: While this crashes OpenSCAD 

> minkowski(){  cube();   polyhedron([[0, 0, 12]], [[0]]);   cube(); }

hull() does all you want. Here is your drop:

> hull(){  polyhedron(points = [[0, 0, 12]], faces = [[0]]);   sphere(5); }

here a double drop

> hull(){  polyhedron(points = [[0, 0, 12], [0, 0, -12]], faces = [[0, 1]]);  
> sphere(5); }

and here is your world: 

> hull(){  polygon3D(10*[[0, 0, 1], [1, 0, 0], [0, 1, 0], [0, 0, 0]]); }
> 
> module point(p) polyhedron(points = [p], faces = [[0]]);   
> module line(p1, p2) polyhedron(points = [p1, p2], faces = [[0], [1]]);   
> module face(p1, p2, p3) polyhedron(points = [p1, p2, p3], faces = [[0],
> [1], [2]]);   
> module polygon3D(P) polyhedron(points = P, faces = [for(i=[0:len(P)-1])
> [i]]);   

can also do it with points,

> hull() {   point([0, 0, 10]);   point([10, 0, 0]);   point([0, 10, 0]);  
> point([0, 0, 0]); }

or with lines

> hull() {  line([0, 0, 10], [10, 0, 0]);   line([0, 10, 0], [0, 0, 0]);  }

and this is your triple drop, e.g. by use of face()

> hull() {  face([0, 0, 10], [10, 0, 0], [0, 10, 0]);   sphere(4, $fn=100);
> }

<http://forum.openscad.org/file/n17760/tirple.png> 

To sum it up: To be able to hull a couple of points into a (convex) solid,
is very charming, and extremly useful for design. 

Rudolf




--
View this message in context: http://forum.openscad.org/Unusual-hull-and-minkowski-modelling-tp17730p17760.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list