Re: [openscad/openscad] Union of imported STLs fail to render with CGAL (#802)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [openscad/openscad] Union of imported STLs fail to render with CGAL (#802)

Ronaldo
I was intrigued that the polygon linear extruded in you IGewinde() module renders happily while its extrusion fails and I have investigated the issue a little further. The problem is in the way linear_extrude() generates its mesh with twist. The attached image of the twisted extrusion with thrown together shows self-intersections even for low values of the twist. The image corresponds to the code:

IGewinde(10.4, 11.8, 18, 9);

module IGewinde(r1, r2, n, h){
  r=(r1+r2*r2/r1)/2.141;
  // linear_extrude(height=h, twist=-360*h/n)
  linear_extrude(height=h, twist=-20*h/n)
  difference(){
    circle(r2);
    translate([0,r-r1,0]) circle(r);
  }
}

It has been reported here before that linear_extrude with twist makes a wrong choice for the quad triangulations: it chooses the longest diagonal. In the case of IGewinde(), that decision produces a self-intersection in the thin tips of the base polygon. If the shortest quad diagonal were taken instead, self-intersections would not happen. Note that the shortest diagonal is chosen in the inner surface of the ring. In fact, the same diagonal choice is done in the inner surface and the outer surface. It is a good choice (the shortest diagonal) for one surface and the worst (the longest) for the other. It is a bug in linear_extrude.


Em sex., 17 de jan. de 2020 às 16:57, Projects around the FreeBASIC compiler <[hidden email]> escreveu:

Indeed, when I cut the tips it renders:

module IGewinde(r1, r2, n, h)
{
  r=(r1+r2*r2/r1)/2.141;
  linear_extrude(height=h, twist=-360*h/n)
  difference(){
    circle(r2);
    translate([0,r-r1,0]) circle(r);
    polygon(points=[[0,0],[r2,r2],[-r2,r2]]);
  }
}

Thanks for pointing to the issue! This granularity is fine enough.

I didn't find any hint that linear_extrude doesn't like thin tips. The warning seams to be a good idea, at least in the documentation.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

ring.PNG (31K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [openscad/openscad] Union of imported STLs fail to render with CGAL (#802)

nophead
Yes linear extrude with twist is known to create self intersections with thin walls unless slices is set.

On Sat, 18 Jan 2020, 16:18 Ronaldo Persiano, <[hidden email]> wrote:
I was intrigued that the polygon linear extruded in you IGewinde() module renders happily while its extrusion fails and I have investigated the issue a little further. The problem is in the way linear_extrude() generates its mesh with twist. The attached image of the twisted extrusion with thrown together shows self-intersections even for low values of the twist. The image corresponds to the code:

IGewinde(10.4, 11.8, 18, 9);

module IGewinde(r1, r2, n, h){
  r=(r1+r2*r2/r1)/2.141;
  // linear_extrude(height=h, twist=-360*h/n)
  linear_extrude(height=h, twist=-20*h/n)
  difference(){
    circle(r2);
    translate([0,r-r1,0]) circle(r);
  }
}

It has been reported here before that linear_extrude with twist makes a wrong choice for the quad triangulations: it chooses the longest diagonal. In the case of IGewinde(), that decision produces a self-intersection in the thin tips of the base polygon. If the shortest quad diagonal were taken instead, self-intersections would not happen. Note that the shortest diagonal is chosen in the inner surface of the ring. In fact, the same diagonal choice is done in the inner surface and the outer surface. It is a good choice (the shortest diagonal) for one surface and the worst (the longest) for the other. It is a bug in linear_extrude.


Em sex., 17 de jan. de 2020 às 16:57, Projects around the FreeBASIC compiler <[hidden email]> escreveu:

Indeed, when I cut the tips it renders:

module IGewinde(r1, r2, n, h)
{
  r=(r1+r2*r2/r1)/2.141;
  linear_extrude(height=h, twist=-360*h/n)
  difference(){
    circle(r2);
    translate([0,r-r1,0]) circle(r);
    polygon(points=[[0,0],[r2,r2],[-r2,r2]]);
  }
}

Thanks for pointing to the issue! This granularity is fine enough.

I didn't find any hint that linear_extrude doesn't like thin tips. The warning seams to be a good idea, at least in the documentation.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

_______________________________________________
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