summaryrefslogtreecommitdiff
authorIvan Kokshaysky <ink@rc.ru>2016-11-03 23:40:09 (UTC)
committer Ivan Kokshaysky <ink@rc.ru>2016-11-03 23:40:09 (UTC)
commit60c7c744af79d8b13256c17258ed45bfaa7dd0c4 (patch) (unidiff)
treec49345d3f319e50ea207a836abbd7992dae983cd
parentd0448a1c697d886521da5ae90e07c5b4bb8bf0f9 (diff)
downloadhotendery-60c7c744af79d8b13256c17258ed45bfaa7dd0c4.zip
hotendery-60c7c744af79d8b13256c17258ed45bfaa7dd0c4.tar.gz
hotendery-60c7c744af79d8b13256c17258ed45bfaa7dd0c4.tar.bz2
Bubbles fixes
- older versions of openscad don't honor let(); - limit the minimum sphere fragment size to 0.5, that makes no visible difference with 0.2 mm layers but dramatically reduces the rendering time. Signed-off-by: Ivan Kokshaysky <ink@rc.ru>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bubbles.scad8
1 files changed, 5 insertions, 3 deletions
diff --git a/bubbles.scad b/bubbles.scad
index 2f25938..c586736 100644
--- a/bubbles.scad
+++ b/bubbles.scad
@@ -1,11 +1,13 @@
1 module bubbles(size,d=1.2,s=1.8) { 1 module bubbles(size,d=1.2,s=1.8) {
2 maxr=max(d/2,size[1]); 2 maxr=max(d/2,size[1]);
3 scl = [ d/2/maxr, size[1]/maxr, d/2/maxr ]; 3 scl = [ d/2/maxr, size[1]/maxr, d/2/maxr ];
4 nx = floor((size[0]-2*d)/s); sx = s*nx; x0=(size[0]-sx)/2; 4 nx = floor((size[0]-2*d)/s); sx = s*nx; x0=(size[0]-sx)/2;
5 nz = floor((size[2]-2*d)/s); sz = s*nz; z0=(size[2]-sz)/2; 5 nz = floor((size[2]-2*d)/s); sz = s*nz; z0=(size[2]-sz)/2;
6 for(iz=[0:nz]) let(z=z0+s*iz) { 6 for(iz=[0:nz]) {
7 for(ix=[0:iz%2?nx-1:nx]) let(x=x0+(iz%2?s/2:0)+s*ix) { 7 z=z0+s*iz;
8 translate([x,0,z]) scale(scl) sphere(r=maxr,$fn=30); 8 for(ix=[0:iz%2?nx-1:nx]) {
9 x=x0+(iz%2?s/2:0)+s*ix;
10 translate([x,0,z]) scale(scl) sphere(r=maxr,$fs=0.5);
9 } 11 }
10 } 12 }
11 } 13 }