discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Polyhedron tube with irregular sides -- is it possible ?

P
Parkinbot
Mon, Dec 17, 2018 12:36 PM

nophead wrote

It nearly can with the keyhole method but they are not acceptable to CGAL
in that format
as they are not manifold. Simply removing the connections between loops
and
ensuring the correct winding order should fix that.

This would imply that linear_extrude will not have to recourse to a
tesselation for F5. There is a lot change of involved.

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

nophead wrote > It nearly can with the keyhole method but they are not acceptable to CGAL > in that format > as they are not manifold. Simply removing the connections between loops > and > ensuring the correct winding order should fix that. This would imply that linear_extrude will not have to recourse to a tesselation for F5. There is a lot change of involved. -- Sent from: http://forum.openscad.org/
P
Parkinbot
Mon, Dec 17, 2018 1:00 PM

see what happens to an almost planar face created by an rotate_extrude.
http://forum.openscad.org/file/t887/rot.png

rotate_extrude(angle = 160)
{
translate([10, 0])
difference()
{
square(10, center = true);
square(5, center = true);
}
}
cube(1);

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

see what happens to an almost planar face created by an rotate_extrude. <http://forum.openscad.org/file/t887/rot.png> rotate_extrude(angle = 160) { translate([10, 0]) difference() { square(10, center = true); square(5, center = true); } } cube(1); -- Sent from: http://forum.openscad.org/
NH
nop head
Mon, Dec 17, 2018 2:01 PM

This would imply that linear_extrude will not have to recourse to a

tesselation for F5.
I don't understand why. I am not proposing any changes to linear_extrude.

Anyway it appears that polyhedron will accept faces with holes if they are
tesselated correctly by the user. I exported your curved tube as STL and
then converted it to a polyhedron with this website:
https://jsfiddle.net/Riham/yzvGD/
The result is all triangles but CGAL converts all the planar faces back to
polygons. Only the rotated end face remains partly triangulated due to
floating point inacuracies. I.e. converting it to STL and back has improved
the last segment!

[image: image.png]

On Mon, 17 Dec 2018 at 13:01, Parkinbot rudolf@digitaldocument.de wrote:

see what happens to an almost planar face created by an rotate_extrude.
http://forum.openscad.org/file/t887/rot.png

rotate_extrude(angle = 160)
{
translate([10, 0])
difference()
{
square(10, center = true);
square(5, center = true);
}
}
cube(1);

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


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

> This would imply that linear_extrude will not have to recourse to a tesselation for F5. I don't understand why. I am not proposing any changes to linear_extrude. Anyway it appears that polyhedron will accept faces with holes if they are tesselated correctly by the user. I exported your curved tube as STL and then converted it to a polyhedron with this website: https://jsfiddle.net/Riham/yzvGD/ The result is all triangles but CGAL converts all the planar faces back to polygons. Only the rotated end face remains partly triangulated due to floating point inacuracies. I.e. converting it to STL and back has improved the last segment! [image: image.png] On Mon, 17 Dec 2018 at 13:01, Parkinbot <rudolf@digitaldocument.de> wrote: > see what happens to an almost planar face created by an rotate_extrude. > <http://forum.openscad.org/file/t887/rot.png> > > > rotate_extrude(angle = 160) > { > translate([10, 0]) > difference() > { > square(10, center = true); > square(5, center = true); > } > } > cube(1); > > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
NH
nop head
Mon, Dec 17, 2018 2:08 PM

Oddly F5 triangulates everything except the sqquare faces of the cube. I
noticed with a sphere F5 does everything except the polar caps, they remain
polygons, wierd!

[image: image.png]

On Mon, 17 Dec 2018 at 14:01, nop head nop.head@gmail.com wrote:

This would imply that linear_extrude will not have to recourse to a

tesselation for F5.
I don't understand why. I am not proposing any changes to linear_extrude.

Anyway it appears that polyhedron will accept faces with holes if they are
tesselated correctly by the user. I exported your curved tube as STL and
then converted it to a polyhedron with this website:
https://jsfiddle.net/Riham/yzvGD/
The result is all triangles but CGAL converts all the planar faces back to
polygons. Only the rotated end face remains partly triangulated due to
floating point inacuracies. I.e. converting it to STL and back has improved
the last segment!

[image: image.png]

On Mon, 17 Dec 2018 at 13:01, Parkinbot rudolf@digitaldocument.de wrote:

see what happens to an almost planar face created by an rotate_extrude.
http://forum.openscad.org/file/t887/rot.png

rotate_extrude(angle = 160)
{
translate([10, 0])
difference()
{
square(10, center = true);
square(5, center = true);
}
}
cube(1);

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


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

Oddly F5 triangulates everything except the sqquare faces of the cube. I noticed with a sphere F5 does everything except the polar caps, they remain polygons, wierd! [image: image.png] On Mon, 17 Dec 2018 at 14:01, nop head <nop.head@gmail.com> wrote: > > This would imply that linear_extrude will not have to recourse to a > tesselation for F5. > I don't understand why. I am not proposing any changes to linear_extrude. > > Anyway it appears that polyhedron will accept faces with holes if they are > tesselated correctly by the user. I exported your curved tube as STL and > then converted it to a polyhedron with this website: > https://jsfiddle.net/Riham/yzvGD/ > The result is all triangles but CGAL converts all the planar faces back to > polygons. Only the rotated end face remains partly triangulated due to > floating point inacuracies. I.e. converting it to STL and back has improved > the last segment! > > [image: image.png] > > > > > > > > On Mon, 17 Dec 2018 at 13:01, Parkinbot <rudolf@digitaldocument.de> wrote: > >> see what happens to an almost planar face created by an rotate_extrude. >> <http://forum.openscad.org/file/t887/rot.png> >> >> >> rotate_extrude(angle = 160) >> { >> translate([10, 0]) >> difference() >> { >> square(10, center = true); >> square(5, center = true); >> } >> } >> cube(1); >> >> >> >> >> >> -- >> 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
Mon, Dec 17, 2018 2:51 PM

CGAL anyway tesselates and retesselates faces on its will. linear_extrude()
and rotate_extrude() obviously don't use more complex faces respectively use
tesselation. Even sphere and cylinder at least for cones (r1, r2) construct
their faces mostly with triags and not with quads. What, beside a bunch of
options for implementation changes, would you gain by improving polyhedron()
to accept this kind of polygons with holes?

nophead wrote

Oddly F5 triangulates everything except the sqquare faces of the cube. I
noticed with a sphere F5 does everything except the polar caps, they
remain
polygons, wierd!

now look at this. I feed two bending faces defined by "almost planar"
polygons into a sweep. The two faces have a phase shift of 0 and 90 degrees.
Since I rely on the internal tesselation, I have to live with the result.
The upper face is a saddle, the lower face a sinus. (Knowing, what OpenSCAD
will probably do, I could of course change my construction code.)

use <Naca_sweep.scad>
sweep([circle(), Tz_(10, circle())]);
function circle(r = 10, N=100, z=3) =
[for(i=[0:N-1])  [rsin(360/Ni), rcos(360/Ni), zcos(360/Ni*2)]];
cube(1);
http://forum.openscad.org/file/t887/sweep.png

Now you can say. Ok, we allow even for polygons that describe bent faces.
And in the second step, lets also allow faces that close into a ring (or
even to moebius) ... See what I mean? I would prefer to be able to put a
tesselation of my choice into a sweep.

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

CGAL anyway tesselates and retesselates faces on its will. linear_extrude() and rotate_extrude() obviously don't use more complex faces respectively use tesselation. Even sphere and cylinder at least for cones (r1, r2) construct their faces mostly with triags and not with quads. What, beside a bunch of options for implementation changes, would you gain by improving polyhedron() to accept this kind of polygons with holes? nophead wrote > Oddly F5 triangulates everything except the sqquare faces of the cube. I > noticed with a sphere F5 does everything except the polar caps, they > remain > polygons, wierd! now look at this. I feed two bending faces defined by "almost planar" polygons into a sweep. The two faces have a phase shift of 0 and 90 degrees. Since I rely on the internal tesselation, I have to live with the result. The upper face is a saddle, the lower face a sinus. (Knowing, what OpenSCAD will probably do, I could of course change my construction code.) use <Naca_sweep.scad> sweep([circle(), Tz_(10, circle())]); function circle(r = 10, N=100, z=3) = [for(i=[0:N-1]) [r*sin(360/N*i), r*cos(360/N*i), z*cos(360/N*i*2)]]; cube(1); <http://forum.openscad.org/file/t887/sweep.png> Now you can say. Ok, we allow even for polygons that describe bent faces. And in the second step, lets also allow faces that close into a ring (or even to moebius) ... See what I mean? I would prefer to be able to put a tesselation of my choice into a sweep. -- Sent from: http://forum.openscad.org/
P
Parkinbot
Mon, Dec 17, 2018 3:03 PM

sorry I didn't sync the code with the image. This is the code:

use <Naca_sweep.scad>

sweep([circle(), Tz_(10, circle(phi = 90))]);
function circle(r = 10, N=100, z=3, phi=0) =
[for(i=[0:N-1])  [rsin(360/Ni), rcos(360/Ni), zcos(360/Ni*2+phi)]];

cube(1);

Parkinbot wrote

use
<Naca_sweep.scad>
sweep([circle(), Tz_(10, circle())]);
function circle(r = 10, N=100, z=3) =
[for(i=[0:N-1])  [rsin(360/Ni), rcos(360/Ni), zcos(360/Ni*2)]];
cube(1);
<http://forum.openscad.org/file/t887/sweep.png>

sorry I didn't sync the code with the image. This is the code: use <Naca_sweep.scad> sweep([circle(), Tz_(10, circle(phi = 90))]); function circle(r = 10, N=100, z=3, phi=0) = [for(i=[0:N-1]) [r*sin(360/N*i), r*cos(360/N*i), z*cos(360/N*i*2+phi)]]; cube(1); Parkinbot wrote > use > <Naca_sweep.scad> > sweep([circle(), Tz_(10, circle())]); > function circle(r = 10, N=100, z=3) = > [for(i=[0:N-1]) [r*sin(360/N*i), r*cos(360/N*i), z*cos(360/N*i*2)]]; > cube(1); > &lt;http://forum.openscad.org/file/t887/sweep.png&gt; -- Sent from: http://forum.openscad.org/
NH
nop head
Mon, Dec 17, 2018 3:18 PM

would you gain by improving polyhedron() to accept this kind of polygons

with holes?
It is a lot easier to define faces as polygons than it is to tesselate in
user space and feed a lot of triangles to polyhedron, mainly for endcaps,
particialarly with holes.

I agree an OpenSCAD tessalation operation available to the user would also
enable this but since the tesselation gets thrown way and regenerated many
times in OpenSCAD people might complain their tessalation was ignored.

I find the tesselation linear_extrude does ugly in some situations with
twist, e.g. fan blades. I fix it by adding more points along the blade that
are slight purturbed to force more facets and hence the tessalation I want.

module squarish(s, n) {
polygon([
for(i = [0 : n]) [i * s.x / n,  s.y + (i % 2) * eps],
for(i = [0 : n]) [s.x - i * s.x / n, (i % 2) * eps],
]);
}
I think making OpenSCAD preserve tesselation would be an enourmous job
while it use CGAL but fixing polyhedron is a small isolated changed.

On Mon, 17 Dec 2018 at 14:52, Parkinbot rudolf@digitaldocument.de wrote:

CGAL anyway tesselates and retesselates faces on its will. linear_extrude()
and rotate_extrude() obviously don't use more complex faces respectively
use
tesselation. Even sphere and cylinder at least for cones (r1, r2) construct
their faces mostly with triags and not with quads. What, beside a bunch of
options for implementation changes, would you gain by improving
polyhedron()
to accept this kind of polygons with holes?

nophead wrote

Oddly F5 triangulates everything except the sqquare faces of the cube. I
noticed with a sphere F5 does everything except the polar caps, they
remain
polygons, wierd!

now look at this. I feed two bending faces defined by "almost planar"
polygons into a sweep. The two faces have a phase shift of 0 and 90
degrees.
Since I rely on the internal tesselation, I have to live with the result.
The upper face is a saddle, the lower face a sinus. (Knowing, what OpenSCAD
will probably do, I could of course change my construction code.)

use <Naca_sweep.scad>
sweep([circle(), Tz_(10, circle())]);
function circle(r = 10, N=100, z=3) =
[for(i=[0:N-1])  [rsin(360/Ni), rcos(360/Ni), zcos(360/Ni*2)]];
cube(1);
http://forum.openscad.org/file/t887/sweep.png

Now you can say. Ok, we allow even for polygons that describe bent faces.
And in the second step, lets also allow faces that close into a ring (or
even to moebius) ... See what I mean? I would prefer to be able to put a
tesselation of my choice into a sweep.

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


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

> would you gain by improving polyhedron() to accept this kind of polygons with holes? It is a lot easier to define faces as polygons than it is to tesselate in user space and feed a lot of triangles to polyhedron, mainly for endcaps, particialarly with holes. I agree an OpenSCAD tessalation operation available to the user would also enable this but since the tesselation gets thrown way and regenerated many times in OpenSCAD people might complain their tessalation was ignored. I find the tesselation linear_extrude does ugly in some situations with twist, e.g. fan blades. I fix it by adding more points along the blade that are slight purturbed to force more facets and hence the tessalation I want. module squarish(s, n) { polygon([ for(i = [0 : n]) [i * s.x / n, s.y + (i % 2) * eps], for(i = [0 : n]) [s.x - i * s.x / n, (i % 2) * eps], ]); } I think making OpenSCAD preserve tesselation would be an enourmous job while it use CGAL but fixing polyhedron is a small isolated changed. On Mon, 17 Dec 2018 at 14:52, Parkinbot <rudolf@digitaldocument.de> wrote: > CGAL anyway tesselates and retesselates faces on its will. linear_extrude() > and rotate_extrude() obviously don't use more complex faces respectively > use > tesselation. Even sphere and cylinder at least for cones (r1, r2) construct > their faces mostly with triags and not with quads. What, beside a bunch of > options for implementation changes, would you gain by improving > polyhedron() > to accept this kind of polygons with holes? > > > nophead wrote > > Oddly F5 triangulates everything except the sqquare faces of the cube. I > > noticed with a sphere F5 does everything except the polar caps, they > > remain > > polygons, wierd! > > now look at this. I feed two bending faces defined by "almost planar" > polygons into a sweep. The two faces have a phase shift of 0 and 90 > degrees. > Since I rely on the internal tesselation, I have to live with the result. > The upper face is a saddle, the lower face a sinus. (Knowing, what OpenSCAD > will probably do, I could of course change my construction code.) > > use <Naca_sweep.scad> > sweep([circle(), Tz_(10, circle())]); > function circle(r = 10, N=100, z=3) = > [for(i=[0:N-1]) [r*sin(360/N*i), r*cos(360/N*i), z*cos(360/N*i*2)]]; > cube(1); > <http://forum.openscad.org/file/t887/sweep.png> > > > Now you can say. Ok, we allow even for polygons that describe bent faces. > And in the second step, lets also allow faces that close into a ring (or > even to moebius) ... See what I mean? I would prefer to be able to put a > tesselation of my choice into a sweep. > > > > > > -- > 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
Mon, Dec 17, 2018 3:24 PM

And another interesting observation:

The iron law to do a sweep() is: Avoid (self) intersection of faces at any
cost. This doesn't seem to apply for intersecting bending faces. While F12
announces a failure, CGAL seems to happily digest it:

use <Naca_sweep.scad>
sweep([circle(), Tz_(5, circle(phi = 180))]);
function circle(r = 10, N=100, z=3, phi=0) =
[for(i=[0:N-1])  [rsin(360/Ni), rcos(360/Ni), zcos(360/Ni*2+phi)]];
cube(1);

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

Will this open the path for a representation that lets us ignore (self)
intersections?

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

And another interesting observation: The iron law to do a sweep() is: Avoid (self) intersection of faces at any cost. This doesn't seem to apply for intersecting bending faces. While F12 announces a failure, CGAL seems to happily digest it: use <Naca_sweep.scad> sweep([circle(), Tz_(5, circle(phi = 180))]); function circle(r = 10, N=100, z=3, phi=0) = [for(i=[0:N-1]) [r*sin(360/N*i), r*cos(360/N*i), z*cos(360/N*i*2+phi)]]; cube(1); <http://forum.openscad.org/file/t887/sweep.png> Will this open the path for a representation that lets us ignore (self) intersections? -- Sent from: http://forum.openscad.org/
NH
nop head
Mon, Dec 17, 2018 3:31 PM

Odd CGAL normally throws an exception. Perhaps it gets past if no vertices
colide.

Does it say simple is yes and can you export it to STL?

On Mon, 17 Dec 2018 at 15:24, Parkinbot rudolf@digitaldocument.de wrote:

And another interesting observation:

The iron law to do a sweep() is: Avoid (self) intersection of faces at any
cost. This doesn't seem to apply for intersecting bending faces. While F12
announces a failure, CGAL seems to happily digest it:

use <Naca_sweep.scad>
sweep([circle(), Tz_(5, circle(phi = 180))]);
function circle(r = 10, N=100, z=3, phi=0) =
[for(i=[0:N-1])  [rsin(360/Ni), rcos(360/Ni), zcos(360/Ni*2+phi)]];
cube(1);

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

Will this open the path for a representation that lets us ignore (self)
intersections?

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


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

Odd CGAL normally throws an exception. Perhaps it gets past if no vertices colide. Does it say simple is yes and can you export it to STL? On Mon, 17 Dec 2018 at 15:24, Parkinbot <rudolf@digitaldocument.de> wrote: > And another interesting observation: > > The iron law to do a sweep() is: Avoid (self) intersection of faces at any > cost. This doesn't seem to apply for intersecting bending faces. While F12 > announces a failure, CGAL seems to happily digest it: > > use <Naca_sweep.scad> > sweep([circle(), Tz_(5, circle(phi = 180))]); > function circle(r = 10, N=100, z=3, phi=0) = > [for(i=[0:N-1]) [r*sin(360/N*i), r*cos(360/N*i), z*cos(360/N*i*2+phi)]]; > cube(1); > > <http://forum.openscad.org/file/t887/sweep.png> > > Will this open the path for a representation that lets us ignore (self) > intersections? > > > > -- > 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
Mon, Dec 17, 2018 3:38 PM

I can export it to STL and import it again without any problems.

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

I can export it to STL and import it again without any problems. -- Sent from: http://forum.openscad.org/