discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

rendering for paper assembly manual...

NH
nop head
Tue, Jan 17, 2017 12:36 PM

What it is weird to me (besides many other things, for sure) is that CGAL

accepts uncritically any polyhedron even with a self-interceptions without
a warning. Only when we do a boolean operation it  complains.

Modern versions of OpenSCAD only involve CGAL when you do boolean ops. That
is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and get
the simple output:

Top level object is a 3D object:

Facets: 6

CGAL has not been used at all. When it is you get:

Top level object is a 3D object:

Simple: yes

Vertices: 8

Halfedges: 24

Edges: 12

Halffacets: 12

Facets: 6

Volumes: 2

On 17 January 2017 at 12:21, Ronaldo rcmpersiano@gmail.com wrote:

@Parkinbot.

I think I need a new computer: the render of your code with the cube took
almost 7min! But that is really fast for a model with 91260 vertices and
94302 facets.

I understand your point of what you call a lazy union. I have tried before
to produce one polyhedron with thousand spheres with such surprising
results. The way you have conceived your multiple sweep is similar to the
way I have been stitching my surface-bounded models. However, I usually
does
not use this union inside polyhedron.

What it is weird to me (besides many other things, for sure) is that CGAL
accepts uncritically any polyhedron even with self-interceptions without a
warning. Only when we do a boolean operation it  complains. Try this:

X = 100;
Y = 100;

// generate object array
dat2union = [for(x=[0:17:X], y=[0:17:Y]) sweep_(TF(x, y, Cyl()))];

Now the cylinders overlap but you will be able to render it without any
warning. And generate an STL file. Corrupted, of course.

Finally, I am surprised that you have embraced the new C-like for and got a
neat non-recursive version of what I call an accumulated sum function:

function acc_sum(l) =
[for(i=0, sum=0; i<len(l); sum=sum+l[i], i=i+1) sum];
</quote>

--
View this message in context: http://forum.openscad.org/
rendering-for-paper-assembly-manual-tp20108p20134.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

>What it is weird to me (besides many other things, for sure) is that CGAL accepts uncritically any polyhedron even with a self-interceptions without a warning. Only when we do a boolean operation it complains. Modern versions of OpenSCAD only involve CGAL when you do boolean ops. That is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and get the simple output: Top level object is a 3D object: Facets: 6 CGAL has not been used at all. When it is you get: Top level object is a 3D object: Simple: yes Vertices: 8 Halfedges: 24 Edges: 12 Halffacets: 12 Facets: 6 Volumes: 2 On 17 January 2017 at 12:21, Ronaldo <rcmpersiano@gmail.com> wrote: > @Parkinbot. > > I think I need a new computer: the render of your code with the cube took > almost 7min! But that is really fast for a model with 91260 vertices and > 94302 facets. > > I understand your point of what you call a lazy union. I have tried before > to produce one polyhedron with thousand spheres with such surprising > results. The way you have conceived your multiple sweep is similar to the > way I have been stitching my surface-bounded models. However, I usually > does > not use this union inside polyhedron. > > What it is weird to me (besides many other things, for sure) is that CGAL > accepts uncritically any polyhedron even with self-interceptions without a > warning. Only when we do a boolean operation it complains. Try this: > > > X = 100; > > Y = 100; > > > > // generate object array > > dat2union = [for(x=[0:17:X], y=[0:17:Y]) sweep_(TF(x, y, Cyl()))]; > > Now the cylinders overlap but you will be able to render it without any > warning. And generate an STL file. Corrupted, of course. > > Finally, I am surprised that you have embraced the new C-like for and got a > neat non-recursive version of what I call an accumulated sum function: > > function acc_sum(l) = > [for(i=0, sum=0; i<len(l); sum=sum+l[i], i=i+1) sum]; > &lt;/quote> > > > > > -- > View this message in context: http://forum.openscad.org/ > rendering-for-paper-assembly-manual-tp20108p20134.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 >
R
Ronaldo
Tue, Jan 17, 2017 12:46 PM

Now I understand why you come up with this discussion in this thread. But I
think it is important enough to have its own.

Surely an import() function would have an huge impact on the ability to do
many now unthinkable tasks on user space. The many questions arising here
asking for some way to inquire model evidence that. It would open, for
instance, the possibility to crate organic models (forks included) by
applying subdivision methods to a triangulated model generated by boolean
operations.

--
View this message in context: http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20136.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Now I understand why you come up with this discussion in this thread. But I think it is important enough to have its own. Surely an import() function would have an huge impact on the ability to do many now unthinkable tasks on user space. The many questions arising here asking for some way to inquire model evidence that. It would open, for instance, the possibility to crate organic models (forks included) by applying subdivision methods to a triangulated model generated by boolean operations. -- View this message in context: http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20136.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Tue, Jan 17, 2017 12:54 PM

nophead wrote

Modern versions of OpenSCAD only involve CGAL when you do boolean ops.
That
is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and get
the simple output:

Top level object is a 3D object:

Facets: 6

CGAL has not been used at all. When it is you get:

Top level object is a 3D object:

Simple: yes

Vertices: 8

Halfedges: 24

Edges: 12

Halffacets: 12

Facets: 6

Volumes: 2

Well, I am using version 2016.11.11 . And the F6 console output for that
code with the overlapping cylinder is:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 9
Geometry cache size in bytes: 10156352
CGAL Polyhedrons in cache: 3
CGAL cache size in bytes: 62744592
Total rendering time: 0 hours, 0 minutes, 1 seconds
Top level object is a 3D object:
Facets:      2232
Rendering finished.

--
View this message in context: http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20137.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

nophead wrote > Modern versions of OpenSCAD only involve CGAL when you do boolean ops. > That > is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and get > the simple output: > > Top level object is a 3D object: > > Facets: 6 > > > CGAL has not been used at all. When it is you get: > > Top level object is a 3D object: > > Simple: yes > > Vertices: 8 > > Halfedges: 24 > > Edges: 12 > > Halffacets: 12 > > Facets: 6 > > Volumes: 2 Well, I am using version 2016.11.11 . And the F6 console output for that code with the overlapping cylinder is: > Compiling design (CSG Tree generation)... > Rendering Polygon Mesh using CGAL... > Geometries in cache: 9 > Geometry cache size in bytes: 10156352 > CGAL Polyhedrons in cache: 3 > CGAL cache size in bytes: 62744592 > Total rendering time: 0 hours, 0 minutes, 1 seconds > Top level object is a 3D object: > Facets: 2232 > Rendering finished. -- View this message in context: http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20137.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Tue, Jan 17, 2017 1:05 PM

Yes because CGAL hasn't been called as there are no boolean ops, just a
polyhedron.

When you add a cube to the original, non overlapping, cylinders you get the
slow CGAL union and the long form output. Without it you get the short form
output.

On 17 January 2017 at 12:54, Ronaldo rcmpersiano@gmail.com wrote:

nophead wrote

Modern versions of OpenSCAD only involve CGAL when you do boolean ops.
That
is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and

get

the simple output:

Top level object is a 3D object:

Facets: 6

CGAL has not been used at all. When it is you get:

Top level object is a 3D object:

Simple: yes

Vertices: 8

Halfedges: 24

Edges: 12

Halffacets: 12

Facets: 6

Volumes: 2

Well, I am using version 2016.11.11 . And the F6 console output for that
code with the overlapping cylinder is:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 9
Geometry cache size in bytes: 10156352
CGAL Polyhedrons in cache: 3
CGAL cache size in bytes: 62744592
Total rendering time: 0 hours, 0 minutes, 1 seconds
Top level object is a 3D object:
Facets:      2232
Rendering finished.

--
View this message in context: http://forum.openscad.org/
rendering-for-paper-assembly-manual-tp20108p20137.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

Yes because CGAL hasn't been called as there are no boolean ops, just a polyhedron. When you add a cube to the original, non overlapping, cylinders you get the slow CGAL union and the long form output. Without it you get the short form output. On 17 January 2017 at 12:54, Ronaldo <rcmpersiano@gmail.com> wrote: > nophead wrote > > Modern versions of OpenSCAD only involve CGAL when you do boolean ops. > > That > > is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and > get > > the simple output: > > > > Top level object is a 3D object: > > > > Facets: 6 > > > > > > CGAL has not been used at all. When it is you get: > > > > Top level object is a 3D object: > > > > Simple: yes > > > > Vertices: 8 > > > > Halfedges: 24 > > > > Edges: 12 > > > > Halffacets: 12 > > > > Facets: 6 > > > > Volumes: 2 > > Well, I am using version 2016.11.11 . And the F6 console output for that > code with the overlapping cylinder is: > > > Compiling design (CSG Tree generation)... > > Rendering Polygon Mesh using CGAL... > > Geometries in cache: 9 > > Geometry cache size in bytes: 10156352 > > CGAL Polyhedrons in cache: 3 > > CGAL cache size in bytes: 62744592 > > Total rendering time: 0 hours, 0 minutes, 1 seconds > > Top level object is a 3D object: > > Facets: 2232 > > Rendering finished. > > > > > > -- > View this message in context: http://forum.openscad.org/ > rendering-for-paper-assembly-manual-tp20108p20137.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 >
J
jon
Tue, Jan 17, 2017 1:10 PM

Is this kind of detailed understanding of CGAL written down somewhere?
It could be useful to anyone who is trying to speed optimize.

Jon

On 1/17/2017 8:05 AM, nop head wrote:

Yes because CGAL hasn't been called as there are no boolean ops, just
a polyhedron.

When you add a cube to the original, non overlapping, cylinders you
get the slow CGAL union and the long form output. Without it you get
the short form output.

On 17 January 2017 at 12:54, Ronaldo <rcmpersiano@gmail.com
mailto:rcmpersiano@gmail.com> wrote:

 nophead wrote

Modern versions of OpenSCAD only involve CGAL when you do

 boolean ops.

That
is why CGAL doesn't complain. It hasn't see it yet. When you do

 F6 and get

the simple output:

Top level object is a 3D object:

Facets: 6

CGAL has not been used at all. When it is you get:

Top level object is a 3D object:

Simple: yes

Vertices: 8

Halfedges: 24

Edges: 12

Halffacets: 12

Facets: 6

Volumes: 2

 Well, I am using version 2016.11.11 . And the F6 console output
 for that
 code with the overlapping cylinder is:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 9
Geometry cache size in bytes: 10156352
CGAL Polyhedrons in cache: 3
CGAL cache size in bytes: 62744592
Total rendering time: 0 hours, 0 minutes, 1 seconds
Top level object is a 3D object:
Facets:      2232
Rendering finished.

 --
 View this message in context:
 http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20137.html
 <http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20137.html>
 Sent from the OpenSCAD mailing list archive at Nabble.com.

 _______________________________________________
 OpenSCAD mailing list
 Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
 http://lists.openscad.org/mailman/listinfo/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

No virus found in this message.
Checked by AVG - www.avg.com http://www.avg.com/email-signature
Version: 2016.0.7996 / Virus Database: 4749/13786 - Release Date: 01/17/17

Is this kind of detailed understanding of CGAL written down somewhere? It could be useful to anyone who is trying to speed optimize. Jon On 1/17/2017 8:05 AM, nop head wrote: > Yes because CGAL hasn't been called as there are no boolean ops, just > a polyhedron. > > When you add a cube to the original, non overlapping, cylinders you > get the slow CGAL union and the long form output. Without it you get > the short form output. > > On 17 January 2017 at 12:54, Ronaldo <rcmpersiano@gmail.com > <mailto:rcmpersiano@gmail.com>> wrote: > > nophead wrote > > Modern versions of OpenSCAD only involve CGAL when you do > boolean ops. > > That > > is why CGAL doesn't complain. It hasn't see it yet. When you do > F6 and get > > the simple output: > > > > Top level object is a 3D object: > > > > Facets: 6 > > > > > > CGAL has not been used at all. When it is you get: > > > > Top level object is a 3D object: > > > > Simple: yes > > > > Vertices: 8 > > > > Halfedges: 24 > > > > Edges: 12 > > > > Halffacets: 12 > > > > Facets: 6 > > > > Volumes: 2 > > Well, I am using version 2016.11.11 . And the F6 console output > for that > code with the overlapping cylinder is: > > > Compiling design (CSG Tree generation)... > > Rendering Polygon Mesh using CGAL... > > Geometries in cache: 9 > > Geometry cache size in bytes: 10156352 > > CGAL Polyhedrons in cache: 3 > > CGAL cache size in bytes: 62744592 > > Total rendering time: 0 hours, 0 minutes, 1 seconds > > Top level object is a 3D object: > > Facets: 2232 > > Rendering finished. > > > > > > -- > View this message in context: > http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20137.html > <http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20137.html> > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/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 > > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com/email-signature> > Version: 2016.0.7996 / Virus Database: 4749/13786 - Release Date: 01/17/17 >
R
Ronaldo
Tue, Jan 17, 2017 1:40 PM

nophead wrote

Yes because CGAL hasn't been called as there are no boolean ops, just a
polyhedron.

When you add a cube to the original, non overlapping, cylinders you get
the
slow CGAL union and the long form output. Without it you get the short
form
output.

I have tried the Parkinbot lazy union  some few months ago
http://forum.openscad.org/STL-without-render-tc17503.html#a17543  with
good results. I modified that example to overlapping spheres (all in one
same polyhedron). The code is the following:

n = 20; // $fn
m = n/2;
N = 20; // number of spheres
radius = 10;

unitary_circle = [ for(i=[0:n]) [ cos(360i/n), sin(360i/n), 0 ] ];
// sphere
sphere_vertices  = radius*[ for( j=[-m/2:m/2], p=unitary_circle )
cos(180j/m) * p + [0, 0, sin(180j/m)] ];
nvert = len(sphere_vertices);

// triangulated faces of the sphere
faces = concat(
[ for(i=[0:n-1])
[ 0, n+i+1, n+i+2 ] ] ,
[ for(j=[1:m-1], i=[0:n-1])
[ (n+1)j+i+1, (n+1)j+i, (n+1)(j+1)+i ] ] ,
[ for(j=[1:m-1], i=[0:n-1])
[ (n+1)j+i+1, (n+1)(j+1)+i, (n+1)
(j+1)+i+1 ] ] ,
[ for(i=[0:n-1])
[ (n+1)(m-1)+i, (n+1)(m+1)-1, (n+1)*(m-1)+i+1] ] ) ;

// vertices of the union of N spheres
unispheres = [ for(k=[1:N], p=sphere_vertices) p+[17*k,0,0] ];

// facets of the union of N spheres
unifaces  = [ for(k=[1:N], f=faces) [for(i=f) i+nvert*(k-1) ] ];

difference(){
polyhedron( points = unispheres, faces = unifaces);
cube(50);
}
//sphere(10); // a regular sphere

As you see, I have included a boolean operation subtracting a cube. Using
version 2016.11.11 I have got the following F6 console output:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 5
Geometry cache size in bytes: 63999056
CGAL Polyhedrons in cache: 1
CGAL cache size in bytes: 4371632
Total rendering time: 0 hours, 0 minutes, 25 seconds
Top level object is a 3D object:
Simple:        yes
Vertices:    3569
Halfedges:  19968
Edges:        9984
Halffacets:  12902
Facets:      6451
Volumes:        19
Rendering finished.

It seems, according with what you said, that CGAL was really used. And it
doesn't give a single word of warning!

Worst than that, it produced an image. Enjoy it:

http://forum.openscad.org/file/n20140/CGALoutput.png

How do you explain that?

--
View this message in context: http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20140.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

nophead wrote > Yes because CGAL hasn't been called as there are no boolean ops, just a > polyhedron. > > When you add a cube to the original, non overlapping, cylinders you get > the > slow CGAL union and the long form output. Without it you get the short > form > output. I have tried the Parkinbot lazy union some few months ago <http://forum.openscad.org/STL-without-render-tc17503.html#a17543> with good results. I modified that example to overlapping spheres (all in one same polyhedron). The code is the following: > n = 20; // $fn > m = n/2; > N = 20; // number of spheres > radius = 10; > > unitary_circle = [ for(i=[0:n]) [ cos(360*i/n), sin(360*i/n), 0 ] ]; > // sphere > sphere_vertices = radius*[ for( j=[-m/2:m/2], p=unitary_circle ) > cos(180*j/m) * p + [0, 0, sin(180*j/m)] ]; > nvert = len(sphere_vertices); > > // triangulated faces of the sphere > faces = concat( > [ for(i=[0:n-1]) > [ 0, n+i+1, n+i+2 ] ] , > [ for(j=[1:m-1], i=[0:n-1]) > [ (n+1)*j+i+1, (n+1)*j+i, (n+1)*(j+1)+i ] ] , > [ for(j=[1:m-1], i=[0:n-1]) > [ (n+1)*j+i+1, (n+1)*(j+1)+i, (n+1)*(j+1)+i+1 ] ] , > [ for(i=[0:n-1]) > [ (n+1)*(m-1)+i, (n+1)*(m+1)-1, (n+1)*(m-1)+i+1] ] ) ; > > // vertices of the union of N spheres > unispheres = [ for(k=[1:N], p=sphere_vertices) p+[17*k,0,0] ]; > > // facets of the union of N spheres > unifaces = [ for(k=[1:N], f=faces) [for(i=f) i+nvert*(k-1) ] ]; > > difference(){ > polyhedron( points = unispheres, faces = unifaces); > cube(50); > } > //sphere(10); // a regular sphere As you see, I have included a boolean operation subtracting a cube. Using version 2016.11.11 I have got the following F6 console output: > Compiling design (CSG Tree generation)... > Rendering Polygon Mesh using CGAL... > Geometries in cache: 5 > Geometry cache size in bytes: 63999056 > CGAL Polyhedrons in cache: 1 > CGAL cache size in bytes: 4371632 > Total rendering time: 0 hours, 0 minutes, 25 seconds > Top level object is a 3D object: > Simple: yes > Vertices: 3569 > Halfedges: 19968 > Edges: 9984 > Halffacets: 12902 > Facets: 6451 > Volumes: 19 > Rendering finished. It seems, according with what you said, that CGAL was really used. And it doesn't give a single word of warning! Worst than that, it produced an image. Enjoy it: <http://forum.openscad.org/file/n20140/CGALoutput.png> How do you explain that? -- View this message in context: http://forum.openscad.org/rendering-for-paper-assembly-manual-tp20108p20140.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Tue, Jan 17, 2017 1:44 PM

How do you explain that?

CGAL

On 17 January 2017 at 13:40, Ronaldo rcmpersiano@gmail.com wrote:

nophead wrote

Yes because CGAL hasn't been called as there are no boolean ops, just a
polyhedron.

When you add a cube to the original, non overlapping, cylinders you get
the
slow CGAL union and the long form output. Without it you get the short
form
output.

I have tried the Parkinbot lazy union  some few months ago
http://forum.openscad.org/STL-without-render-tc17503.html#a17543  with
good results. I modified that example to overlapping spheres (all in one
same polyhedron). The code is the following:

n = 20; // $fn
m = n/2;
N = 20; // number of spheres
radius = 10;

unitary_circle = [ for(i=[0:n]) [ cos(360i/n), sin(360i/n), 0 ] ];
// sphere
sphere_vertices  = radius*[ for( j=[-m/2:m/2], p=unitary_circle )
cos(180j/m) * p + [0, 0, sin(180j/m)] ];
nvert = len(sphere_vertices);

// triangulated faces of the sphere
faces = concat(
[ for(i=[0:n-1])
[ 0, n+i+1, n+i+2 ] ] ,
[ for(j=[1:m-1], i=[0:n-1])
[ (n+1)j+i+1, (n+1)j+i, (n+1)(j+1)+i ] ] ,
[ for(j=[1:m-1], i=[0:n-1])
[ (n+1)j+i+1, (n+1)(j+1)+i, (n+1)
(j+1)+i+1 ] ] ,
[ for(i=[0:n-1])
[ (n+1)(m-1)+i, (n+1)(m+1)-1, (n+1)*(m-1)+i+1] ] )

;

// vertices of the union of N spheres
unispheres = [ for(k=[1:N], p=sphere_vertices) p+[17*k,0,0] ];

// facets of the union of N spheres
unifaces  = [ for(k=[1:N], f=faces) [for(i=f) i+nvert*(k-1) ] ];

difference(){
polyhedron( points = unispheres, faces = unifaces);
cube(50);
}
//sphere(10); // a regular sphere

As you see, I have included a boolean operation subtracting a cube. Using
version 2016.11.11 I have got the following F6 console output:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 5
Geometry cache size in bytes: 63999056
CGAL Polyhedrons in cache: 1
CGAL cache size in bytes: 4371632
Total rendering time: 0 hours, 0 minutes, 25 seconds
Top level object is a 3D object:
Simple:        yes
Vertices:    3569
Halfedges:  19968
Edges:        9984
Halffacets:  12902
Facets:      6451
Volumes:        19
Rendering finished.

It seems, according with what you said, that CGAL was really used. And it
doesn't give a single word of warning!

Worst than that, it produced an image. Enjoy it:

http://forum.openscad.org/file/n20140/CGALoutput.png

How do you explain that?

--
View this message in context: http://forum.openscad.org/
rendering-for-paper-assembly-manual-tp20108p20140.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

>How do you explain that? CGAL On 17 January 2017 at 13:40, Ronaldo <rcmpersiano@gmail.com> wrote: > nophead wrote > > Yes because CGAL hasn't been called as there are no boolean ops, just a > > polyhedron. > > > > When you add a cube to the original, non overlapping, cylinders you get > > the > > slow CGAL union and the long form output. Without it you get the short > > form > > output. > > I have tried the Parkinbot lazy union some few months ago > <http://forum.openscad.org/STL-without-render-tc17503.html#a17543> with > good results. I modified that example to overlapping spheres (all in one > same polyhedron). The code is the following: > > > n = 20; // $fn > > m = n/2; > > N = 20; // number of spheres > > radius = 10; > > > > unitary_circle = [ for(i=[0:n]) [ cos(360*i/n), sin(360*i/n), 0 ] ]; > > // sphere > > sphere_vertices = radius*[ for( j=[-m/2:m/2], p=unitary_circle ) > > cos(180*j/m) * p + [0, 0, sin(180*j/m)] ]; > > nvert = len(sphere_vertices); > > > > // triangulated faces of the sphere > > faces = concat( > > [ for(i=[0:n-1]) > > [ 0, n+i+1, n+i+2 ] ] , > > [ for(j=[1:m-1], i=[0:n-1]) > > [ (n+1)*j+i+1, (n+1)*j+i, (n+1)*(j+1)+i ] ] , > > [ for(j=[1:m-1], i=[0:n-1]) > > [ (n+1)*j+i+1, (n+1)*(j+1)+i, (n+1)*(j+1)+i+1 ] ] , > > [ for(i=[0:n-1]) > > [ (n+1)*(m-1)+i, (n+1)*(m+1)-1, (n+1)*(m-1)+i+1] ] ) > ; > > > > // vertices of the union of N spheres > > unispheres = [ for(k=[1:N], p=sphere_vertices) p+[17*k,0,0] ]; > > > > // facets of the union of N spheres > > unifaces = [ for(k=[1:N], f=faces) [for(i=f) i+nvert*(k-1) ] ]; > > > > difference(){ > > polyhedron( points = unispheres, faces = unifaces); > > cube(50); > > } > > //sphere(10); // a regular sphere > > As you see, I have included a boolean operation subtracting a cube. Using > version 2016.11.11 I have got the following F6 console output: > > > Compiling design (CSG Tree generation)... > > Rendering Polygon Mesh using CGAL... > > Geometries in cache: 5 > > Geometry cache size in bytes: 63999056 > > CGAL Polyhedrons in cache: 1 > > CGAL cache size in bytes: 4371632 > > Total rendering time: 0 hours, 0 minutes, 25 seconds > > Top level object is a 3D object: > > Simple: yes > > Vertices: 3569 > > Halfedges: 19968 > > Edges: 9984 > > Halffacets: 12902 > > Facets: 6451 > > Volumes: 19 > > Rendering finished. > > It seems, according with what you said, that CGAL was really used. And it > doesn't give a single word of warning! > > Worst than that, it produced an image. Enjoy it: > > <http://forum.openscad.org/file/n20140/CGALoutput.png> > > How do you explain that? > > > > -- > View this message in context: http://forum.openscad.org/ > rendering-for-paper-assembly-manual-tp20108p20140.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 >
NH
nop head
Tue, Jan 17, 2017 1:46 PM

How do you explain that?

CGAL expects the inputs to be manifold but it doesn't report all non
manifold meshes, just some of them.

On 17 January 2017 at 13:44, nop head nop.head@gmail.com wrote:

How do you explain that?

CGAL

On 17 January 2017 at 13:40, Ronaldo rcmpersiano@gmail.com wrote:

nophead wrote

Yes because CGAL hasn't been called as there are no boolean ops, just a
polyhedron.

When you add a cube to the original, non overlapping, cylinders you get
the
slow CGAL union and the long form output. Without it you get the short
form
output.

I have tried the Parkinbot lazy union  some few months ago
http://forum.openscad.org/STL-without-render-tc17503.html#a17543  with
good results. I modified that example to overlapping spheres (all in one
same polyhedron). The code is the following:

n = 20; // $fn
m = n/2;
N = 20; // number of spheres
radius = 10;

unitary_circle = [ for(i=[0:n]) [ cos(360i/n), sin(360i/n), 0 ] ];
// sphere
sphere_vertices  = radius*[ for( j=[-m/2:m/2], p=unitary_circle )
cos(180j/m) * p + [0, 0, sin(180j/m)] ];
nvert = len(sphere_vertices);

// triangulated faces of the sphere
faces = concat(
[ for(i=[0:n-1])
[ 0, n+i+1, n+i+2 ] ] ,
[ for(j=[1:m-1], i=[0:n-1])
[ (n+1)j+i+1, (n+1)j+i, (n+1)(j+1)+i ] ] ,
[ for(j=[1:m-1], i=[0:n-1])
[ (n+1)j+i+1, (n+1)(j+1)+i, (n+1)
(j+1)+i+1 ] ] ,
[ for(i=[0:n-1])
[ (n+1)(m-1)+i, (n+1)(m+1)-1, (n+1)*(m-1)+i+1] ]

) ;

// vertices of the union of N spheres
unispheres = [ for(k=[1:N], p=sphere_vertices) p+[17*k,0,0] ];

// facets of the union of N spheres
unifaces  = [ for(k=[1:N], f=faces) [for(i=f) i+nvert*(k-1) ] ];

difference(){
polyhedron( points = unispheres, faces = unifaces);
cube(50);
}
//sphere(10); // a regular sphere

As you see, I have included a boolean operation subtracting a cube. Using
version 2016.11.11 I have got the following F6 console output:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 5
Geometry cache size in bytes: 63999056
CGAL Polyhedrons in cache: 1
CGAL cache size in bytes: 4371632
Total rendering time: 0 hours, 0 minutes, 25 seconds
Top level object is a 3D object:
Simple:        yes
Vertices:    3569
Halfedges:  19968
Edges:        9984
Halffacets:  12902
Facets:      6451
Volumes:        19
Rendering finished.

It seems, according with what you said, that CGAL was really used. And it
doesn't give a single word of warning!

Worst than that, it produced an image. Enjoy it:

http://forum.openscad.org/file/n20140/CGALoutput.png

How do you explain that?

--
View this message in context: http://forum.openscad.org/rend
ering-for-paper-assembly-manual-tp20108p20140.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

>How do you explain that? CGAL expects the inputs to be manifold but it doesn't report all non manifold meshes, just some of them. On 17 January 2017 at 13:44, nop head <nop.head@gmail.com> wrote: > >How do you explain that? > > CGAL > > On 17 January 2017 at 13:40, Ronaldo <rcmpersiano@gmail.com> wrote: > >> nophead wrote >> > Yes because CGAL hasn't been called as there are no boolean ops, just a >> > polyhedron. >> > >> > When you add a cube to the original, non overlapping, cylinders you get >> > the >> > slow CGAL union and the long form output. Without it you get the short >> > form >> > output. >> >> I have tried the Parkinbot lazy union some few months ago >> <http://forum.openscad.org/STL-without-render-tc17503.html#a17543> with >> good results. I modified that example to overlapping spheres (all in one >> same polyhedron). The code is the following: >> >> > n = 20; // $fn >> > m = n/2; >> > N = 20; // number of spheres >> > radius = 10; >> > >> > unitary_circle = [ for(i=[0:n]) [ cos(360*i/n), sin(360*i/n), 0 ] ]; >> > // sphere >> > sphere_vertices = radius*[ for( j=[-m/2:m/2], p=unitary_circle ) >> > cos(180*j/m) * p + [0, 0, sin(180*j/m)] ]; >> > nvert = len(sphere_vertices); >> > >> > // triangulated faces of the sphere >> > faces = concat( >> > [ for(i=[0:n-1]) >> > [ 0, n+i+1, n+i+2 ] ] , >> > [ for(j=[1:m-1], i=[0:n-1]) >> > [ (n+1)*j+i+1, (n+1)*j+i, (n+1)*(j+1)+i ] ] , >> > [ for(j=[1:m-1], i=[0:n-1]) >> > [ (n+1)*j+i+1, (n+1)*(j+1)+i, (n+1)*(j+1)+i+1 ] ] , >> > [ for(i=[0:n-1]) >> > [ (n+1)*(m-1)+i, (n+1)*(m+1)-1, (n+1)*(m-1)+i+1] ] >> ) ; >> > >> > // vertices of the union of N spheres >> > unispheres = [ for(k=[1:N], p=sphere_vertices) p+[17*k,0,0] ]; >> > >> > // facets of the union of N spheres >> > unifaces = [ for(k=[1:N], f=faces) [for(i=f) i+nvert*(k-1) ] ]; >> > >> > difference(){ >> > polyhedron( points = unispheres, faces = unifaces); >> > cube(50); >> > } >> > //sphere(10); // a regular sphere >> >> As you see, I have included a boolean operation subtracting a cube. Using >> version 2016.11.11 I have got the following F6 console output: >> >> > Compiling design (CSG Tree generation)... >> > Rendering Polygon Mesh using CGAL... >> > Geometries in cache: 5 >> > Geometry cache size in bytes: 63999056 >> > CGAL Polyhedrons in cache: 1 >> > CGAL cache size in bytes: 4371632 >> > Total rendering time: 0 hours, 0 minutes, 25 seconds >> > Top level object is a 3D object: >> > Simple: yes >> > Vertices: 3569 >> > Halfedges: 19968 >> > Edges: 9984 >> > Halffacets: 12902 >> > Facets: 6451 >> > Volumes: 19 >> > Rendering finished. >> >> It seems, according with what you said, that CGAL was really used. And it >> doesn't give a single word of warning! >> >> Worst than that, it produced an image. Enjoy it: >> >> <http://forum.openscad.org/file/n20140/CGALoutput.png> >> >> How do you explain that? >> >> >> >> -- >> View this message in context: http://forum.openscad.org/rend >> ering-for-paper-assembly-manual-tp20108p20140.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 >> > >
NH
nop head
Tue, Jan 17, 2017 1:48 PM

Is this kind of detailed understanding of CGAL written down somewhere?

I don't think so. I just cleaned if from following this mailing list.
Originally OpenSCAD did all the F6 work in CGAL but to speed it up the
easier bits have been done outside of it. All the 2D stuff and things like
linear_extrude. It produces issues because different number representations
are used in 2D, 3D inside CGAL and 3D outside CGAL.

On 17 January 2017 at 13:10, jon jon@jonbondy.com wrote:

Is this kind of detailed understanding of CGAL written down somewhere?  It
could be useful to anyone who is trying to speed optimize.

Jon

On 1/17/2017 8:05 AM, nop head wrote:

Yes because CGAL hasn't been called as there are no boolean ops, just a
polyhedron.

When you add a cube to the original, non overlapping, cylinders you get
the slow CGAL union and the long form output. Without it you get the short
form output.

On 17 January 2017 at 12:54, Ronaldo rcmpersiano@gmail.com wrote:

nophead wrote

Modern versions of OpenSCAD only involve CGAL when you do boolean ops.
That
is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and

get

the simple output:

Top level object is a 3D object:

Facets: 6

CGAL has not been used at all. When it is you get:

Top level object is a 3D object:

Simple: yes

Vertices: 8

Halfedges: 24

Edges: 12

Halffacets: 12

Facets: 6

Volumes: 2

Well, I am using version 2016.11.11 . And the F6 console output for that
code with the overlapping cylinder is:

Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 9
Geometry cache size in bytes: 10156352
CGAL Polyhedrons in cache: 3
CGAL cache size in bytes: 62744592
Total rendering time: 0 hours, 0 minutes, 1 seconds
Top level object is a 3D object:
Facets:      2232
Rendering finished.

--
View this message in context: http://forum.openscad.org/rend
ering-for-paper-assembly-manual-tp20108p20137.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


OpenSCAD mailing listDiscuss@lists.openscad.orghttp://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

No virus found in this message.
Checked by AVG - www.avg.com http://www.avg.com/email-signature
Version: 2016.0.7996 / Virus Database: 4749/13786 - Release Date: 01/17/17


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

>Is this kind of detailed understanding of CGAL written down somewhere? I don't think so. I just cleaned if from following this mailing list. Originally OpenSCAD did all the F6 work in CGAL but to speed it up the easier bits have been done outside of it. All the 2D stuff and things like linear_extrude. It produces issues because different number representations are used in 2D, 3D inside CGAL and 3D outside CGAL. On 17 January 2017 at 13:10, jon <jon@jonbondy.com> wrote: > Is this kind of detailed understanding of CGAL written down somewhere? It > could be useful to anyone who is trying to speed optimize. > > Jon > > On 1/17/2017 8:05 AM, nop head wrote: > > Yes because CGAL hasn't been called as there are no boolean ops, just a > polyhedron. > > When you add a cube to the original, non overlapping, cylinders you get > the slow CGAL union and the long form output. Without it you get the short > form output. > > On 17 January 2017 at 12:54, Ronaldo <rcmpersiano@gmail.com> wrote: > >> nophead wrote >> > Modern versions of OpenSCAD only involve CGAL when you do boolean ops. >> > That >> > is why CGAL doesn't complain. It hasn't see it yet. When you do F6 and >> get >> > the simple output: >> > >> > Top level object is a 3D object: >> > >> > Facets: 6 >> > >> > >> > CGAL has not been used at all. When it is you get: >> > >> > Top level object is a 3D object: >> > >> > Simple: yes >> > >> > Vertices: 8 >> > >> > Halfedges: 24 >> > >> > Edges: 12 >> > >> > Halffacets: 12 >> > >> > Facets: 6 >> > >> > Volumes: 2 >> >> Well, I am using version 2016.11.11 . And the F6 console output for that >> code with the overlapping cylinder is: >> >> > Compiling design (CSG Tree generation)... >> > Rendering Polygon Mesh using CGAL... >> > Geometries in cache: 9 >> > Geometry cache size in bytes: 10156352 >> > CGAL Polyhedrons in cache: 3 >> > CGAL cache size in bytes: 62744592 >> > Total rendering time: 0 hours, 0 minutes, 1 seconds >> > Top level object is a 3D object: >> > Facets: 2232 >> > Rendering finished. >> >> >> >> >> >> -- >> View this message in context: http://forum.openscad.org/rend >> ering-for-paper-assembly-manual-tp20108p20137.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 >> > > > > _______________________________________________ > OpenSCAD mailing listDiscuss@lists.openscad.orghttp://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com/email-signature> > Version: 2016.0.7996 / Virus Database: 4749/13786 - Release Date: 01/17/17 > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
RP
Ronaldo Persiano
Tue, Jan 17, 2017 1:48 PM

2017-01-17 11:46 GMT-02:00 nop head nop.head@gmail.com:

How do you explain that?

CGAL expects the inputs to be manifold but it doesn't report all non
manifold meshes, just some of them.

On 17 January 2017 at 13:44, nop head nop.head@gmail.com wrote:

How do you explain that?

CGAL

Cool.

2017-01-17 11:46 GMT-02:00 nop head <nop.head@gmail.com>: > >How do you explain that? > > CGAL expects the inputs to be manifold but it doesn't report all non > manifold meshes, just some of them. > > On 17 January 2017 at 13:44, nop head <nop.head@gmail.com> wrote: > >> >How do you explain that? >> >> CGAL >> >> Cool.