31 #define outerDiam 84.4000 // 84.0000
32 #define innerDiam 30.0000 // 32.0000
33 #define tubeInnerDiam 1.0000
34 #define tubeOuterDiam 1.0060
37 #define wireDiam 0.0020
38 #define tubeLength 119.6000 // (120.0000 without passive elements)
44 #define endcapInnerDiam 0.9000
45 #define endcapOuterDiam 0.9950
46 #define endcapLength 0.7200
47 #define topcapInnerDiam 0.1000
48 #define topcapLength 0.0800
49 #define crimppinLength 1.2000
50 #define beltInnerDiam 0.3100
51 #define beltLength 0.0800
52 #define beltDistance 0.2000
53 #define gassupplyInnerDiam 0.0500
54 #define gassupplyOuterDiam 0.0800
55 #define gassupplyLength 3.0000
56 #define gassupplyTransY 0.4000
57 #define ringInnerDiam 0.9500
58 #define ringLength 0.0250
59 #define springInnerDiam 0.5000
60 #define springOuterDiam 0.5500
61 #define springLength 0.1000
62 #define noseOuterDiam 0.3000
63 #define noseLength 0.5000
70 #define sttCenterZ 20.
72 #define innerCoverThickness 1.0000 // 1.200 // 0.1000 cm
73 #define outerCoverThickness 1.2000 // 1.200 // 0.1000 cm
75 #define panelthickness 0.1000
76 #define pipeDiam 4.0800
81 #define pi 3.141592653589793238512808959406186204433
84 #define sttassembly "stt01assembly"
85 #define innerCylinder "stt01innerCylinder"
86 #define outerCylinder "stt01outerCylinder"
87 #define panel1 "stt01box#1"
88 #define panel2 "stt01box#2"
89 #define panel3 "stt01box#3"
90 #define panel4 "stt01box#4"
96 #define GasMixture "argon"
98 #define ABS "carbon" // to be defined
99 #define PVC "carbon" // to be defined
101 #define CuBe "copper" // to be defined
102 #define GFK "carbon" // to be defined
112 void writename(
char const *
name,
bool support =
false,
bool leftside =
false)
114 if(support && leftside) cout << name <<
"#1" << endl;
115 else if(support && !leftside) cout << name <<
"#2" << endl;
116 else cout << name << endl;
120 void writemother(
char const *
name,
bool original =
true,
bool support =
false,
bool firsttube =
false)
122 cout << name << endl;
123 if ((original && !support && firsttube) || (original && support && firsttube))
124 cout <<
"ASSEMBLY" << endl;
125 if (original && !support && !firsttube)
126 cout <<
"TUBE" << endl;
127 if(original && support && !firsttube)
128 cout <<
"TUBS" << endl;
134 cout << name << endl;
138 void writetube(
double inner,
double outer,
double length)
140 cout << 0. <<
" " << 0. <<
" " << -1. * length * 10. << endl;
141 cout << inner * 10. <<
" " << outer * 10. << endl;
142 cout << 0. <<
" " << 0. <<
" " << length * 10. << endl;
148 cout << 0. <<
" " << 0. <<
" " << -1. * length * 10. << endl;
149 cout << inner * 10. <<
" " << outer * 10. << endl;
150 cout << 0. <<
" " << 0. <<
" " << length * 10. << endl;
151 cout << atan((
pipeDiam/2.)/outer) * (180. /
pi) <<
" " << 180. - atan((
pipeDiam/2.)/outer) * (180. /
pi) << endl;
155 void writepanel(
char const *
name,
bool firstone,
double xthick,
double ythick,
double length,
int side)
162 cout << name << endl;
164 cout <<
"BOX" << endl;
165 cout <<
AlBe << endl;
166 cout << xthick/2. <<
" " << ythick/2. <<
" " << length / 2. << endl;
167 cout << -xthick/2. <<
" " << ythick/2. <<
" " << length / 2. << endl;
168 cout << xthick/2. <<
" " << ythick/2. <<
" " << -length / 2. << endl;
169 cout << -xthick/2. <<
" " << ythick/2. <<
" " << -length / 2. << endl;
170 cout << xthick/2. <<
" " << -ythick/2. <<
" " << length / 2. << endl;
171 cout << -xthick/2. <<
" " << -ythick/2. <<
" " << length / 2. << endl;
172 cout << xthick/2. <<
" " << -ythick/2. <<
" " << -length / 2. << endl;
173 cout << -xthick/2. <<
" " << -ythick/2. <<
" " << -length / 2. << endl;
176 cout << name << endl;
185 cout << x * 10. <<
" " << y * 10. <<
" " << z * 10. << endl;
189 void writerot(
double x00,
double x01,
double x02,
double x10,
double x11,
double x12,
double x20,
double x21,
double x22)
191 cout << x00 <<
" " << x01 <<
" " << x02 <<
" "
192 << x10 <<
" " << x11 <<
" " << x12 <<
" "
193 << x20 <<
" " << x21 <<
" " << x22 << endl;
194 cout <<
"//----------------------------------------------------------" << endl;
199 bool putStraw(
double posX,
double posY,
double posZ)
219 conv >> tubetellerStr;
222 nameItube =
"stt01tube#" + tubetellerStr,
223 nameIwall =
"stt01wall#" + tubetellerStr,
224 nameIgas =
"stt01gas#" + tubetellerStr,
225 nameIwire =
"stt01wire#" + tubetellerStr,
226 nameIendcap =
"stt01endcap",
227 nameItopcap =
"stt01topcap",
228 nameIcrimppin =
"stt01crimppin",
229 nameIbelt =
"stt01belt",
230 nameIgassupply =
"stt01gassupply",
231 nameIring =
"stt01ring",
232 nameIspring =
"stt01spring",
233 nameInose =
"stt01nose";
253 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
261 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
269 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
277 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
286 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
291 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
299 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
304 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
312 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
317 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
325 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
330 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
338 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
343 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
351 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
356 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
364 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
369 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
377 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
382 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
391 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
410 cout << 1 + (1 -
cos(newskewangle * (
pi / 180.))) * (x * x - 1) <<
" "
411 << -z *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * y <<
" "
412 << y *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * z <<
" "
414 << z *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * y <<
" "
415 << 1 + (1 -
cos(newskewangle * (
pi / 180.))) * (y * y - 1) <<
" "
416 << -x *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * y * z <<
" "
418 << -y *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * z <<
" "
419 << x *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * y * z <<
" "
420 << 1 + (1 -
cos(newskewangle * (
pi / 180.))) * (z * z - 1) << endl;
421 cout <<
"//----------------------------------------------------------" << endl;
428 cout << 1 + (1 -
cos(
skewangle * (
pi / 180.))) * (x * x - 1) <<
" "
439 cout <<
"//----------------------------------------------------------" << endl;
443 bool putStrawRotatedShortLeft(
double posX,
double posY,
double posZ,
double xvector,
double yvector,
double zvector,
double length)
459 conv >> tubetellerStr;
462 nameItube =
"stt01tube" + tubetellerStr,
463 nameIwall =
"stt01wall" + tubetellerStr,
464 nameIgas =
"stt01gas" + tubetellerStr,
465 nameIwire =
"stt01wire" + tubetellerStr,
466 nameIendcap =
"stt01endcap",
467 nameItopcap =
"stt01topcap",
468 nameIcrimppin =
"stt01crimppin",
469 nameIbelt =
"stt01belt",
470 nameIgassupply =
"stt01gassupply",
471 nameIring =
"stt01ring",
472 nameIspring =
"stt01spring",
473 nameInose =
"stt01nose";
488 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
496 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
504 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
511 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
516 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
522 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
527 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
533 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
538 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
544 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
549 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
555 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
560 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
566 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
571 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
577 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
582 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
588 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
593 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
622 conv >> tubetellerStr;
625 nameItube =
"stt01tube" + tubetellerStr,
626 nameIwall =
"stt01wall" + tubetellerStr,
627 nameIgas =
"stt01gas" + tubetellerStr,
628 nameIwire =
"stt01wire" + tubetellerStr,
629 nameIendcap =
"stt01endcap",
630 nameItopcap =
"stt01topcap",
631 nameIcrimppin =
"stt01crimppin",
632 nameIbelt =
"stt01belt",
633 nameIgassupply =
"stt01gassupply",
634 nameIring =
"stt01ring",
635 nameIspring =
"stt01spring",
636 nameInose =
"stt01nose";
651 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
659 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
667 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
674 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
679 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
685 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
690 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
696 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
701 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
707 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
712 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
718 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
723 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
729 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
734 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
740 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
745 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
751 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
756 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
766 bool putStrawRotatedLeft(
double posX,
double posY,
double posZ,
double xvector,
double yvector,
double zvector,
double length)
780 conv >> tubetellerStr;
783 nameItube =
"stt01tube#" + tubetellerStr,
784 nameIwall =
"stt01wall#" + tubetellerStr,
785 nameIgas =
"stt01gas#" + tubetellerStr,
786 nameIwire =
"stt01wire#" + tubetellerStr,
787 nameIendcap =
"stt01endcap",
788 nameItopcap =
"stt01topcap",
789 nameIcrimppin =
"stt01crimppin",
790 nameIbelt =
"stt01belt",
791 nameIgassupply =
"stt01gassupply",
792 nameIring =
"stt01ring",
793 nameIspring =
"stt01spring",
794 nameInose =
"stt01nose";
812 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
820 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
828 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
835 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
840 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
846 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
851 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
857 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
862 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
868 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
873 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
879 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
884 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
890 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
895 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
901 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
906 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
912 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
917 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
936 bool putStrawRotatedRight(
double posX,
double posY,
double posZ,
double xvector,
double yvector,
double zvector,
double length)
952 conv >> tubetellerStr;
955 nameItube =
"stt01tube#" + tubetellerStr,
956 nameIwall =
"stt01wall#" + tubetellerStr,
957 nameIgas =
"stt01gas#" + tubetellerStr,
958 nameIwire =
"stt01wire#" + tubetellerStr,
959 nameIendcap =
"stt01endcap",
960 nameItopcap =
"stt01topcap",
961 nameIcrimppin =
"stt01crimppin",
962 nameIbelt =
"stt01belt",
963 nameIgassupply =
"stt01gassupply",
964 nameIring =
"stt01ring",
965 nameIspring =
"stt01spring",
966 nameInose =
"stt01nose";
983 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
991 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
999 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1006 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1011 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1017 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1022 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1028 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1033 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1039 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1044 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1047 writename(nameIgassupply.c_str(), 1, 1);
1050 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1052 writename(nameIgassupply.c_str(), 1, 0);
1055 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1061 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1066 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1072 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1077 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1083 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1088 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1116 ypos = ((ringteller) * 2 * radius),
1123 for(
int i = 0;
i < ringteller;
i++)
1125 xpos -=
sqrt(3.) * radius;
1129 for(
int i = 0;
i < ringteller;
i++)
1134 for(
int i = 0;
i < ringteller;
i++)
1136 xpos +=
sqrt(3.) * radius;
1140 for(
int i = 0;
i < ringteller;
i++)
1142 xpos +=
sqrt(3.) * radius;
1146 for(
int i = 0;
i < ringteller;
i++)
1151 for(
int i = 0;
i < ringteller;
i++)
1153 xpos -=
sqrt(3.) * radius;
1169 newradius = radius /
cos((newskewangle / 180.) *
pi);
1173 ypos = ringposition /
cos((30. / 180.) *
pi),
1182 availableSpace = 2. * ringposition * tan((30. / 180.) *
pi);
1185 possibleStraws = int((availableSpace -
fabs(
tubeLength *
sin((newskewangle / 180.) *
pi))) / (newradius * 2)),
1186 extraStraws = -1 * possibleStraws + int(availableSpace / (newradius * 2));
1189 extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
1191 cerr <<
"extra space: " << extraspace * 2 << endl;
1194 skewanglerad = (newskewangle / 180.) *
pi,
1195 sixtyrad = (60. / 180.) *
pi,
1196 translationToLeft = - 0.5 *
tubeLength * tan(skewanglerad);
1203 xpos2 = xpos - availableSpace *
sin((60. / 180.) *
pi),
1204 ypos2 = ypos - availableSpace *
cos((60. / 180.) *
pi),
1206 tmpypos2 = ypos2 - extraspace - newradius,
1207 limit = ypos2 - availableSpace + newradius +
safety + extraspace;
1209 for(
int i = 0;
i < possibleStraws;
i++)
1211 tmpypos2 -= 2 * newradius;
1213 int extracounter = 0;
1214 for (
int i = 0;
i < extraStraws;
i++)
1216 if((tmpypos2 - limit) < 0)
break;
1219 lengthShort =
fabs((tmpypos2 - newradius - limit) /
sin(newskewangle * (
pi / 180.)));
1225 lengthsShort.push_back(
fabs(lengthShort));
1227 tmpypos2 -= 2 * newradius;
1229 extraStraws = extracounter;
1241 availableSpacePipe = 2. * ringposition * tan((30. / 180.) *
pi) - pipespace;
1249 extraStrawsPipe = -1 * possibleStrawsPipe + int(availableSpacePipe / (newradius * 2));
1253 extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
1263 xpos2Pipe = xpos - availableSpacePipe *
sin((60. / 180.) *
pi),
1264 ypos2Pipe = ypos - availableSpacePipe *
cos((60. / 180.) *
pi),
1266 tmpxpos2Pipe = xpos2Pipe,
1267 tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
1269 limitPipe = ypos2Pipe - availableSpacePipe + newradius +
safety + extraspacePipe;
1273 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1275 tmpypos2Pipe -= 2 * newradius;
1279 for (
int i = 0;
i < extraStrawsPipe;
i++)
1281 if((tmpypos2Pipe - limitPipe) < 0)
break;
1284 lengthShort =
fabs((tmpypos2Pipe - newradius - limitPipe) /
sin(
skewangle * (
pi / 180.)));
1288 lengthsShortPipe.push_back(lengthShort);
1289 tmpypos2Pipe -= 2 * newradius;
1291 extraStrawsPipe = extracounter;
1295 vectorx = -
cos((60. / 180.) *
pi);
1296 vectory =
sin((60. / 180.) *
pi);
1298 tmpxpos = xpos - (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
1299 tmpypos = ypos - (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
1301 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1305 tmpypos + (translationToLeft - additionalShift) *
cos(sixtyrad),
1308 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1309 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1312 for (
int i = 0;
i < extraStrawsPipe;
i++)
1315 lengthShort = lengthsShortPipe[
i];
1318 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1319 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1320 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1323 tmpypos + (translationToLeft - additionalShift - translationToFrontPer) *
cos(sixtyrad),
1324 zpos - translationToFrontPar,
1325 vectorx, vectory, vectorz, lengthShort);
1328 tmpypos + (translationToLeft - additionalShift + translationToFrontPer + switchSides) *
cos(sixtyrad),
1329 zpos + translationToFrontPar,
1330 vectorx, vectory, vectorz, lengthShort);
1333 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1334 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1342 xpos -= availableSpace *
sin((60. / 180.) *
pi);
1343 ypos -= availableSpace *
cos((60. / 180.) *
pi);
1345 tmpypos = ypos - extraspace - newradius;
1347 for(
int i = 0;
i < possibleStraws;
i++)
1350 tmpypos -= 2 * newradius;
1353 for (
int i = 0;
i < extraStraws;
i++)
1356 lengthShort = lengthsShort[
i];
1359 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1360 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1361 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
1364 tmpypos - additionalShift + (translationToLeft - translationToFrontPer),
1365 zpos - translationToFrontPar,
1366 vectorx, vectory, vectorz, lengthShort);
1369 tmpypos - additionalShift + (translationToLeft + translationToFrontPer + switchSides),
1370 zpos + translationToFrontPar,
1371 vectorx, vectory, vectorz, lengthShort);
1373 tmpypos -= 2 * newradius;
1377 vectorx = -1 *
cos((60. / 180.) *
pi);
1378 vectory = -1 *
sin((60. / 180.) *
pi);
1380 ypos -= availableSpace;
1381 tmpxpos = xpos + (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
1382 tmpypos = ypos - (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
1384 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1388 tmpypos + (translationToLeft - additionalShift) *
cos(sixtyrad),
1391 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1392 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1395 for (
int i = 0;
i < extraStrawsPipe;
i++)
1398 lengthShort = lengthsShortPipe[
i];
1401 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1402 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1403 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1406 tmpypos + (translationToLeft - translationToFrontPer - additionalShift) *
cos(sixtyrad),
1407 zpos - translationToFrontPar,
1408 vectorx, vectory, vectorz, lengthShort);
1411 tmpypos + (translationToLeft + translationToFrontPer - additionalShift + switchSides) *
cos(sixtyrad),
1412 zpos + translationToFrontPar,
1413 vectorx, vectory, vectorz, lengthShort);
1415 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1416 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1420 vectorx = 1 *
cos((60. / 180.) *
pi);
1421 vectory = -1 *
sin((60. / 180.) *
pi);
1423 xpos += availableSpace *
sin((60. / 180.) *
pi);
1424 ypos -= availableSpace *
cos((60. / 180.) *
pi);
1425 tmpxpos = xpos + (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
1426 tmpypos = ypos + (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
1428 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1432 tmpypos - (translationToLeft - additionalShift) *
cos(sixtyrad),
1435 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1436 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1439 for (
int i = 0;
i < extraStrawsPipe;
i++)
1442 lengthShort = lengthsShortPipe[
i];
1445 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1446 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1447 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1450 tmpypos - (translationToLeft - additionalShift - translationToFrontPer) *
cos(sixtyrad),
1451 zpos - translationToFrontPar,
1452 vectorx, vectory, vectorz, lengthShort);
1455 tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) *
cos(sixtyrad),
1456 zpos + translationToFrontPar,
1457 vectorx, vectory, vectorz, lengthShort);
1459 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1460 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1467 xpos += availableSpace *
sin((60. / 180.) *
pi);
1468 ypos += availableSpace *
cos((60. / 180.) *
pi);
1470 tmpypos = ypos + extraspace + newradius;
1472 for(
int i = 0;
i < possibleStraws;
i++)
1475 tmpypos += 2 * newradius;
1478 for (
int i = 0;
i < extraStraws;
i++)
1481 lengthShort = lengthsShort[
i];
1484 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1485 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1486 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
1489 zpos - translationToFrontPar,
1490 vectorx, vectory, vectorz, lengthShort);
1492 putStrawRotatedShortRight(tmpxpos, tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides),
1493 zpos + translationToFrontPar,
1494 vectorx, vectory, vectorz, lengthShort);
1496 tmpypos += 2 * newradius;
1500 vectorx =
cos((60. / 180.) *
pi);
1501 vectory =
sin((60. / 180.) *
pi);
1503 ypos += availableSpace;
1504 tmpxpos = xpos - (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
1505 tmpypos = ypos + (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
1507 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1511 tmpypos - (translationToLeft - additionalShift) *
cos(sixtyrad),
1514 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1515 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1518 for (
int i = 0;
i < extraStrawsPipe;
i++)
1521 lengthShort = lengthsShortPipe[
i];
1524 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1525 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1526 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1529 tmpypos - (translationToLeft - additionalShift - translationToFrontPer) *
cos(sixtyrad),
1530 zpos - translationToFrontPar,
1531 vectorx, vectory, vectorz, lengthShort);
1534 tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) *
cos(sixtyrad),
1535 zpos + translationToFrontPar,
1536 vectorx, vectory, vectorz, lengthShort);
1538 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1539 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1565 ypos = ringposition /
cos((30. / 180.) *
pi),
1576 availableSpace = 2. * ringposition * tan((30. / 180.) *
pi);
1584 extraStraws = int(availableSpace / (newradius * 2)) - possibleStraws;
1589 extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
1595 sixtyrad = (60. / 180.) *
pi,
1597 translationToLeft = - 0.5 *
tubeLength * tan(skewanglerad);
1605 xpos2 = xpos - availableSpace *
sin((60. / 180.) *
pi),
1606 ypos2 = ypos - availableSpace *
cos((60. / 180.) *
pi),
1609 tmpypos2 = ypos2 - extraspace - newradius,
1611 limit = ypos2 - availableSpace + newradius +
safety + extraspace;
1618 for(
int i = 0;
i < possibleStraws;
i++)
1620 tmpypos2 -= 2 * newradius;
1622 int extracounter = 0;
1624 for (
int i = 0;
i < extraStraws;
i++)
1626 if((tmpypos2 - limit) < 0)
break;
1635 lengthsShort.push_back(lengthShort);
1637 tmpypos2 -= 2 * newradius;
1639 extraStraws = extracounter;
1647 availableSpacePipe = 2. * ringposition * tan((30. / 180.) *
pi) - pipespace;
1655 extraStrawsPipe = int(availableSpacePipe / (newradius * 2)) - possibleStrawsPipe;
1660 extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
1670 xpos2Pipe = xpos - availableSpacePipe *
sin((60. / 180.) *
pi),
1671 ypos2Pipe = ypos - availableSpacePipe *
cos((60. / 180.) *
pi),
1673 tmpxpos2Pipe = xpos2Pipe,
1674 tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
1676 limitPipe = ypos2Pipe - availableSpacePipe + newradius +
safety + extraspacePipe;
1679 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1681 tmpypos2Pipe -= 2 * newradius;
1686 for (
int i = 0;
i < extraStrawsPipe;
i++)
1688 if((tmpypos2Pipe - limitPipe) < 0)
break;
1691 lengthShort =
fabs((tmpypos2Pipe - newradius - limitPipe) /
sin(
skewangle * (
pi / 180.)));
1696 lengthsShortPipe.push_back(lengthShort);
1698 tmpypos2Pipe -= 2 * newradius;
1700 extraStrawsPipe = extracounter;
1704 vectorx = -
cos((60. / 180.) *
pi);
1705 vectory =
sin((60. / 180.) *
pi);
1707 tmpxpos = xpos - (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
1708 tmpypos = ypos - (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
1710 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1714 tmpypos + translationToLeft *
cos(sixtyrad),
1717 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1718 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1721 for (
int i = 0;
i < extraStrawsPipe;
i++)
1724 lengthShort = lengthsShortPipe[
i];
1727 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1728 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1730 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1734 tmpypos + (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1735 zpos + translationToFrontPar,
1736 vectorx, vectory, vectorz, lengthShort);
1739 tmpypos + (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1740 zpos - translationToFrontPar,
1741 vectorx, vectory, vectorz, lengthShort);
1744 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1745 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1752 xpos -= availableSpace *
sin((60. / 180.) *
pi);
1753 ypos -= availableSpace *
cos((60. / 180.) *
pi);
1755 tmpypos = ypos - extraspace - newradius;
1757 for(
int i = 0;
i < possibleStraws;
i++)
1760 tmpypos -= 2 * newradius;
1763 for (
int i = 0;
i < extraStraws;
i++)
1766 lengthShort = lengthsShort[
i];
1769 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1770 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1771 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
1774 tmpypos + (translationToLeft + translationToFrontPer),
1775 zpos + translationToFrontPar,
1776 vectorx, vectory, vectorz, lengthShort);
1779 tmpypos + (translationToLeft - translationToFrontPer + switchSides),
1780 zpos - translationToFrontPar,
1781 vectorx, vectory, vectorz, lengthShort);
1783 tmpypos -= 2 * newradius;
1787 vectorx = -1 *
cos((60. / 180.) *
pi);
1788 vectory = -1 *
sin((60. / 180.) *
pi);
1790 ypos -= availableSpace;
1791 tmpxpos = xpos + (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
1792 tmpypos = ypos - (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
1794 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1798 tmpypos + translationToLeft *
cos(sixtyrad),
1801 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1802 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1805 for (
int i = 0;
i < extraStrawsPipe;
i++)
1808 lengthShort = lengthsShortPipe[
i];
1811 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1812 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1813 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1816 tmpypos + (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1817 zpos + translationToFrontPar,
1818 vectorx, vectory, vectorz, lengthShort);
1821 tmpypos + (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1822 zpos - translationToFrontPar,
1823 vectorx, vectory, vectorz, lengthShort);
1825 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1826 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1830 vectorx = 1 *
cos((60. / 180.) *
pi);
1831 vectory = -1 *
sin((60. / 180.) *
pi);
1833 xpos += availableSpace *
sin((60. / 180.) *
pi);
1834 ypos -= availableSpace *
cos((60. / 180.) *
pi);
1835 tmpxpos = xpos + (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
1836 tmpypos = ypos + (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
1838 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1842 tmpypos - translationToLeft *
cos(sixtyrad),
1845 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1846 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1849 for (
int i = 0;
i < extraStrawsPipe;
i++)
1852 lengthShort = lengthsShortPipe[
i];
1855 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1856 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1857 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1861 tmpypos - (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1862 zpos + translationToFrontPar,
1863 vectorx, vectory, vectorz, lengthShort);
1866 tmpypos - (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1867 zpos - translationToFrontPar,
1868 vectorx, vectory, vectorz, lengthShort);
1870 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1871 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1878 xpos += availableSpace *
sin((60. / 180.) *
pi);
1879 ypos += availableSpace *
cos((60. / 180.) *
pi);
1881 tmpypos = ypos + extraspace + newradius;
1883 for(
int i = 0;
i < possibleStraws;
i++)
1888 tmpypos += 2 * newradius;
1891 for (
int i = 0;
i < extraStraws;
i++)
1894 lengthShort = lengthsShort[
i];
1897 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1898 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1899 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
1902 tmpypos - (translationToLeft + translationToFrontPer),
1903 zpos + translationToFrontPar,
1904 vectorx, vectory, vectorz, lengthShort);
1907 tmpypos - (translationToLeft - translationToFrontPer + switchSides),
1908 zpos - translationToFrontPar,
1909 vectorx, vectory, vectorz, lengthShort);
1911 tmpypos += 2 * newradius;
1915 vectorx =
cos((60. / 180.) *
pi);
1916 vectory =
sin((60. / 180.) *
pi);
1918 ypos += availableSpace;
1919 tmpxpos = xpos - (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
1920 tmpypos = ypos + (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
1922 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1926 tmpypos - translationToLeft *
cos(sixtyrad),
1929 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1930 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1933 for (
int i = 0;
i < extraStrawsPipe;
i++)
1936 lengthShort = lengthsShortPipe[
i];
1939 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1940 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1941 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1944 tmpypos - (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1945 zpos + translationToFrontPar,
1946 vectorx, vectory, vectorz, lengthShort);
1949 tmpypos - (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1950 zpos - translationToFrontPar,
1951 vectorx, vectory, vectorz, lengthShort);
1953 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1954 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1974 while (ringteller *
sqrt(3.) * radius - radius <= startRadius)
1978 cerr <<
"startRadius " << startRadius << endl;
1980 startRadius = (ringteller + 1) *
sqrt(3.) * radius;
1983 cerr <<
"positioning ring at: " << ringteller *
sqrt(3.) * radius << endl;
1986 cerr <<
"positioning ring at: " << (ringteller + 1) *
sqrt(3.) * radius << endl;
1989 cerr <<
"ringteller " << ringteller << endl;
2007 startRadius = (ringteller + 1) *
sqrt(3.) * radius;
2009 cerr <<
"positioning ring at: " << ringteller *
sqrt(3.) * radius << endl;
2011 cerr <<
"ringteller " << ringteller <<
" radius " << radius << endl;
2045 cout << setiosflags(ios::fixed) << setprecision(6);
2060 cout <<
cave << endl;
2061 cout <<
"ASSEMBLY" << endl;
2062 cout <<
air << endl;
2065 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2073 writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
2082 writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
2091 writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
2100 writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
2107 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2111 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2115 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2119 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2148 cerr <<
"start radius before skewed " << startRadius << endl;
2157 cerr <<
"start radius after " << startRadius << endl;
2160 cerr <<
"start radius " << startRadius << endl;
int main(int argc, char **argv)
friend F32vec4 cos(const F32vec4 &a)
bool putStraw(double posX, double posY, double posZ)
static int shortskewedtubeteller
friend F32vec4 sqrt(const F32vec4 &a)
#define innerCoverThickness
static double maximumradius
friend F32vec4 sin(const F32vec4 &a)
bool putStrawRotatedShortLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
static double minimumradius
void writetrans(double x, double y, double z)
void makeDoubleLayerStraightExact(double &startRadius)
void writerot(double x00, double x01, double x02, double x10, double x11, double x12, double x20, double x21, double x22)
void writename(char const *name, bool support=false, bool leftside=false)
void writemedium(char *name)
bool putStrawRotatedRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
bool putStrawRotatedShortRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
static int axialtubeteller
void plotrotright(double x, double y, double z)
static int skewedtubeteller
void makeSingleLayerStraightExact(double &startRadius)
#define gassupplyOuterDiam
#define gassupplyInnerDiam
void placeSingleLayerStraightExact(double ringteller)
friend F32vec4 fabs(const F32vec4 &a)
void makeDoubleLayerSkewedRight(double startRadius)
void placeSingleLayerSkewedRight(double ringposition)
#define outerCoverThickness
bool putStrawRotatedLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
void writehalftube(double inner, double outer, double length)
void placeSingleLayerSkewedLeft(double ringposition)
void makeDoubleLayerSkewedLeft(double startRadius)
void writetube(double inner, double outer, double length)
void plotrotleft(double x, double y, double z)
void writepanel(char const *name, bool firstone, double xthick, double ythick, double length, int side)
void writemother(char const *name, bool original=true, bool support=false)