include ; //$fn=128; /*[ Array parameters ]*/ // Last parameter is for support attach. // sphere radius (mm): r = [100, 100, 100, 100, 34, 150]; // microphones zenith coordinates (°): theta = [0, 109.471, 109.471, 109.471, 70.5284, 180]; // microphone azimuth coordinates (°): phi = [0, 240, 120, 0, 180, 0]; // connection matrix neighbors = [ [1, 2, 3, 4], //0 [2, 3, 0, 4, 5], //1 [3, 0, 1, 4, 5], //2 [0, 1, 2, 5], //3 [0, 1, 2], //4 [1, 2, 3], // support ]; module attach(id_mic, rmic=3.82, rstud=1.75, color="yellow"){ rtp = [r[id_mic], theta[id_mic], phi[id_mic]]; center = sph2cart(rtp); difference(){ union(){ for (i=[0:len(neighbors[id_mic])-1]){ neighbor = sph2cart( [ r[neighbors[id_mic][i]], theta[neighbors[id_mic][i]], phi[neighbors[id_mic][i]] ] ); rtp2=cart2sph(neighbor-center); translate(center) rotate([0, rtp2[1], rtp2[2]]){ difference(){ cylinder(r=rstud+2,h=22); translate([0,0,16]) cylinder(r=rstud,h=25); } } } translate(center) rotate([0, rtp[1], rtp[2]]){ cylinder(r=rmic+2,h=20,center=true); } } translate(center) { rotate([0, rtp[1], rtp[2]]){ cylinder(r=rmic,h=40, center=true); translate([rmic,0,5]) rotate([90,0,90]) linear_extrude(3) text(str(id_mic+1), size=4, valign="center", halign="center");}} } } support(); // treaded attach module support(stud=1.75){ id_mic = len(r)-1; rtp = [r[id_mic], theta[id_mic], phi[id_mic]]; center = sph2cart(rtp); difference(){ color("red") hull(){ for(i=[0:len(neighbors[id_mic])-1]){ neighbor = sph2cart( [ r[neighbors[id_mic][i]], theta[neighbors[id_mic][i]], phi[neighbors[id_mic][i]] ] ); rtp2=cart2sph(neighbor-center); translate(center) rotate([0, rtp2[1], rtp2[2]]){ cylinder(r=stud+2,h=22); } } translate(center) rotate([0, rtp[1], rtp[2]]) translate([0, 0, -10]) cylinder(r=6,h=20, center=false); } for(i=[0:len(neighbors[id_mic])-1]){ neighbor = sph2cart( [ r[neighbors[id_mic][i]], theta[neighbors[id_mic][i]], phi[neighbors[id_mic][i]] ] ); rtp2=cart2sph(neighbor-center); translate(center) rotate([0, rtp2[1], rtp2[2]]){ translate([0,0,16]) cylinder(r=stud,h=25); }; }; translate(center) rotate([0, rtp[1], rtp[2]]) translate([0,0,-30]) render() english_thread(3/8,16,2,internal=true); } } for (i = [0:len(theta)-2]){ attach(i); studs(i); }; module studs(id_mic, rstud=1.75){ rtp = [r[id_mic], theta[id_mic], phi[id_mic]]; center = sph2cart(rtp); for (i=[0:len(neighbors[id_mic])-1]){ neighbor = sph2cart([r[neighbors[id_mic][i]], theta[neighbors[id_mic][i]], phi[neighbors[id_mic][i]]]); rtp2=cart2sph(neighbor-center); translate(center) rotate([0, rtp2[1], rtp2[2]]) color("blue") translate([0,0,16]) cylinder(r=rstud,h=norm(neighbor-center)-2*16); } } function cart2sph(vec) = [norm(vec), acos(vec[2]/norm(vec)), atan2(vec[1],vec[0])]; function sph2cart(vec) = [vec[0]*sin(vec[1])*cos(vec[2]), vec[0]*sin(vec[1])*sin(vec[2]), vec[0]*cos(vec[1])];