From 9c014739c7147612e1a9a8fe67437b5ffad65d92 Mon Sep 17 00:00:00 2001 From: Pierre Lecomte Date: Wed, 24 May 2023 14:45:26 +0200 Subject: [PATCH] code cleaning + add sma_open.json --- cad/sma_open.json | 17 ++++++ cad/sma_open.scad | 140 ++++------------------------------------------ 2 files changed, 28 insertions(+), 129 deletions(-) create mode 100644 cad/sma_open.json diff --git a/cad/sma_open.json b/cad/sma_open.json new file mode 100644 index 0000000..ff57f7c --- /dev/null +++ b/cad/sma_open.json @@ -0,0 +1,17 @@ +{ + "parameterSets": { + "lebedev26": { + "neighbors": "[[14, 15, 16, 17], [14, 21, 22, 18], [15, 18, 23, 19], [16, 19, 24, 20], [17, 21, 25, 20], [22, 23, 24, 25], [14, 15, 18], [15, 16, 19], [16, 17, 20], [17, 14, 21], [22, 23, 18, 26], [23, 24, 19, 26], [24, 25, 20, 26], [21, 22, 25, 26], [0, 1, 6, 9], [0, 2, 6, 7], [0, 3, 7, 8], [0, 4, 8, 9], [1, 2, 6, 10], [2, 3, 7, 11], [3, 4, 8, 12], [4, 1, 9, 13], [1, 5, 10, 13], [2, 5, 10, 11], [3, 5, 11, 12], [4, 5, 12, 13], [10, 11, 12, 13]]", + "phi": "[0, 0, 90, 180, 270, 0, 45, 135, 225, 315, 45, 135, 225, 315, 0, 90, 180, 270, 45, 135, 225, 315, 0, 90, 180, 270, 0]", + "r": "[150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 270]", + "theta": "[0, 90, 90, 90, 90, 180, 54.7356, 54.7356, 54.7356, 54.7356, 125.264, 125.264, 125.264, 125.264, 45, 45, 45, 45, 90, 90, 90, 90, 135, 135, 135, 135, 180]" + }, + "tetrahedron5": { + "neighbors": "[[1, 2, 3, 4], [2, 3, 0, 4, 5], [3, 0, 1, 4, 5], [0, 1, 2, 5], [0, 1, 2], [1, 2, 3]]", + "phi": "[0, 240, 120, 0, 180, 0]", + "r": "[100, 100, 100, 100, 34, 150]", + "theta": "[0, 109.471, 109.471, 109.471, 70.5284, 180]" + } + }, + "fileFormatVersion": "1" +} diff --git a/cad/sma_open.scad b/cad/sma_open.scad index cfefa68..73f2b0e 100644 --- a/cad/sma_open.scad +++ b/cad/sma_open.scad @@ -5,44 +5,23 @@ include ; // Last parameter is for support attach. // sphere radius (mm): -r = [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 270]; +r = [100, 100, 100, 100, 34, 150]; // microphones zenith coordinates (°): -theta = [0., 90., 90., 90., 90., 180., 54.7356, 54.7356, 54.7356, 54.7356, 125.264, 125.264, 125.264, 125.264, 45., 45., 45., 45., 90., 90., 90., 90., 135., 135., 135., 135., 180]; +theta = [0, 109.471, 109.471, 109.471, 70.5284, 180]; // microphone azimuth coordinates (°): -phi = [0., 0., 90., 180., 270., 0., 45., 135., 225., 315., 45., 135., 225., 315., 0., 90., 180., 270., 45., 135., 225., 315., 0., 90., 180., 270., 0]; +phi = [0, 240, 120, 0, 180, 0]; // connection matrix neighbors = [ -[14, 15, 16, 17], //0 -[14, 21, 22, 18], //1 -[15, 18, 23, 19], //2 -[16, 19, 24, 20], //3 -[17, 21, 25, 20], //4 -[22, 23, 24, 25], //5 -[14, 15, 18], //6 -[15, 16, 19], //7 -[16, 17, 20], //8 -[17, 14, 21], //9 -[22, 23, 18, 26], //10 -[23, 24, 19, 26], //11 -[24, 25, 20, 26], //12 -[21, 22, 25, 26], //13 -[0, 1, 6, 9], //14 -[0, 2, 6, 7], //15 -[0, 3, 7, 8], //16 -[0, 4, 8, 9], //17 -[1, 2, 6, 10], //18 -[2, 3, 7, 11], //19 -[3, 4, 8, 12], //20 -[4, 1, 9, 13], //21 -[1, 5, 10, 13], //22 -[2, 5, 10, 11], //23 -[3, 5, 11, 12], //24 -[4, 5, 12, 13], //25 -[10, 11, 12, 13], // support +[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"){ @@ -105,7 +84,7 @@ module support(stud=1.75){ phi[neighbors[id_mic][i]] ] ); - rtp2=cart2sph(neighbor-center); + rtp2=cart2sph(neighbor-center); translate(center) rotate([0, rtp2[1], rtp2[2]]){ cylinder(r=stud+2,h=22); @@ -161,105 +140,8 @@ module studs(id_mic, rstud=1.75){ } } - - - - - 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])]; - - - -// Support for mic stand - -// Mic pointing at center -//center = supp; -//rtp = cart2sph(center); -//echo(rtp); -//rotate([0, -rtp[1], 0]) -//rotate([0, 0,-rtp[2]]) -//attach( -//center=supp,neighbourgs=[ -//[x[0],y[0],z[0]], -//[x[1],y[1],z[1]], -//[x[2],y[2],z[2]] -//]); - -// Support attach - -//attach3(center = support, neighbourgs=[ -//[x[1], y[1], z[1]], -//[x[2], y[2], z[2]], -//[x[3], y[3], z[3]] -//]); - - -// Mic #0 -//attach( -//center=[x[0], y[0], z[0]],neighbourgs=[ -//supp, -//[x[1],y[1],z[1]], -//[x[2],y[2],z[2]], -//[x[3],y[3],z[3]] -//]); - -// Mic #1 -//center = [x[1],y[1],z[1]]; -//rtp = cart2sph(center); -//echo(rtp); -//rotate([0, -rtp[1], 0]) -//rotate([0, 0,-rtp[2]]) -//attach( -//center=[x[1], y[1], z[1]],neighbourgs=[ -//supp, -//support, -//[x[0],y[0],z[0]], -//[x[2],y[2],z[2]], -//[x[3],y[3],z[3]], -//]); - -module dist(i,j){ -echo( -sqrt( -pow((x[i]-x[j]),2) + -pow((y[i]-y[j]),2) + -pow((z[i]-z[j]),2) -) -- 2 * 16 -); -} - - -// Mic #2 -//center = [x[2],y[2],z[2]]; -//rtp = cart2sph(center); -//echo(rtp); -//rotate([0, -rtp[1], 0]) -//rotate([0, 0,-rtp[2]]) -//attach( -//center=[x[2], y[2], z[2]],neighbourgs=[ -//support, -//supp, -//[x[0],y[0],z[0]], -//[x[1],y[1],z[1]], -//[x[3],y[3],z[3]], -//]); - - -// Mic #3 -//center = [x[3],y[3],z[3]]; -//rtp = cart2sph(center); -//echo(rtp); -//rotate([0, -rtp[1], 0]) -//rotate([0, 0,-rtp[2]]) -//attach( -//center=[x[3], y[3], z[3]],neighbourgs=[ -//support, -//[x[0],y[0],z[0]], -//[x[1],y[1],z[1]], -//[x[2],y[2],z[2]], -//]); \ No newline at end of file + = [vec[0]*sin(vec[1])*cos(vec[2]), vec[0]*sin(vec[1])*sin(vec[2]), vec[0]*cos(vec[1])]; \ No newline at end of file