discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Polyhedron tube with irregular sides -- is it possible ?

NH
nop head
Thu, Dec 13, 2018 1:36 PM

The 2D subsystem uses clipper, which is very good at sorting out self
intersections, etc. CGALseems to be the opposite. It just rejects all
non-manifold faces rather than attempting to heal them. However the 2D
problem is simpler. Normally you just reverse the winding order to make
holes or use the odd even rule.

Perhaps when the polyhedron face is considered planar clipper could be used
to clean it up.

On Thu, 13 Dec 2018 at 11:58, Ronaldo Persiano rcmpersiano@gmail.com
wrote:

You are right: it doesn't work. I created that section based on the
examples of 2D polygons with holes. I had checked it then with F6 but had
not done a full check with a cube union. Sorry by that.

What is strange (or inconsistent) is that 2D polygons with holes render
fine even with a full check.

I have deleted the section from the manual. It can be retrieved from the
wiki history anyway.

Ronaldo

Em seg, 10 de dez de 2018 às 20:14, runsun runsun@gmail.com escreveu:

The 2D subsystem uses clipper, which is very good at sorting out self intersections, etc. CGALseems to be the opposite. It just rejects all non-manifold faces rather than attempting to heal them. However the 2D problem is simpler. Normally you just reverse the winding order to make holes or use the odd even rule. Perhaps when the polyhedron face is considered planar clipper could be used to clean it up. On Thu, 13 Dec 2018 at 11:58, Ronaldo Persiano <rcmpersiano@gmail.com> wrote: > You are right: it doesn't work. I created that section based on the > examples of 2D polygons with holes. I had checked it then with F6 but had > not done a full check with a cube union. Sorry by that. > > What is strange (or inconsistent) is that 2D polygons with holes render > fine even with a full check. > > I have deleted the section from the manual. It can be retrieved from the > wiki history anyway. > > Ronaldo > > Em seg, 10 de dez de 2018 às 20:14, runsun <runsun@gmail.com> escreveu: > >> Just applied the union rendering check on the alternative face >> description >> <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Alternate_Face_Descriptions> >> described in the documentation and found it failed the same way. >> >> nophead wrote >> It's happy to preview but doesn't work with a union with a unit cube and >> F6. >> >> $ <http://forum.openscad.org/mailing_list/MailingListOptions.jtp?forum=1> *Runsun >> Pan, PhD* >> $ *libs*: scadx <https://bitbucket.org/runsun/scadx>, doctest >> <https://github.com/runsun/openscad_doctest>, faces >> <http://forum.openscad.org/A-faces-function-for-simple-polyhedrons-td12809.html> >> (git <https://github.com/runsun/faces.scad>), offline doc >> <http://forum.openscad.org/Use-openscad-offliner-for-offline-documentation-td13096.html> >> (git <https://github.com/runsun/openscad_offliner>), runscad.py >> <http://forum.openscad.org/Animating-gif-with-3D-rotation-tp14011p14029.html> >> (2 <http://forum.openscad.org/Symmetrical-Rotation-tp14062p14075.html>, >> git <https://gist.github.com/runsun/995250a8002386ab9abc>), editor of >> choice: CudaText >> <http://forum.openscad.org/Syntax-highlighting-tp23247p23258.html> ( OpenSCAD >> lexer <http://www.thingiverse.com/thing:1237864>); $ Tips >> <https://github.com/runsun/OpenSCAD_Tips>; $ Snippets >> <https://github.com/runsun/OpenSCAD_Tips/blob/master/snippets.md> >> >> ------------------------------ >> Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> >> at Nabble.com. >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
P
Parkinbot
Fri, Dec 14, 2018 12:58 PM

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

http://forum.openscad.org/file/t887/hole.png

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/

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 <http://forum.openscad.org/file/t887/hole.png> 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/
RP
Ronaldo Persiano
Sun, Dec 16, 2018 5:08 PM

Parkinbot rudolf@digitaldocument.de 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?

Parkinbot <rudolf@digitaldocument.de> 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?
CA
Carsten Arnholm
Sun, Dec 16, 2018 6:08 PM

On 16.12.2018 18:08, Ronaldo Persiano wrote:

Parkinbot <rudolf@digitaldocument.de mailto:rudolf@digitaldocument.de>
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

On 16.12.2018 18:08, Ronaldo Persiano wrote: > Parkinbot <rudolf@digitaldocument.de <mailto:rudolf@digitaldocument.de>> > 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
P
Parkinbot
Sun, Dec 16, 2018 6:33 PM

Ronaldo wrote

Parkinbot <

rudolf@

> wrote:

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 was referring to the post of nophead, without checking that.

nophead wrote

The 2D subsystem uses clipper, which is very good at sorting out self
intersections, etc. CGALseems to be the opposite. I

But in the thread you are referring to, the theme was almost planar polygons
in 3D. Here we are talking about the 2D subsystem. And linear_extrude
obviously uses a correct tesselation. Where does it come from?

--
Sent from: http://forum.openscad.org/

Ronaldo wrote > Parkinbot &lt; > rudolf@ > &gt; wrote: > > 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 was referring to the post of nophead, without checking that. nophead wrote > The 2D subsystem uses clipper, which is very good at sorting out self > intersections, etc. CGALseems to be the opposite. I But in the thread you are referring to, the theme was almost planar polygons in 3D. Here we are talking about the 2D subsystem. And linear_extrude obviously uses a correct tesselation. Where does it come from? -- Sent from: http://forum.openscad.org/
NH
nop head
Sun, Dec 16, 2018 7:37 PM

I don't think faces need to be tesselated for CGAL. It can handle polygonal
faces, so all linear_extrude would need to do is join the top and bottom
polygons with quads.

I think the problem with polyhedron is the interface. I.e. it doesn't allow
holes to be expressed in polygonal faces.

On Sun, 16 Dec 2018 at 18:33, Parkinbot rudolf@digitaldocument.de wrote:

Ronaldo wrote

Parkinbot <

rudolf@

> wrote:

Clipper library doesn't have any polygon triangulation procedure.
According
to @Kintel, OpenScad uses a modified version of libtess2 to triangulate
polygons (see

and libtess2 is unable to deal with holes.

I was referring to the post of nophead, without checking that.

nophead wrote

The 2D subsystem uses clipper, which is very good at sorting out self
intersections, etc. CGALseems to be the opposite. I

But in the thread you are referring to, the theme was almost planar
polygons
in 3D. Here we are talking about the 2D subsystem. And linear_extrude
obviously uses a correct tesselation. Where does it come from?

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I don't think faces need to be tesselated for CGAL. It can handle polygonal faces, so all linear_extrude would need to do is join the top and bottom polygons with quads. I think the problem with polyhedron is the interface. I.e. it doesn't allow holes to be expressed in polygonal faces. On Sun, 16 Dec 2018 at 18:33, Parkinbot <rudolf@digitaldocument.de> wrote: > Ronaldo wrote > > Parkinbot &lt; > > > rudolf@ > > > &gt; wrote: > > > > 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 was referring to the post of nophead, without checking that. > > nophead wrote > > The 2D subsystem uses clipper, which is very good at sorting out self > > intersections, etc. CGALseems to be the opposite. I > > But in the thread you are referring to, the theme was almost planar > polygons > in 3D. Here we are talking about the 2D subsystem. And linear_extrude > obviously uses a correct tesselation. Where does it come from? > > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
P
Parkinbot
Sun, Dec 16, 2018 9:08 PM

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/

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/
NH
nop head
Sun, Dec 16, 2018 9:21 PM

What makes you think that? It is definitely tesilated with F5

[image: image.png]

But not with F6, unless it hides it better.

[image: image.png]

On Sun, 16 Dec 2018 at 21:08, Parkinbot rudolf@digitaldocument.de 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

What makes you think that? It is definitely tesilated with F5 [image: image.png] But not with F6, unless it hides it better. [image: image.png] On Sun, 16 Dec 2018 at 21:08, Parkinbot <rudolf@digitaldocument.de> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
A
arnholm@arnholm.org
Sun, Dec 16, 2018 9:26 PM

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

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
NH
nop head
Sun, Dec 16, 2018 9:36 PM

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, arnholm@arnholm.org 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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, <arnholm@arnholm.org> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >