//Geometry of a MEMS-microphone

//clockwise diresction of circle points


cl1=0.3;
cl2=0.01;
Point (1)={1.675,1.25,0};
Point (2)={-1.675,1.25,0};
Point (3)={-1.675,-1.25,0};
Point (4)={1.675,-1.25,0};

Point(5)={0.595,0.2,0};
Point(6)={((0.2/2)*Cos((45*Pi/180)))+0.595,((0.2/2)*Sin((45*Pi/180)))+0.2,0,cl1};
Point(7)={((0.2/2)*Cos((135*Pi/180)))+0.595,((0.2/2)*Sin((135*Pi/180)))+0.2,0,cl1};
Point(8)={((0.2/2)*Cos((225*Pi/180)))+0.595,((0.2/2)*Sin((225*Pi/180)))+0.2,0,cl1};
Point(9)={((0.2/2)*Cos((315*Pi/180)))+0.595,((0.2/2)*Sin((315*Pi/180)))+0.2,0,cl1};

Point(10)={0.37,0,0};
Point(11)={((0.2/2)*Cos((45*Pi/180)))+0.37,((0.2/2)*Sin((45*Pi/180))),0,cl1};
Point(12)={((0.2/2)*Cos((135*Pi/180)))+0.37,((0.2/2)*Sin((135*Pi/180))),0,cl1};
Point(13)={((0.2/2)*Cos((225*Pi/180)))+0.37,((0.2/2)*Sin((225*Pi/180))),0,cl1};
Point(14)={((0.2/2)*Cos((315*Pi/180)))+0.37,((0.2/2)*Sin((315*Pi/180))),0,cl1};

Point(15)={0.595,-0.2,0};
Point(16)={((0.2/2)*Cos((45*Pi/180)))+0.595,((0.2/2)*Sin((45*Pi/180)))-0.2,0,cl1};
Point(17)={((0.2/2)*Cos((135*Pi/180)))+0.595,((0.2/2)*Sin((135*Pi/180)))-0.2,0,cl1};
Point(18)={((0.2/2)*Cos((225*Pi/180)))+0.595,((0.2/2)*Sin((225*Pi/180)))-0.2,0,cl1};
Point(19)={((0.2/2)*Cos((315*Pi/180)))+0.595,((0.2/2)*Sin((315*Pi/180)))-0.2,0,cl1};

Point(20)={0.82,0,0};
Point(21)={((0.2/2)*Cos((45*Pi/180)))+0.82,((0.2/2)*Sin((45*Pi/180))),0,cl1};
Point(22)={((0.2/2)*Cos((135*Pi/180)))+0.82,((0.2/2)*Sin((135*Pi/180))),0,cl1};
Point(23)={((0.2/2)*Cos((225*Pi/180)))+0.82,((0.2/2)*Sin((225*Pi/180))),0,cl1};
Point(24)={((0.2/2)*Cos((315*Pi/180)))+0.82,((0.2/2)*Sin((315*Pi/180))),0,cl1};

Point(25)={1.06,0.535,0.18};
Point(26)={((0.13/2)*Cos((45*Pi/180)))+1.06,((0.13/2)*Sin((45*Pi/180)))+0.535,0.18,cl2};
Point(27)={((0.13/2)*Cos((135*Pi/180)))+1.06,((0.13/2)*Sin((135*Pi/180)))+0.535,0.18,cl2};
Point(28)={((0.13/2)*Cos((225*Pi/180)))+1.06,((0.13/2)*Sin((225*Pi/180)))+0.535,0.18,cl2};
Point(29)={((0.13/2)*Cos((315*Pi/180)))+1.06,((0.13/2)*Sin((315*Pi/180)))+0.535,0.18,cl2};

Point(30)={0,0.535,0.18};
Point(31)={((0.13/2)*Cos((45*Pi/180))),((0.13/2)*Sin((45*Pi/180)))+0.535,0.18,cl2};
Point(32)={((0.13/2)*Cos((135*Pi/180))),((0.13/2)*Sin((135*Pi/180)))+0.535,0.18,cl2};
Point(33)={((0.13/2)*Cos((225*Pi/180))),((0.13/2)*Sin((225*Pi/180)))+0.535,0.18,cl2};
Point(34)={((0.13/2)*Cos((315*Pi/180))),((0.13/2)*Sin((315*Pi/180)))+0.535,0.18,cl2};

Point(35)={0,-0.535,0.18};
Point(36)={((0.13/2)*Cos((45*Pi/180))),((0.13/2)*Sin((45*Pi/180)))-0.535,0.18,cl2};
Point(37)={((0.13/2)*Cos((135*Pi/180))),((0.13/2)*Sin((135*Pi/180)))-0.535,0.18,cl2};
Point(38)={((0.13/2)*Cos((225*Pi/180))),((0.13/2)*Sin((225*Pi/180)))-0.535,0.18,cl2};
Point(39)={((0.13/2)*Cos((315*Pi/180))),((0.13/2)*Sin((315*Pi/180)))-0.535,0.18,cl2};

Point(40)={1.06,-0.535,0.18};
Point(41)={((0.13/2)*Cos((45*Pi/180)))+1.06,((0.13/2)*Sin((45*Pi/180)))-0.535,0.18,cl2};
Point(42)={((0.13/2)*Cos((135*Pi/180)))+1.06,((0.13/2)*Sin((135*Pi/180)))-0.535,0.18,cl2};
Point(43)={((0.13/2)*Cos((225*Pi/180)))+1.06,((0.13/2)*Sin((225*Pi/180)))-0.535,0.18,cl2};
Point(44)={((0.13/2)*Cos((315*Pi/180)))+1.06,((0.13/2)*Sin((315*Pi/180)))-0.535,0.18,cl2};

Line(10)={1,2};
Line(11)={2,3};
Line(12)={3,4};
Line(13)={4,1};

Circle(14)={6,5,7};
Circle(15)={7,5,8};
Circle(16)={8,5,9};
Circle(17)={9,5,6};

Circle(18)={11,10,12};
Circle(19)={12,10,13};
Circle(20)={13,10,14};
Circle(21)={14,10,11};

Circle(22)={16,15,17};
Circle(23)={17,15,18};
Circle(24)={18,15,19};
Circle(25)={19,15,16};

Circle(26)={21,20,22};
Circle(27)={22,20,23};
Circle(28)={23,20,24};
Circle(29)={24,20,21};

Circle(30)={26,25,27};
Circle(31)={27,25,28};
Circle(32)={28,25,29};
Circle(33)={29,25,26};

Circle(34)={31,30,32};
Circle(35)={32,30,33};
Circle(36)={33,30,34};
Circle(37)={34,30,31};

Circle(38)={36,35,37};
Circle(39)={37,35,38};
Circle(40)={38,35,39};
Circle(41)={39,35,36};

Circle(42)={41,40,42};
Circle(43)={42,40,43};
Circle(44)={43,40,44};
Circle(45)={44,40,41};

Line Loop(46) = {10, 11, 12, 13};
Line Loop(47) = {14, 15, 16, 17};
Line Loop(48) = {18, 19, 20, 21};
Line Loop(49) = {22, 23, 24, 25};
Line Loop(50) = {26, 27, 28, 29};
Plane Surface(51) = {46, 47, 48, 49, 50};

Line Loop(52) = {34, 35, 36, 37};
Line Loop(53) = {30, 31, 32, 33};
Plane Surface(54) = {53};
Plane Surface(55) = {52};
Line Loop(56) = {38, 39, 40, 41};
Plane Surface(57) = {56};
Line Loop(58) = {42, 43, 44, 45};
Plane Surface(59) = {58};
Extrude {0, 0, 0.18} {
  Surface{51};
  Layers{1};
}

Recombine Surface {54,55,57,59};
Transfinite Surface {54,55,57,59};
Extrude {0, 0, 0.09} {
  Surface{55, 57, 59, 54};
  Layers{5};
}

