# Polyhedron tube with irregular sides -- is it possible ?

112 messages
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Since the following code is accepted by CGAL pts =  [[0, 0], [6, 0], [6, 5], [0, 5], [0, 0], [2, 1], [5, 2], [3, 4], [2, 1]]; linear_extrude(2)   polygon(pts); cube(1); and obviously uses triangulation it shouldn't be too difficult to provide a built-in triangulate2D() function that uses clipper and returns a [verts, triags] list. vertsfaceslist = triangulate2D(pts);  // builtin call using clipper returning a [verts, triags] list // ... use vertsfaceslist the prototype could be: function triangulate2D(polygon, z=undef) = ... If provided z would add the given value as z coordinate to the verts (vec3 conversion) for intended polyhedron usage. Doesn't this sound like a nice feature request? -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Parkinbot <[hidden email]> wrote:it shouldn't be too difficult to provide a built-in triangulate2D() function that uses clipper and returns a [verts, triags] list. Clipper library doesn't have any polygon triangulation procedure. According to @Kintel, OpenScad uses a modified version of libtess2 to triangulate polygons (see http://forum.openscad.org/Simple-polygon-triangulation-tp16755p16762.html) and libtess2 is unable to deal with holes. I have found a polygon triangulation library supposedly robust and fast that accepts polygons with holes: poly2tri (https://doc-snapshots.qt.io/qt5-5.9/qtlocation-attribution-poly2tri.html) with a BSD 3 license clause. Is that license compatible with OpenScad GPL license? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 On 16.12.2018 18:08, Ronaldo Persiano wrote: > Parkinbot <[hidden email] > > wrote: > >     it shouldn't be too difficult to provide a built-in triangulate2D() >     function >     that uses clipper and returns a [verts, triags] list. > > > Clipper library doesn't have any polygon triangulation procedure. > According to @Kintel, OpenScad uses a modified version of libtess2 to > triangulate polygons (see > http://forum.openscad.org/Simple-polygon-triangulation-tp16755p16762.html) > and libtess2 is unable to deal with holes. I don't believe this statement is correct, in my experience libtess2 deals with holes quite well, at least for the cases I have seen. Do you have any examples showing it does not work with holes? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 nophead wrote > I don't think faces need to be tesselated for CGAL. but for polyhedron. And linear_extrude obviously uses a tesselation when it extrudes a polygon with hole. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 What makes you think that? It is definitely tesilated with F5But not with F6, unless it hides it better.On Sun, 16 Dec 2018 at 21:08, Parkinbot <[hidden email]> wrote:nophead wrote > I don't think faces need to be tesselated for CGAL. but for polyhedron. And linear_extrude obviously uses a tesselation when it extrudes a polygon with hole. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 On 2018-12-16 22:21, nop head wrote: > What makes you think that? It is definitely tesilated with F5 > > But not with F6, unless it hides it better. > Save it to STL or any other format requiring triangles. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Yes but I beleive CGAL objects get tesilated when they are converted to STL. The can have single facets that are pologons. They aren't triangle meshes.On Sun, 16 Dec 2018 at 21:27, <[hidden email]> wrote:On 2018-12-16 22:21, nop head wrote: > What makes you think that? It is definitely tesilated with F5 > > But not with F6, unless it hides it better. > Save it to STL or any other format requiring triangles. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Sorry nophead, I meant that I can see that F5 tessellates a polygon with holes for use with linear_extrude and we could use the underlying functionality to provide a function that tesselates a 2D polygon given as list.   Btw, I see a F5 tesselation but not a F6 tesselation for sphere(10); Maybe OpenSCAD just doesn't display it? -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Parkinbot wrote > Btw, I see a F5 tesselation but not a F6 tesselation for > > sphere(10); > > Maybe OpenSCAD just doesn't display it? It looks like it is only displayed when a boolean operation is involved translate([20, 0, 0]) cube(5); sphere(10); -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Ronaldo had noticed it some time ago that CGAL changes tesselation on its own will. I created a cube by means of sweep(). So I am sure that it is tesselated in triags. See how it is displayed by F6 with a unit cube unioned. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Looks like CGAL de-tesselates triangles in the same plane to make pologons. That makes it hard to know what the internal representation of anything is. It used to always be CGAL nef_polyhreda I think but now it switches back and forth to polysets. When the result is a polyset you don't get all the vertex / edge info and show edges does not work. Also I think it switches from rationals to doubles for the vertices.On Mon, 17 Dec 2018 at 00:19, Parkinbot <[hidden email]> wrote:Ronaldo had noticed it some time ago that CGAL changes tesselation on its own will. I created a cube by means of sweep(). So I am sure that it is tesselated in triags. See how it is displayed by F6 with a unit cube unioned. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Clearly, CGAL is only called when a Boolean operation is present. Thus the polyset to nef_polyhreda conversion is not necessary for primitives like a polyhedron and can't be displayed.   When CGAL is called, it seems to try to reduce faces. Nevertheless there is a tesselation of polygon with holes for F5 and this one could be exposed to the user. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 Yes but I don't think tessalation is the issue with polyhedron. The problem seems to be the interface to polyhedron has no way to express holes.It could detect faces that are coplanar with an encolsing face pass them through clipper to sort out the holes. Or it could allow the keyhole contruction, detect the loops and remove the extra edges between loops. So each face becomes a list of loops with counter clockwise ones being holes.Tessalation should only be needed when the faces are not planar.On Mon, 17 Dec 2018 at 00:54, Parkinbot <[hidden email]> wrote:Clearly, CGAL is only called when a Boolean operation is present. Thus the polyset to nef_polyhreda conversion is not necessary for primitives like a polyhedron and can't be displayed.  When CGAL is called, it seems to try to reduce faces. Nevertheless there is a tesselation of polygon with holes for F5 and this one could be exposed to the user. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Polyhedron tube with irregular sides -- is it possible ?

 If there is a tesselation, a sweep with more than one hole can be implemented. Wasn't this at least part the aim? -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org