discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Simple Render Consuming Large Amounts of Memory

IP
Ignacio Partarrieu
Thu, Mar 31, 2016 9:53 AM

Hi,

I'm using OpenSCAD to render a simple formation, but it is currently taking up an inordinate amount of time and memory to do it. This is the first time I've encountered such a problem, even though I've rendered far more complex shapes in the past.

Here is the code in question:

r=4;
res=100;
for (i=[-1:2:1]){
for (j=[-1:2:1]){
for (k=[-1:2:1]){
translate([ri,rj,r*k]){
sphere(r, $fn=res);
}
}
}
}

OpenSCAD has no problem creating a preview for this however. Thinking this might be caused by infinitesimal overlap of the spheres I tried both changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command to no avail. Rendering a single sphere is almost instant with these parameters. Is there a reason why it is suddenly stalling?

Thanks for your help.

Hi, I'm using OpenSCAD to render a simple formation, but it is currently taking up an inordinate amount of time and memory to do it. This is the first time I've encountered such a problem, even though I've rendered far more complex shapes in the past. Here is the code in question: r=4; res=100; for (i=[-1:2:1]){ for (j=[-1:2:1]){ for (k=[-1:2:1]){ translate([r*i,r*j,r*k]){ sphere(r, $fn=res); } } } } OpenSCAD has no problem creating a preview for this however. Thinking this might be caused by infinitesimal overlap of the spheres I tried both changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command to no avail. Rendering a single sphere is almost instant with these parameters. Is there a reason why it is suddenly stalling? Thanks for your help.
NH
nop head
Thu, Mar 31, 2016 11:33 AM

The result of union touching spheres is non manifold so I changed it to
sphere(r - 0.1, $fn=res);

The number of vertices in a sphere goes up as the square of $fn and CGAL is
very slow for high vertex counts, even when it has nothing to do as with
non overlapping objects. It takes 219 seconds for res=100 on my machine but
only 12 for res = 30.

On 31 March 2016 at 10:53, Ignacio Partarrieu <
ignacio.partarrieu@postgrad.manchester.ac.uk> wrote:

Hi,

I'm using OpenSCAD to render a simple formation, but it is currently
taking up an inordinate amount of time and memory to do it. This is the
first time I've encountered such a problem, even though I've rendered far
more complex shapes in the past.

Here is the code in question:

r=4;
res=100;
for (i=[-1:2:1]){
for (j=[-1:2:1]){
for (k=[-1:2:1]){
translate([ri,rj,r*k]){
sphere(r, $fn=res);
}
}
}
}

OpenSCAD has no problem creating a preview for this however. Thinking this
might be caused by infinitesimal overlap of the spheres I tried both
changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command to
no avail. Rendering a single sphere is almost instant with these
parameters. Is there a reason why it is suddenly stalling?

Thanks for your help.


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

The result of union touching spheres is non manifold so I changed it to sphere(r - 0.1, $fn=res); The number of vertices in a sphere goes up as the square of $fn and CGAL is very slow for high vertex counts, even when it has nothing to do as with non overlapping objects. It takes 219 seconds for res=100 on my machine but only 12 for res = 30. On 31 March 2016 at 10:53, Ignacio Partarrieu < ignacio.partarrieu@postgrad.manchester.ac.uk> wrote: > Hi, > > > I'm using OpenSCAD to render a simple formation, but it is currently > taking up an inordinate amount of time and memory to do it. This is the > first time I've encountered such a problem, even though I've rendered far > more complex shapes in the past. > > > Here is the code in question: > > > r=4; > res=100; > for (i=[-1:2:1]){ > for (j=[-1:2:1]){ > for (k=[-1:2:1]){ > translate([r*i,r*j,r*k]){ > sphere(r, $fn=res); > } > } > } > } > > OpenSCAD has no problem creating a preview for this however. Thinking this > might be caused by infinitesimal overlap of the spheres I tried both > changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command to > no avail. Rendering a single sphere is almost instant with these > parameters. Is there a reason why it is suddenly stalling? > > > Thanks for your help. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
IP
Ignacio Partarrieu
Thu, Mar 31, 2016 12:02 PM

Thanks for your rapid reply.

Alright, so it's mainly to do with number of vertices then. How is this impacted by the number of objects though? One sphere at res=100 renders almost instantly. Why would 8 take so much longer?

Furthermore, would OpenSCAD be able to render just one sphere and then just copy that render to different positions to speed things up? Or is that computationally impossible?


From: Discuss discuss-bounces@lists.openscad.org on behalf of nop head nop.head@gmail.com
Sent: 31 March 2016 12:33
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] Simple Render Consuming Large Amounts of Memory

The result of union touching spheres is non manifold so I changed it to sphere(r - 0.1, $fn=res);

The number of vertices in a sphere goes up as the square of $fn and CGAL is very slow for high vertex counts, even when it has nothing to do as with non overlapping objects. It takes 219 seconds for res=100 on my machine but only 12 for res = 30.

On 31 March 2016 at 10:53, Ignacio Partarrieu <ignacio.partarrieu@postgrad.manchester.ac.ukmailto:ignacio.partarrieu@postgrad.manchester.ac.uk> wrote:

Hi,

I'm using OpenSCAD to render a simple formation, but it is currently taking up an inordinate amount of time and memory to do it. This is the first time I've encountered such a problem, even though I've rendered far more complex shapes in the past.

Here is the code in question:

r=4;
res=100;
for (i=[-1:2:1]){
for (j=[-1:2:1]){
for (k=[-1:2:1]){
translate([ri,rj,r*k]){
sphere(r, $fn=res);
}
}
}
}

OpenSCAD has no problem creating a preview for this however. Thinking this might be caused by infinitesimal overlap of the spheres I tried both changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command to no avail. Rendering a single sphere is almost instant with these parameters. Is there a reason why it is suddenly stalling?

Thanks for your help.


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

Thanks for your rapid reply. Alright, so it's mainly to do with number of vertices then. How is this impacted by the number of objects though? One sphere at res=100 renders almost instantly. Why would 8 take so much longer? Furthermore, would OpenSCAD be able to render just one sphere and then just copy that render to different positions to speed things up? Or is that computationally impossible? ________________________________ From: Discuss <discuss-bounces@lists.openscad.org> on behalf of nop head <nop.head@gmail.com> Sent: 31 March 2016 12:33 To: OpenSCAD general discussion Subject: Re: [OpenSCAD] Simple Render Consuming Large Amounts of Memory The result of union touching spheres is non manifold so I changed it to sphere(r - 0.1, $fn=res); The number of vertices in a sphere goes up as the square of $fn and CGAL is very slow for high vertex counts, even when it has nothing to do as with non overlapping objects. It takes 219 seconds for res=100 on my machine but only 12 for res = 30. On 31 March 2016 at 10:53, Ignacio Partarrieu <ignacio.partarrieu@postgrad.manchester.ac.uk<mailto:ignacio.partarrieu@postgrad.manchester.ac.uk>> wrote: Hi, I'm using OpenSCAD to render a simple formation, but it is currently taking up an inordinate amount of time and memory to do it. This is the first time I've encountered such a problem, even though I've rendered far more complex shapes in the past. Here is the code in question: r=4; res=100; for (i=[-1:2:1]){ for (j=[-1:2:1]){ for (k=[-1:2:1]){ translate([r*i,r*j,r*k]){ sphere(r, $fn=res); } } } } OpenSCAD has no problem creating a preview for this however. Thinking this might be caused by infinitesimal overlap of the spheres I tried both changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command to no avail. Rendering a single sphere is almost instant with these parameters. Is there a reason why it is suddenly stalling? Thanks for your help. _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org<mailto:Discuss@lists.openscad.org> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
NH
nop head
Thu, Mar 31, 2016 12:12 PM

With one sphere CGAL is not involved as there is no union. When there is
more than one CGAL is used to union them. To make it faster OpenScad could
detect objects that don't overlap and bypass CGAL as it is trivial to union
non-overlapping objects.

On 31 March 2016 at 13:02, Ignacio Partarrieu <
ignacio.partarrieu@postgrad.manchester.ac.uk> wrote:

Thanks for your rapid reply.

Alright, so it's mainly to do with number of vertices then. How is this
impacted by the number of objects though? One sphere at res=100 renders
almost instantly. Why would 8 take so much longer?

Furthermore, would OpenSCAD be able to render just one sphere and then
just copy that render to different positions to speed things up? Or is that
computationally impossible?


From: Discuss discuss-bounces@lists.openscad.org on behalf of nop
head nop.head@gmail.com
Sent: 31 March 2016 12:33
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] Simple Render Consuming Large Amounts of Memory

The result of union touching spheres is non manifold so I changed it to
sphere(r - 0.1, $fn=res);

The number of vertices in a sphere goes up as the square of $fn and CGAL
is very slow for high vertex counts, even when it has nothing to do as with
non overlapping objects. It takes 219 seconds for res=100 on my machine but
only 12 for res = 30.

On 31 March 2016 at 10:53, Ignacio Partarrieu <
ignacio.partarrieu@postgrad.manchester.ac.uk> wrote:

Hi,

I'm using OpenSCAD to render a simple formation, but it is currently
taking up an inordinate amount of time and memory to do it. This is the
first time I've encountered such a problem, even though I've rendered far
more complex shapes in the past.

Here is the code in question:

r=4;
res=100;
for (i=[-1:2:1]){
for (j=[-1:2:1]){
for (k=[-1:2:1]){
translate([ri,rj,r*k]){
sphere(r, $fn=res);
}
}
}
}

OpenSCAD has no problem creating a preview for this however. Thinking
this might be caused by infinitesimal overlap of the spheres I tried both
changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command
to no avail. Rendering a single sphere is almost instant with these
parameters. Is there a reason why it is suddenly stalling?

Thanks for your help.


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

With one sphere CGAL is not involved as there is no union. When there is more than one CGAL is used to union them. To make it faster OpenScad could detect objects that don't overlap and bypass CGAL as it is trivial to union non-overlapping objects. On 31 March 2016 at 13:02, Ignacio Partarrieu < ignacio.partarrieu@postgrad.manchester.ac.uk> wrote: > Thanks for your rapid reply. > > > Alright, so it's mainly to do with number of vertices then. How is this > impacted by the number of objects though? One sphere at res=100 renders > almost instantly. Why would 8 take so much longer? > > Furthermore, would OpenSCAD be able to render just one sphere and then > just copy that render to different positions to speed things up? Or is that > computationally impossible? > > > > > ------------------------------ > *From:* Discuss <discuss-bounces@lists.openscad.org> on behalf of nop > head <nop.head@gmail.com> > *Sent:* 31 March 2016 12:33 > *To:* OpenSCAD general discussion > *Subject:* Re: [OpenSCAD] Simple Render Consuming Large Amounts of Memory > > The result of union touching spheres is non manifold so I changed it to > sphere(r - 0.1, $fn=res); > > The number of vertices in a sphere goes up as the square of $fn and CGAL > is very slow for high vertex counts, even when it has nothing to do as with > non overlapping objects. It takes 219 seconds for res=100 on my machine but > only 12 for res = 30. > > On 31 March 2016 at 10:53, Ignacio Partarrieu < > ignacio.partarrieu@postgrad.manchester.ac.uk> wrote: > >> Hi, >> >> >> I'm using OpenSCAD to render a simple formation, but it is currently >> taking up an inordinate amount of time and memory to do it. This is the >> first time I've encountered such a problem, even though I've rendered far >> more complex shapes in the past. >> >> >> Here is the code in question: >> >> >> r=4; >> res=100; >> for (i=[-1:2:1]){ >> for (j=[-1:2:1]){ >> for (k=[-1:2:1]){ >> translate([r*i,r*j,r*k]){ >> sphere(r, $fn=res); >> } >> } >> } >> } >> >> OpenSCAD has no problem creating a preview for this however. Thinking >> this might be caused by infinitesimal overlap of the spheres I tried both >> changing the distance to (i=[-1:2.1:1.1]) and the union(){...} command >> to no avail. Rendering a single sphere is almost instant with these >> parameters. Is there a reason why it is suddenly stalling? >> >> >> Thanks for your help. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >