discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Unnecessary triangulation in linear_extrude

NH
nop head
Sun, Jan 3, 2016 12:17 PM

A cylinder is not the same as a linear_extruded circle. The side facets of
a cylinder are rectangles whereas the linear_extrude version are a pair of
triangles. This causes ugliness if you want to union them. Using a
linear_extruded circle instead of a cylinder works in some cases but I
still seem to have problems when the height is very different.

Here is an example:-

A base made from a hull of circles linear extruded.

A cylinder made from exactly the same circle linear extruded.

The union has extra facets and vertices on the base for some reason I don't
quite understand.


Could linear extrude use rectangles in the case when there is no twist so
the points are guaranteed to be planar?

A cylinder is not the same as a linear_extruded circle. The side facets of a cylinder are rectangles whereas the linear_extrude version are a pair of triangles. This causes ugliness if you want to union them. Using a linear_extruded circle instead of a cylinder works in some cases but I still seem to have problems when the height is very different. Here is an example:- A base made from a hull of circles linear extruded. A cylinder made from exactly the same circle linear extruded. The union has extra facets and vertices on the base for some reason I don't quite understand. ​ Could linear extrude use rectangles in the case when there is no twist so the points are guaranteed to be planar?
NH
nop head
Sun, Jan 3, 2016 3:03 PM

The union seems to make up extra vertices. If I show the cylinder on its
own or the hull on its own the vertices are in the same place. Also they
are as should be with F5 but F6 introduces new vertices that should not be
there. I tried to distil it down to a simple example but that works fine.

On 3 January 2016 at 12:17, nop head nop.head@gmail.com wrote:

A cylinder is not the same as a linear_extruded circle. The side facets
of a cylinder are rectangles whereas the linear_extrude version are a pair
of triangles. This causes ugliness if you want to union them. Using a
linear_extruded circle instead of a cylinder works in some cases but I
still seem to have problems when the height is very different.

Here is an example:-

A base made from a hull of circles linear extruded.

A cylinder made from exactly the same circle linear extruded.

The union has extra facets and vertices on the base for some reason I
don't quite understand.


Could linear extrude use rectangles in the case when there is no twist so
the points are guaranteed to be planar?

The union seems to make up extra vertices. If I show the cylinder on its own or the hull on its own the vertices are in the same place. Also they are as should be with F5 but F6 introduces new vertices that should not be there. I tried to distil it down to a simple example but that works fine. On 3 January 2016 at 12:17, nop head <nop.head@gmail.com> wrote: > A cylinder is not the same as a linear_extruded circle. The side facets > of a cylinder are rectangles whereas the linear_extrude version are a pair > of triangles. This causes ugliness if you want to union them. Using a > linear_extruded circle instead of a cylinder works in some cases but I > still seem to have problems when the height is very different. > > Here is an example:- > > A base made from a hull of circles linear extruded. > > > > > A cylinder made from exactly the same circle linear extruded. > > > > The union has extra facets and vertices on the base for some reason I > don't quite understand. > > > ​ > Could linear extrude use rectangles in the case when there is no twist so > the points are guaranteed to be planar? > > >
MK
Marius Kintel
Sun, Jan 3, 2016 4:34 PM

Could linear extrude use rectangles in the case when there is no twist so the points are guaranteed to be planar?

I guess we could do this as a special case. Note that 4 vertices in floating point aren’t guaranteed to be planar, but there’s a good chance they are. CGAL is particularly picky about planarity and we have to triangulate whenever CGAL complains.

-Marius

> Could linear extrude use rectangles in the case when there is no twist so the points are guaranteed to be planar? > I guess we could do this as a special case. Note that 4 vertices in floating point aren’t guaranteed to be planar, but there’s a good chance they are. CGAL is particularly picky about planarity and we have to triangulate whenever CGAL complains. -Marius
NH
nop head
Sun, Jan 3, 2016 4:39 PM

With linear_extrude surely the top vertices have exactly the same x,y
coordinates as the bottom and just differ in Z, regardless of the
representation?

On 3 January 2016 at 16:34, Marius Kintel marius@kintel.net wrote:

Could linear extrude use rectangles in the case when there is no twist

so the points are guaranteed to be planar?

I guess we could do this as a special case. Note that 4 vertices in
floating point aren’t guaranteed to be planar, but there’s a good chance
they are. CGAL is particularly picky about planarity and we have to
triangulate whenever CGAL complains.

-Marius


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

With linear_extrude surely the top vertices have exactly the same x,y coordinates as the bottom and just differ in Z, regardless of the representation? On 3 January 2016 at 16:34, Marius Kintel <marius@kintel.net> wrote: > > > Could linear extrude use rectangles in the case when there is no twist > so the points are guaranteed to be planar? > > > I guess we could do this as a special case. Note that 4 vertices in > floating point aren’t guaranteed to be planar, but there’s a good chance > they are. CGAL is particularly picky about planarity and we have to > triangulate whenever CGAL complains. > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
MK
Marius Kintel
Sun, Jan 3, 2016 4:42 PM

On Jan 3, 2016, at 11:39 AM, nop head nop.head@gmail.com wrote:

With linear_extrude surely the top vertices have exactly the same x,y coordinates as the bottom and just differ in Z, regardless of the representation?

Good point. If we also disregard scale, that would indeed constitute a special case we could rely on.

-Marius

> On Jan 3, 2016, at 11:39 AM, nop head <nop.head@gmail.com> wrote: > > With linear_extrude surely the top vertices have exactly the same x,y coordinates as the bottom and just differ in Z, regardless of the representation? > Good point. If we also disregard scale, that would indeed constitute a special case we could rely on. -Marius
P
Parkinbot
Sun, Jan 3, 2016 5:04 PM

Any stl-representation finally will be triangulated. So what do you expect to
gain, if you allowed for triangles AND rectangles (or even planar rhombus)
and write double but specialized code to preserve rectangles as long as
possible?

You would have to start with two implementations for linear_extrude(), one
for calls with twist<>n*360 and one for all other cases.

I mean, what is your sense of ugliness?

  • Rudolf

--
View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15435.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Any stl-representation finally will be triangulated. So what do you expect to gain, if you allowed for triangles AND rectangles (or even planar rhombus) and write double but specialized code to preserve rectangles as long as possible? You would have to start with two implementations for linear_extrude(), one for calls with twist<>n*360 and one for all other cases. I mean, what is your sense of ugliness? - Rudolf -- View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15435.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sun, Jan 3, 2016 5:22 PM

I am trying to get rid of degenerate triangles in the STL. I think they
come from these extra facets and vertices. However I now think it may be a
bug in CGAL union.

Here is the result from my code with a lot removed. There are extra facets


Here is my simple test code to re-create the bug, but it doesn't happen.

$fa = 5;
$fs = 0.5;

union() {
cylinder(r = 4, h= 100);

linear_extrude(height = 10) hull() {
        circle(4);

    translate([30, 10, 0])
        circle(4);

    translate([10, 30, 0])
        circle(4);
}

}

This is what it should look like because the vertices on the top and bottom
of the cylinder should exactly match those of the rounded corner,
regardless of number representation as they are all created by circle or
cylinder with the same parameters.

On 3 January 2016 at 17:04, Parkinbot rudolf@parkinbot.com wrote:

Any stl-representation finally will be triangulated. So what do you expect
to
gain, if you allowed for triangles AND rectangles (or even planar rhombus)
and write double but specialized code to preserve rectangles as long as
possible?

You would have to start with two implementations for linear_extrude(), one
for calls with twist<>n*360 and one for all other cases.

I mean, what is your sense of ugliness?

  • Rudolf

--
View this message in context:
http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15435.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

I am trying to get rid of degenerate triangles in the STL. I think they come from these extra facets and vertices. However I now think it may be a bug in CGAL union. Here is the result from my code with a lot removed. There are extra facets ​ Here is my simple test code to re-create the bug, but it doesn't happen. $fa = 5; $fs = 0.5; union() { cylinder(r = 4, h= 100); linear_extrude(height = 10) hull() { circle(4); translate([30, 10, 0]) circle(4); translate([10, 30, 0]) circle(4); } } This is what it should look like because the vertices on the top and bottom of the cylinder should exactly match those of the rounded corner, regardless of number representation as they are all created by circle or cylinder with the same parameters. On 3 January 2016 at 17:04, Parkinbot <rudolf@parkinbot.com> wrote: > Any stl-representation finally will be triangulated. So what do you expect > to > gain, if you allowed for triangles AND rectangles (or even planar rhombus) > and write double but specialized code to preserve rectangles as long as > possible? > > You would have to start with two implementations for linear_extrude(), one > for calls with twist<>n*360 and one for all other cases. > > I mean, what is your sense of ugliness? > > - Rudolf > > > > -- > View this message in context: > http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15435.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
CA
Carsten Arnholm
Sun, Jan 3, 2016 7:36 PM

On 03. jan. 2016 17:42, Marius Kintel wrote:

Good point. If we also disregard scale, that would indeed constitute a special case we could rely on.

This will fail (generate nonplanar quads) if you apply the right skewing
with multmatrix.

Carsten Arnholm

On 03. jan. 2016 17:42, Marius Kintel wrote: > Good point. If we also disregard scale, that would indeed constitute a special case we could rely on. This will fail (generate nonplanar quads) if you apply the right skewing with multmatrix. Carsten Arnholm
NH
nop head
Sun, Jan 3, 2016 7:51 PM

How does it handle cylinder then?

On 3 January 2016 at 19:36, Carsten Arnholm arnholm@arnholm.org wrote:

On 03. jan. 2016 17:42, Marius Kintel wrote:

Good point. If we also disregard scale, that would indeed constitute a
special case we could rely on.

This will fail (generate nonplanar quads) if you apply the right skewing
with multmatrix.

Carsten Arnholm


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

How does it handle cylinder then? On 3 January 2016 at 19:36, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 03. jan. 2016 17:42, Marius Kintel wrote: > >> Good point. If we also disregard scale, that would indeed constitute a >> special case we could rely on. >> > > This will fail (generate nonplanar quads) if you apply the right skewing > with multmatrix. > > Carsten Arnholm > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
CA
Carsten Arnholm
Sun, Jan 3, 2016 8:37 PM

On 03. jan. 2016 20:51, nop head wrote:

How does it handle cylinder then?

Better than what i expected, or so it it seems :-) I may have been to
quick. I tried things like this:

multmatrix([
[1, 0.8, 0, 0],
[0.2, 1, 0.95, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]) {
cylinder($fn = 12, h = 100, r1 = 20, r2 = 20);
}

From the looks only, it does indeed seem the quads remain planar.
However, there could be numerical issues.

Carsten Arnholm

On 03. jan. 2016 20:51, nop head wrote: > How does it handle cylinder then? Better than what i expected, or so it it seems :-) I may have been to quick. I tried things like this: multmatrix([ [1, 0.8, 0, 0], [0.2, 1, 0.95, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { cylinder($fn = 12, h = 100, r1 = 20, r2 = 20); } From the looks only, it does indeed seem the quads remain planar. However, there could be numerical issues. Carsten Arnholm
NH
nop head
Sun, Jan 3, 2016 8:49 PM

I have boiled my bug down to this: -

$fa = 5;
$fs = 0.5;
tube_r = 4;
x = 38.8808;
y1 = 59;
y2 = -50;

union() {
translate([x, y1,    0])
difference() {
cylinder(r = tube_r, h= 100);

        translate([0, 0, 99]) // small hole in the top
            cylinder(r = 1, h = 2);
    }

linear_extrude(height = 10) hull() {
        circle(tube_r);

    translate([x, y1])
        circle(tube_r);

    translate([x, y2])
        circle(tube_r);
}

}

Which gives


Simply commenting out the small hole in the top of the cylinder gives this:


So it looks to be some sort of numerical problem swapping between CGAL and
homebrew representations. I guess removing the hole in the top removes a
trip through CGAL and the circle coordinates remain exactly equal. However
I can't understand where the extra circle vertices come from as they are
not numerically close to the real vertices.

On 3 January 2016 at 20:37, Carsten Arnholm arnholm@arnholm.org wrote:

On 03. jan. 2016 20:51, nop head wrote:

How does it handle cylinder then?

Better than what i expected, or so it it seems :-) I may have been to
quick. I tried things like this:

multmatrix([
[1, 0.8, 0, 0],
[0.2, 1, 0.95, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]) {
cylinder($fn = 12, h = 100, r1 = 20, r2 = 20);
}

From the looks only, it does indeed seem the quads remain planar. However,
there could be numerical issues.

Carsten Arnholm


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

I have boiled my bug down to this: - $fa = 5; $fs = 0.5; tube_r = 4; x = 38.8808; y1 = 59; y2 = -50; union() { translate([x, y1, 0]) difference() { cylinder(r = tube_r, h= 100); translate([0, 0, 99]) // small hole in the top cylinder(r = 1, h = 2); } linear_extrude(height = 10) hull() { circle(tube_r); translate([x, y1]) circle(tube_r); translate([x, y2]) circle(tube_r); } } Which gives ​ Simply commenting out the small hole in the top of the cylinder gives this: - ​ So it looks to be some sort of numerical problem swapping between CGAL and homebrew representations. I guess removing the hole in the top removes a trip through CGAL and the circle coordinates remain exactly equal. However I can't understand where the extra circle vertices come from as they are not numerically close to the real vertices. On 3 January 2016 at 20:37, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 03. jan. 2016 20:51, nop head wrote: > >> How does it handle cylinder then? >> > > Better than what i expected, or so it it seems :-) I may have been to > quick. I tried things like this: > > multmatrix([ > [1, 0.8, 0, 0], > [0.2, 1, 0.95, 0], > [0, 0, 1, 0], > [0, 0, 0, 1]]) { > cylinder($fn = 12, h = 100, r1 = 20, r2 = 20); > } > > From the looks only, it does indeed seem the quads remain planar. However, > there could be numerical issues. > > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
NH
nop head
Sun, Jan 3, 2016 9:01 PM

And here is an even simpler version just unioning coincident cylinders.

$fa = 5;
$fs = 0.5;
tube_r = 4;
x = 38.8808;
y = 0;

union() {
translate([x, y, 0])
difference() {
cylinder(r = tube_r, h= 100);

        translate([0, 0, 99]) // small hole in the top
            cylinder(r = 1, h = 2);
    }

    translate([x, y])
        cylinder(r = tube_r, h = 10);

}

With X = 0 there is no problem but other values give various extra vertices.

The version I am using is 2015, 5, 16

On 3 January 2016 at 20:49, nop head nop.head@gmail.com wrote:

I have boiled my bug down to this: -

$fa = 5;
$fs = 0.5;
tube_r = 4;
x = 38.8808;
y1 = 59;
y2 = -50;

union() {
translate([x, y1,    0])
difference() {
cylinder(r = tube_r, h= 100);

         translate([0, 0, 99]) // small hole in the top
             cylinder(r = 1, h = 2);
     }

 linear_extrude(height = 10) hull() {
         circle(tube_r);

     translate([x, y1])
         circle(tube_r);

     translate([x, y2])
         circle(tube_r);
 }

}

Which gives


Simply commenting out the small hole in the top of the cylinder gives
this: -


So it looks to be some sort of numerical problem swapping between CGAL and
homebrew representations. I guess removing the hole in the top removes a
trip through CGAL and the circle coordinates remain exactly equal. However
I can't understand where the extra circle vertices come from as they are
not numerically close to the real vertices.

On 3 January 2016 at 20:37, Carsten Arnholm arnholm@arnholm.org wrote:

On 03. jan. 2016 20:51, nop head wrote:

How does it handle cylinder then?

Better than what i expected, or so it it seems :-) I may have been to
quick. I tried things like this:

multmatrix([
[1, 0.8, 0, 0],
[0.2, 1, 0.95, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]) {
cylinder($fn = 12, h = 100, r1 = 20, r2 = 20);
}

From the looks only, it does indeed seem the quads remain planar.
However, there could be numerical issues.

Carsten Arnholm


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

And here is an even simpler version just unioning coincident cylinders. $fa = 5; $fs = 0.5; tube_r = 4; x = 38.8808; y = 0; union() { translate([x, y, 0]) difference() { cylinder(r = tube_r, h= 100); translate([0, 0, 99]) // small hole in the top cylinder(r = 1, h = 2); } translate([x, y]) cylinder(r = tube_r, h = 10); } With X = 0 there is no problem but other values give various extra vertices. The version I am using is 2015, 5, 16 On 3 January 2016 at 20:49, nop head <nop.head@gmail.com> wrote: > I have boiled my bug down to this: - > > $fa = 5; > $fs = 0.5; > tube_r = 4; > x = 38.8808; > y1 = 59; > y2 = -50; > > union() { > translate([x, y1, 0]) > difference() { > cylinder(r = tube_r, h= 100); > > translate([0, 0, 99]) // small hole in the top > cylinder(r = 1, h = 2); > } > > linear_extrude(height = 10) hull() { > circle(tube_r); > > translate([x, y1]) > circle(tube_r); > > translate([x, y2]) > circle(tube_r); > } > } > > Which gives > > > ​ > Simply commenting out the small hole in the top of the cylinder gives > this: - > > > ​ > So it looks to be some sort of numerical problem swapping between CGAL and > homebrew representations. I guess removing the hole in the top removes a > trip through CGAL and the circle coordinates remain exactly equal. However > I can't understand where the extra circle vertices come from as they are > not numerically close to the real vertices. > > On 3 January 2016 at 20:37, Carsten Arnholm <arnholm@arnholm.org> wrote: > >> On 03. jan. 2016 20:51, nop head wrote: >> >>> How does it handle cylinder then? >>> >> >> Better than what i expected, or so it it seems :-) I may have been to >> quick. I tried things like this: >> >> multmatrix([ >> [1, 0.8, 0, 0], >> [0.2, 1, 0.95, 0], >> [0, 0, 1, 0], >> [0, 0, 0, 1]]) { >> cylinder($fn = 12, h = 100, r1 = 20, r2 = 20); >> } >> >> From the looks only, it does indeed seem the quads remain planar. >> However, there could be numerical issues. >> >> >> Carsten Arnholm >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >
P
Parkinbot
Sun, Jan 3, 2016 10:42 PM

I am not suprised about linear_extrude(). What really suprises me is that the
basic implementations of cylinder and cube do use squares. This is not
self-evident. I mean, if you start like this, you could also allow for
convex n-polygons as planar thing (as you can do it VRML). I guess this has
some historical reasons.

BTW, your problem has implementational AND numerical backgrounds. You get
what you want, if you give union() some "help":

$fa = 5;
$fs = 0.5;
cylinder(r = 4.0001, h= 100);
linear_extrude(height = 10)
hull() {
circle(4);

     translate([30, 10, 0])
         circle(4);
    
     translate([10, 30, 0])
         circle(4);
 }

--
View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15450.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I am not suprised about linear_extrude(). What really suprises me is that the basic implementations of cylinder and cube do use squares. This is not self-evident. I mean, if you start like this, you could also allow for convex n-polygons as planar thing (as you can do it VRML). I guess this has some historical reasons. BTW, your problem has implementational AND numerical backgrounds. You get what you want, if you give union() some "help": > $fa = 5; > $fs = 0.5; > cylinder(r = 4.0001, h= 100); > linear_extrude(height = 10) > hull() { > circle(4); > > translate([30, 10, 0]) > circle(4); > > translate([10, 30, 0]) > circle(4); > } -- View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15450.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Sun, Jan 3, 2016 11:05 PM

..or:

$fn=3;
translate([10,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10,0,0]) cylinder(r = 4, h = 10);

Not sure why this happens. It would be nice if we could test if it’s reproducible it in pure CGAL.

-Marius

..or: $fn=3; translate([10,0,0]) { cylinder(r = 4, h= 20); translate([0, 0, 100]) cube(); //dummy } translate([10,0,0]) cylinder(r = 4, h = 10); Not sure why this happens. It would be nice if we could test if it’s reproducible it in pure CGAL. -Marius
P
Parkinbot
Sun, Jan 3, 2016 11:16 PM

Try this:

$fn=3;
translate([.1,0,0]) {
cylinder(r = 4, h= 10);
translate([0, 0, 10]) cylinder(); //dummy
}
translate([.1,0,0]) cylinder(r = 4, h = 20);

--
View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15452.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Try this: $fn=3; translate([.1,0,0]) { cylinder(r = 4, h= 10); translate([0, 0, 10]) cylinder(); //dummy } translate([.1,0,0]) cylinder(r = 4, h = 20); -- View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15452.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sun, Jan 3, 2016 11:17 PM

In that case there are just extra edges between existing vertices, which is
not too surprising. With this version the extra vertices appear at $fn = 32;

$fn=32;
translate([10.1,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10.1,0,0]) cylinder(r = 4, h = 10);

On 3 January 2016 at 23:05, Marius Kintel marius@kintel.net wrote:

..or:

$fn=3;
translate([10,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10,0,0]) cylinder(r = 4, h = 10);

Not sure why this happens. It would be nice if we could test if it’s
reproducible it in pure CGAL.

-Marius


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

In that case there are just extra edges between existing vertices, which is not too surprising. With this version the extra vertices appear at $fn = 32; $fn=32; translate([10.1,0,0]) { cylinder(r = 4, h= 20); translate([0, 0, 100]) cube(); //dummy } translate([10.1,0,0]) cylinder(r = 4, h = 10); On 3 January 2016 at 23:05, Marius Kintel <marius@kintel.net> wrote: > ..or: > > $fn=3; > translate([10,0,0]) { > cylinder(r = 4, h= 20); > translate([0, 0, 100]) cube(); //dummy > } > translate([10,0,0]) cylinder(r = 4, h = 10); > > Not sure why this happens. It would be nice if we could test if it’s > reproducible it in pure CGAL. > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
N
nophead
Sun, Jan 3, 2016 11:20 PM

$fn=11;
translate([.1,0,0]) {
cylinder(r = 4, h= 10);
translate([0, 0, 10]) cylinder(); //dummy
}
translate([.1,0,0]) cylinder(r = 4, h = 20);

--
View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15454.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

$fn=11; translate([.1,0,0]) { cylinder(r = 4, h= 10); translate([0, 0, 10]) cylinder(); //dummy } translate([.1,0,0]) cylinder(r = 4, h = 20); -- View this message in context: http://forum.openscad.org/Unnecessary-triangulation-in-linear-extrude-tp15429p15454.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Mon, Jan 4, 2016 8:31 AM

I tried it in an old version of OpenScad, 2013.06, which I assume only does
F6 in CGAL. That doesn't have the problem.

Is it perhaps that translate produces a different result when the object it
gets is from CGAL?

Another numerical issue I have noticed is when I generate Mendel90 on a
different PC, but with the same source files and the same old OpenScad
binary then some of the STL files are different. When I examined a simply
example I found one vertex on a circle had a different Y ordinate that
differed by one in the last floating point digit. One is an Intel Core2 Duo
running 32 bit XP and the other an Intel Core i7 running 64 bit Win7.
Perhaps I am naive but I thought IEEE floating point maths was supposed to
give consistent results.

On 3 January 2016 at 23:05, Marius Kintel marius@kintel.net wrote:

..or:

$fn=3;
translate([10,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10,0,0]) cylinder(r = 4, h = 10);

Not sure why this happens. It would be nice if we could test if it’s
reproducible it in pure CGAL.

-Marius


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

I tried it in an old version of OpenScad, 2013.06, which I assume only does F6 in CGAL. That doesn't have the problem. Is it perhaps that translate produces a different result when the object it gets is from CGAL? Another numerical issue I have noticed is when I generate Mendel90 on a different PC, but with the same source files and the same old OpenScad binary then some of the STL files are different. When I examined a simply example I found one vertex on a circle had a different Y ordinate that differed by one in the last floating point digit. One is an Intel Core2 Duo running 32 bit XP and the other an Intel Core i7 running 64 bit Win7. Perhaps I am naive but I thought IEEE floating point maths was supposed to give consistent results. On 3 January 2016 at 23:05, Marius Kintel <marius@kintel.net> wrote: > ..or: > > $fn=3; > translate([10,0,0]) { > cylinder(r = 4, h= 20); > translate([0, 0, 100]) cube(); //dummy > } > translate([10,0,0]) cylinder(r = 4, h = 10); > > Not sure why this happens. It would be nice if we could test if it’s > reproducible it in pure CGAL. > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
NH
nop head
Mon, Jan 4, 2016 8:42 AM

Another test that shows CGAL is OK is this:

fn=11;
translate([10.1,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10.1,0,0]) {
cylinder(r = 4, h = 10);
translate([0, 0, 100]) cube(); //dummy
}

This gives the correct result showing if both cylinders pass through CGAL
before being unioned they have numerically equal coordinates. When one is
translated before it gets converted to CGAL format the union generates
extra vertices. I think these are simply where two slightly different
planes meet.

On 4 January 2016 at 08:31, nop head nop.head@gmail.com wrote:

I tried it in an old version of OpenScad, 2013.06, which I assume only
does F6 in CGAL. That doesn't have the problem.

Is it perhaps that translate produces a different result when the object
it gets is from CGAL?

Another numerical issue I have noticed is when I generate Mendel90 on a
different PC, but with the same source files and the same old OpenScad
binary then some of the STL files are different. When I examined a simply
example I found one vertex on a circle had a different Y ordinate that
differed by one in the last floating point digit. One is an Intel Core2 Duo
running 32 bit XP and the other an Intel Core i7 running 64 bit Win7.
Perhaps I am naive but I thought IEEE floating point maths was supposed to
give consistent results.

On 3 January 2016 at 23:05, Marius Kintel marius@kintel.net wrote:

..or:

$fn=3;
translate([10,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10,0,0]) cylinder(r = 4, h = 10);

Not sure why this happens. It would be nice if we could test if it’s
reproducible it in pure CGAL.

-Marius


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

Another test that shows CGAL is OK is this: fn=11; translate([10.1,0,0]) { cylinder(r = 4, h= 20); translate([0, 0, 100]) cube(); //dummy } translate([10.1,0,0]) { cylinder(r = 4, h = 10); translate([0, 0, 100]) cube(); //dummy } This gives the correct result showing if both cylinders pass through CGAL before being unioned they have numerically equal coordinates. When one is translated before it gets converted to CGAL format the union generates extra vertices. I think these are simply where two slightly different planes meet. On 4 January 2016 at 08:31, nop head <nop.head@gmail.com> wrote: > I tried it in an old version of OpenScad, 2013.06, which I assume only > does F6 in CGAL. That doesn't have the problem. > > Is it perhaps that translate produces a different result when the object > it gets is from CGAL? > > Another numerical issue I have noticed is when I generate Mendel90 on a > different PC, but with the same source files and the same old OpenScad > binary then some of the STL files are different. When I examined a simply > example I found one vertex on a circle had a different Y ordinate that > differed by one in the last floating point digit. One is an Intel Core2 Duo > running 32 bit XP and the other an Intel Core i7 running 64 bit Win7. > Perhaps I am naive but I thought IEEE floating point maths was supposed to > give consistent results. > > On 3 January 2016 at 23:05, Marius Kintel <marius@kintel.net> wrote: > >> ..or: >> >> $fn=3; >> translate([10,0,0]) { >> cylinder(r = 4, h= 20); >> translate([0, 0, 100]) cube(); //dummy >> } >> translate([10,0,0]) cylinder(r = 4, h = 10); >> >> Not sure why this happens. It would be nice if we could test if it’s >> reproducible it in pure CGAL. >> >> -Marius >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >
NH
nop head
Mon, Jan 4, 2016 11:55 AM

BTW, what precision does OpenScad use for evaluating expressions in the
source code?

On 4 January 2016 at 08:42, nop head nop.head@gmail.com wrote:

Another test that shows CGAL is OK is this:

fn=11;
translate([10.1,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10.1,0,0]) {
cylinder(r = 4, h = 10);
translate([0, 0, 100]) cube(); //dummy
}

This gives the correct result showing if both cylinders pass through CGAL
before being unioned they have numerically equal coordinates. When one is
translated before it gets converted to CGAL format the union generates
extra vertices. I think these are simply where two slightly different
planes meet.

On 4 January 2016 at 08:31, nop head nop.head@gmail.com wrote:

I tried it in an old version of OpenScad, 2013.06, which I assume only
does F6 in CGAL. That doesn't have the problem.

Is it perhaps that translate produces a different result when the object
it gets is from CGAL?

Another numerical issue I have noticed is when I generate Mendel90 on a
different PC, but with the same source files and the same old OpenScad
binary then some of the STL files are different. When I examined a simply
example I found one vertex on a circle had a different Y ordinate that
differed by one in the last floating point digit. One is an Intel Core2 Duo
running 32 bit XP and the other an Intel Core i7 running 64 bit Win7.
Perhaps I am naive but I thought IEEE floating point maths was supposed to
give consistent results.

On 3 January 2016 at 23:05, Marius Kintel marius@kintel.net wrote:

..or:

$fn=3;
translate([10,0,0]) {
cylinder(r = 4, h= 20);
translate([0, 0, 100]) cube(); //dummy
}
translate([10,0,0]) cylinder(r = 4, h = 10);

Not sure why this happens. It would be nice if we could test if it’s
reproducible it in pure CGAL.

-Marius


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

BTW, what precision does OpenScad use for evaluating expressions in the source code? On 4 January 2016 at 08:42, nop head <nop.head@gmail.com> wrote: > Another test that shows CGAL is OK is this: > > fn=11; > translate([10.1,0,0]) { > cylinder(r = 4, h= 20); > translate([0, 0, 100]) cube(); //dummy > } > translate([10.1,0,0]) { > cylinder(r = 4, h = 10); > translate([0, 0, 100]) cube(); //dummy > } > > This gives the correct result showing if both cylinders pass through CGAL > before being unioned they have numerically equal coordinates. When one is > translated before it gets converted to CGAL format the union generates > extra vertices. I think these are simply where two slightly different > planes meet. > > On 4 January 2016 at 08:31, nop head <nop.head@gmail.com> wrote: > >> I tried it in an old version of OpenScad, 2013.06, which I assume only >> does F6 in CGAL. That doesn't have the problem. >> >> Is it perhaps that translate produces a different result when the object >> it gets is from CGAL? >> >> Another numerical issue I have noticed is when I generate Mendel90 on a >> different PC, but with the same source files and the same old OpenScad >> binary then some of the STL files are different. When I examined a simply >> example I found one vertex on a circle had a different Y ordinate that >> differed by one in the last floating point digit. One is an Intel Core2 Duo >> running 32 bit XP and the other an Intel Core i7 running 64 bit Win7. >> Perhaps I am naive but I thought IEEE floating point maths was supposed to >> give consistent results. >> >> On 3 January 2016 at 23:05, Marius Kintel <marius@kintel.net> wrote: >> >>> ..or: >>> >>> $fn=3; >>> translate([10,0,0]) { >>> cylinder(r = 4, h= 20); >>> translate([0, 0, 100]) cube(); //dummy >>> } >>> translate([10,0,0]) cylinder(r = 4, h = 10); >>> >>> Not sure why this happens. It would be nice if we could test if it’s >>> reproducible it in pure CGAL. >>> >>> -Marius >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >> >> >