Em ter, 7 de ago de 2018 12:27, Carsten wrote:
I used a different approach in my own code (not openSCAD), realising
that any convex polyhedron can be defined from just an array of vertex
coordinates.
A similar approach in OpenSCAD language might be:
module octahedron(r=1) {
verts = [ [r,0,0], [0,r,0], [-r,0,0],
[0, -r,0], [0,0,r], [0,0,-r] ] ;
hull( polyhedron(verts, [0,1,2,3,4,5]) );
}
Yes, you can do it this way, although it is "cheating" as it relies on
the OpenSCAD discretization of a cylinder instead of defining the
polyhedron explicitly. It is more compact, but less readable.
I agree on the readability, but I wouldn't consider it cheating. It's a well
defined behaviour, it's not just some random effect of how it currently
works.
--
Sent from: http://forum.openscad.org/
On 2018-08-09 07:50, Troberg wrote:
Yes, you can do it this way, although it is "cheating" as it relies on
the OpenSCAD discretization of a cylinder instead of defining the
polyhedron explicitly. It is more compact, but less readable.
I agree on the readability, but I wouldn't consider it cheating. It's a
well
defined behaviour, it's not just some random effect of how it currently
works.
That is why is said "cheating" (with quotes). It relies on
implementation details such as the discretization of a cylinder (or a
cone rather) plus it also relies on implicit union of 2 such objects.
Granted, this is well known current OpenSCAD behavior, but still.
It is also a special case that works only for creating an octahedron. If
you wanted a different kind of convex polyhedron you would be out of
luck with this approach.
But for sure it solved the original problem as presented.
Carsten Arnholm