summaryrefslogtreecommitdiff
path: root/bubbles.scad
blob: 2f25938fe0661093fe17ecec00484f71ffc2ad9b (plain)
1
2
3
4
5
6
7
8
9
10
11
 module bubbles(size,d=1.2,s=1.8) {
  maxr=max(d/2,size[1]);
  scl = [ d/2/maxr, size[1]/maxr, d/2/maxr ];
  nx = floor((size[0]-2*d)/s); sx = s*nx; x0=(size[0]-sx)/2;
  nz = floor((size[2]-2*d)/s); sz = s*nz; z0=(size[2]-sz)/2;
  for(iz=[0:nz]) let(z=z0+s*iz) {
   for(ix=[0:iz%2?nx-1:nx]) let(x=x0+(iz%2?s/2:0)+s*ix) {
    translate([x,0,z]) scale(scl) sphere(r=maxr,$fn=30);
   }
  }
 }