35 #define outerDiam 84.4000 // 84.0000
36 #define innerDiam 30.0000 // 32.0000
37 #define tubeInnerDiam 1.0000
38 #define tubeOuterDiam 1.0060
41 #define wireDiam 0.0020
42 #define tubeLength 120.0000 // 150.0000
49 #define sttCenterZ 20. // 35.
51 #define innerCoverThickness 1.0000 // 1.200 // 0.1000 cm
52 #define outerCoverThickness 1.2000 // 1.200 // 0.1000 cm
54 #define panelthickness 0.1000
55 #define pipeDiam 4.0800
60 #define pi 3.141592653589793238512808959406186204433
63 #define sttassembly "stt01assembly"
64 #define innerCylinder "stt01innerCylinder"
65 #define outerCylinder "stt01outerCylinder"
66 #define panel1 "stt01box#1"
67 #define panel2 "stt01box#2"
68 #define panel3 "stt01box#3"
69 #define panel4 "stt01box#4"
75 #define HeMixture "argon"
86 void writename(
char const *
name,
bool support =
false,
bool leftside =
false)
88 if(support && leftside) cout << name <<
"#1" << endl;
89 else if(support && !leftside) cout << name <<
"#2" << endl;
90 else cout << name << endl;
97 if (original && !support)
98 cout <<
"TUBE" << endl;
99 if(original && support)
100 cout <<
"TUBS" << endl;
106 cout << name << endl;
110 void writetube(
double inner,
double outer,
double length)
112 cout << 0. <<
" " << 0. <<
" " << -1. * length * 10. << endl;
113 cout << inner * 10. <<
" " << outer * 10. << endl;
114 cout << 0. <<
" " << 0. <<
" " << length * 10. << endl;
120 cout << 0. <<
" " << 0. <<
" " << -1. * length * 10. << endl;
121 cout << inner * 10. <<
" " << outer * 10. << endl;
122 cout << 0. <<
" " << 0. <<
" " << length * 10. << endl;
123 cout << atan((
pipeDiam/2.)/outer) * (180. /
pi) <<
" " << 180. - atan((
pipeDiam/2.)/outer) * (180. /
pi) << endl;
127 void writepanel(
char const *
name,
bool firstone,
double xthick,
double ythick,
double length,
int side)
134 cout << name << endl;
136 cout <<
"BOX" << endl;
137 cout <<
AlBe << endl;
138 cout << xthick/2. <<
" " << ythick/2. <<
" " << length / 2. << endl;
139 cout << -xthick/2. <<
" " << ythick/2. <<
" " << length / 2. << endl;
140 cout << xthick/2. <<
" " << ythick/2. <<
" " << -length / 2. << endl;
141 cout << -xthick/2. <<
" " << ythick/2. <<
" " << -length / 2. << endl;
142 cout << xthick/2. <<
" " << -ythick/2. <<
" " << length / 2. << endl;
143 cout << -xthick/2. <<
" " << -ythick/2. <<
" " << length / 2. << endl;
144 cout << xthick/2. <<
" " << -ythick/2. <<
" " << -length / 2. << endl;
145 cout << -xthick/2. <<
" " << -ythick/2. <<
" " << -length / 2. << endl;
148 cout << name << endl;
157 cout << x * 10. <<
" " << y * 10. <<
" " << z * 10. << endl;
161 void writerot(
double x00,
double x01,
double x02,
double x10,
double x11,
double x12,
double x20,
double x21,
double x22)
163 cout << x00 <<
" " << x01 <<
" " << x02 <<
" "
164 << x10 <<
" " << x11 <<
" " << x12 <<
" "
165 << x20 <<
" " << x21 <<
" " << x22 << endl;
166 cout <<
"//----------------------------------------------------------" << endl;
171 bool putStraw(
double posX,
double posY,
double posZ)
191 conv >> tubetellerStr;
194 nameItube =
"stt01tube#" + tubetellerStr,
195 nameIgas =
"stt01gas#" + tubetellerStr,
196 nameIwire =
"stt01wire#" + tubetellerStr;
219 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
227 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
235 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
243 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
262 cout << 1 + (1 -
cos(newskewangle * (
pi / 180.))) * (x * x - 1) <<
" "
263 << -z *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * y <<
" "
264 << y *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * z <<
" "
266 << z *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * y <<
" "
267 << 1 + (1 -
cos(newskewangle * (
pi / 180.))) * (y * y - 1) <<
" "
268 << -x *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * y * z <<
" "
270 << -y *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * x * z <<
" "
271 << x *
sin(newskewangle * (
pi / 180.)) + (1 -
cos(newskewangle * (
pi / 180.))) * y * z <<
" "
272 << 1 + (1 -
cos(newskewangle * (
pi / 180.))) * (z * z - 1) << endl;
273 cout <<
"//----------------------------------------------------------" << endl;
280 cout << 1 + (1 -
cos(
skewangle * (
pi / 180.))) * (x * x - 1) <<
" "
291 cout <<
"//----------------------------------------------------------" << endl;
295 bool putStrawRotatedShortLeft(
double posX,
double posY,
double posZ,
double xvector,
double yvector,
double zvector,
double length)
311 conv >> tubetellerStr;
314 nameItube =
"stt01tube" + tubetellerStr,
315 nameIgas =
"stt01gas" + tubetellerStr,
316 nameIwire =
"stt01wire" + tubetellerStr;
334 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
342 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
370 conv >> tubetellerStr;
373 nameItube =
"stt01tube" + tubetellerStr,
374 nameIgas =
"stt01gas" + tubetellerStr,
375 nameIwire =
"stt01wire" + tubetellerStr;
393 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
401 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
410 bool putStrawRotatedLeft(
double posX,
double posY,
double posZ,
double xvector,
double yvector,
double zvector,
double length)
424 conv >> tubetellerStr;
427 nameItube =
"stt01tube#" + tubetellerStr,
428 nameIgas =
"stt01gas#" + tubetellerStr,
429 nameIwire =
"stt01wire#" + tubetellerStr;
448 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
456 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
474 bool putStrawRotatedRight(
double posX,
double posY,
double posZ,
double xvector,
double yvector,
double zvector,
double length)
490 conv >> tubetellerStr;
493 nameItube =
"stt01tube#" + tubetellerStr,
494 nameIgas =
"stt01gas#" + tubetellerStr,
495 nameIwire =
"stt01wire#" + tubetellerStr;
515 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
523 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
550 ypos = ((ringteller) * 2 * radius),
557 for(
int i = 0;
i < ringteller;
i++)
559 xpos -=
sqrt(3.) * radius;
563 for(
int i = 0;
i < ringteller;
i++)
568 for(
int i = 0;
i < ringteller;
i++)
570 xpos +=
sqrt(3.) * radius;
574 for(
int i = 0;
i < ringteller;
i++)
576 xpos +=
sqrt(3.) * radius;
580 for(
int i = 0;
i < ringteller;
i++)
585 for(
int i = 0;
i < ringteller;
i++)
587 xpos -=
sqrt(3.) * radius;
603 newradius = radius /
cos((newskewangle / 180.) *
pi);
607 ypos = ringposition /
cos((30. / 180.) *
pi),
616 availableSpace = 2. * ringposition * tan((30. / 180.) *
pi);
619 possibleStraws = int((availableSpace -
fabs(
tubeLength *
sin((newskewangle / 180.) *
pi))) / (newradius * 2)),
620 extraStraws = -1 * possibleStraws + int(availableSpace / (newradius * 2));
623 extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
625 cerr <<
"extra space: " << extraspace * 2 << endl;
628 skewanglerad = (newskewangle / 180.) *
pi,
629 sixtyrad = (60. / 180.) *
pi,
630 translationToLeft = - 0.5 *
tubeLength * tan(skewanglerad);
637 xpos2 = xpos - availableSpace *
sin((60. / 180.) *
pi),
638 ypos2 = ypos - availableSpace *
cos((60. / 180.) *
pi),
640 tmpypos2 = ypos2 - extraspace - newradius,
641 limit = ypos2 - availableSpace + newradius +
safety + extraspace;
643 for(
int i = 0;
i < possibleStraws;
i++)
645 tmpypos2 -= 2 * newradius;
648 int extracounter = 0;
649 for (
int i = 0;
i < extraStraws;
i++)
651 if((tmpypos2 - limit) < 0)
break;
654 lengthShort =
fabs((tmpypos2 - newradius - limit) /
sin(newskewangle * (
pi / 180.)));
660 lengthsShort.push_back(
fabs(lengthShort));
662 tmpypos2 -= 2 * newradius;
664 extraStraws = extracounter;
676 availableSpacePipe = 2. * ringposition * tan((30. / 180.) *
pi) - pipespace;
684 extraStrawsPipe = -1 * possibleStrawsPipe + int(availableSpacePipe / (newradius * 2));
688 extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
698 xpos2Pipe = xpos - availableSpacePipe *
sin((60. / 180.) *
pi),
699 ypos2Pipe = ypos - availableSpacePipe *
cos((60. / 180.) *
pi),
701 tmpxpos2Pipe = xpos2Pipe,
702 tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
704 limitPipe = ypos2Pipe - availableSpacePipe + newradius +
safety + extraspacePipe;
708 for(
int i = 0;
i < possibleStrawsPipe;
i++)
710 tmpypos2Pipe -= 2 * newradius;
715 for (
int i = 0;
i < extraStrawsPipe;
i++)
717 if((tmpypos2Pipe - limitPipe) < 0)
break;
720 lengthShort =
fabs((tmpypos2Pipe - newradius - limitPipe) /
sin(
skewangle * (
pi / 180.)));
724 lengthsShortPipe.push_back(lengthShort);
725 tmpypos2Pipe -= 2 * newradius;
727 extraStrawsPipe = extracounter;
732 vectorx = -
cos((60. / 180.) *
pi);
733 vectory =
sin((60. / 180.) *
pi);
735 tmpxpos = xpos - (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
736 tmpypos = ypos - (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
738 for(
int i = 0;
i < possibleStrawsPipe;
i++)
742 tmpypos + (translationToLeft - additionalShift) *
cos(sixtyrad),
745 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
746 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
749 for (
int i = 0;
i < extraStrawsPipe;
i++)
752 lengthShort = lengthsShortPipe[
i];
755 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
756 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
757 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
760 tmpypos + (translationToLeft - additionalShift - translationToFrontPer) *
cos(sixtyrad),
761 zpos - translationToFrontPar,
762 vectorx, vectory, vectorz, lengthShort);
765 tmpypos + (translationToLeft - additionalShift + translationToFrontPer + switchSides) *
cos(sixtyrad),
766 zpos + translationToFrontPar,
767 vectorx, vectory, vectorz, lengthShort);
770 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
771 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
779 xpos -= availableSpace *
sin((60. / 180.) *
pi);
780 ypos -= availableSpace *
cos((60. / 180.) *
pi);
782 tmpypos = ypos - extraspace - newradius;
784 for(
int i = 0;
i < possibleStraws;
i++)
787 tmpypos -= 2 * newradius;
790 for (
int i = 0;
i < extraStraws;
i++)
793 lengthShort = lengthsShort[
i];
796 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
797 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
798 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
801 tmpypos - additionalShift + (translationToLeft - translationToFrontPer),
802 zpos - translationToFrontPar,
803 vectorx, vectory, vectorz, lengthShort);
806 tmpypos - additionalShift + (translationToLeft + translationToFrontPer + switchSides),
807 zpos + translationToFrontPar,
808 vectorx, vectory, vectorz, lengthShort);
810 tmpypos -= 2 * newradius;
814 vectorx = -1 *
cos((60. / 180.) *
pi);
815 vectory = -1 *
sin((60. / 180.) *
pi);
817 ypos -= availableSpace;
818 tmpxpos = xpos + (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
819 tmpypos = ypos - (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
821 for(
int i = 0;
i < possibleStrawsPipe;
i++)
825 tmpypos + (translationToLeft - additionalShift) *
cos(sixtyrad),
828 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
829 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
832 for (
int i = 0;
i < extraStrawsPipe;
i++)
835 lengthShort = lengthsShortPipe[
i];
838 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
839 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
840 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
843 tmpypos + (translationToLeft - translationToFrontPer - additionalShift) *
cos(sixtyrad),
844 zpos - translationToFrontPar,
845 vectorx, vectory, vectorz, lengthShort);
848 tmpypos + (translationToLeft + translationToFrontPer - additionalShift + switchSides) *
cos(sixtyrad),
849 zpos + translationToFrontPar,
850 vectorx, vectory, vectorz, lengthShort);
852 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
853 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
857 vectorx = 1 *
cos((60. / 180.) *
pi);
858 vectory = -1 *
sin((60. / 180.) *
pi);
860 xpos += availableSpace *
sin((60. / 180.) *
pi);
861 ypos -= availableSpace *
cos((60. / 180.) *
pi);
862 tmpxpos = xpos + (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
863 tmpypos = ypos + (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
865 for(
int i = 0;
i < possibleStrawsPipe;
i++)
869 tmpypos - (translationToLeft - additionalShift) *
cos(sixtyrad),
872 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
873 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
876 for (
int i = 0;
i < extraStrawsPipe;
i++)
879 lengthShort = lengthsShortPipe[
i];
882 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
883 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
884 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
887 tmpypos - (translationToLeft - additionalShift - translationToFrontPer) *
cos(sixtyrad),
888 zpos - translationToFrontPar,
889 vectorx, vectory, vectorz, lengthShort);
892 tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) *
cos(sixtyrad),
893 zpos + translationToFrontPar,
894 vectorx, vectory, vectorz, lengthShort);
896 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
897 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
904 xpos += availableSpace *
sin((60. / 180.) *
pi);
905 ypos += availableSpace *
cos((60. / 180.) *
pi);
907 tmpypos = ypos + extraspace + newradius;
909 for(
int i = 0;
i < possibleStraws;
i++)
912 tmpypos += 2 * newradius;
915 for (
int i = 0;
i < extraStraws;
i++)
918 lengthShort = lengthsShort[
i];
921 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
922 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
923 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
926 zpos - translationToFrontPar,
927 vectorx, vectory, vectorz, lengthShort);
929 putStrawRotatedShortRight(tmpxpos, tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides),
930 zpos + translationToFrontPar,
931 vectorx, vectory, vectorz, lengthShort);
933 tmpypos += 2 * newradius;
937 vectorx =
cos((60. / 180.) *
pi);
938 vectory =
sin((60. / 180.) *
pi);
940 ypos += availableSpace;
941 tmpxpos = xpos - (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
942 tmpypos = ypos + (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
944 for(
int i = 0;
i < possibleStrawsPipe;
i++)
948 tmpypos - (translationToLeft - additionalShift) *
cos(sixtyrad),
951 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
952 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
955 for (
int i = 0;
i < extraStrawsPipe;
i++)
958 lengthShort = lengthsShortPipe[
i];
961 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
962 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
963 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
966 tmpypos - (translationToLeft - additionalShift - translationToFrontPer) *
cos(sixtyrad),
967 zpos - translationToFrontPar,
968 vectorx, vectory, vectorz, lengthShort);
971 tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) *
cos(sixtyrad),
972 zpos + translationToFrontPar,
973 vectorx, vectory, vectorz, lengthShort);
975 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
976 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1002 ypos = ringposition /
cos((30. / 180.) *
pi),
1013 availableSpace = 2. * ringposition * tan((30. / 180.) *
pi);
1021 extraStraws = int(availableSpace / (newradius * 2)) - possibleStraws;
1026 extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
1032 sixtyrad = (60. / 180.) *
pi,
1034 translationToLeft = - 0.5 *
tubeLength * tan(skewanglerad);
1042 xpos2 = xpos - availableSpace *
sin((60. / 180.) *
pi),
1043 ypos2 = ypos - availableSpace *
cos((60. / 180.) *
pi),
1046 tmpypos2 = ypos2 - extraspace - newradius,
1048 limit = ypos2 - availableSpace + newradius +
safety + extraspace;
1055 for(
int i = 0;
i < possibleStraws;
i++)
1057 tmpypos2 -= 2 * newradius;
1061 int extracounter = 0;
1062 for (
int i = 0;
i < extraStraws;
i++)
1064 if((tmpypos2 - limit) < 0)
break;
1073 lengthsShort.push_back(lengthShort);
1075 tmpypos2 -= 2 * newradius;
1077 extraStraws = extracounter;
1085 availableSpacePipe = 2. * ringposition * tan((30. / 180.) *
pi) - pipespace;
1093 extraStrawsPipe = int(availableSpacePipe / (newradius * 2)) - possibleStrawsPipe;
1098 extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
1108 xpos2Pipe = xpos - availableSpacePipe *
sin((60. / 180.) *
pi),
1109 ypos2Pipe = ypos - availableSpacePipe *
cos((60. / 180.) *
pi),
1111 tmpxpos2Pipe = xpos2Pipe,
1112 tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
1114 limitPipe = ypos2Pipe - availableSpacePipe + newradius +
safety + extraspacePipe;
1117 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1119 tmpypos2Pipe -= 2 * newradius;
1124 for (
int i = 0;
i < extraStrawsPipe;
i++)
1126 if((tmpypos2Pipe - limitPipe) < 0)
break;
1129 lengthShort =
fabs((tmpypos2Pipe - newradius - limitPipe) /
sin(
skewangle * (
pi / 180.)));
1134 lengthsShortPipe.push_back(lengthShort);
1136 tmpypos2Pipe -= 2 * newradius;
1138 extraStrawsPipe = extracounter;
1142 vectorx = -
cos((60. / 180.) *
pi);
1143 vectory =
sin((60. / 180.) *
pi);
1145 tmpxpos = xpos - (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
1146 tmpypos = ypos - (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
1148 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1152 tmpypos + translationToLeft *
cos(sixtyrad),
1155 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1156 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1159 for (
int i = 0;
i < extraStrawsPipe;
i++)
1162 lengthShort = lengthsShortPipe[
i];
1165 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1166 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1168 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1172 tmpypos + (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1173 zpos + translationToFrontPar,
1174 vectorx, vectory, vectorz, lengthShort);
1177 tmpypos + (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1178 zpos - translationToFrontPar,
1179 vectorx, vectory, vectorz, lengthShort);
1182 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1183 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1190 xpos -= availableSpace *
sin((60. / 180.) *
pi);
1191 ypos -= availableSpace *
cos((60. / 180.) *
pi);
1193 tmpypos = ypos - extraspace - newradius;
1195 for(
int i = 0;
i < possibleStraws;
i++)
1198 tmpypos -= 2 * newradius;
1201 for (
int i = 0;
i < extraStraws;
i++)
1204 lengthShort = lengthsShort[
i];
1207 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1208 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1209 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
1212 tmpypos + (translationToLeft + translationToFrontPer),
1213 zpos + translationToFrontPar,
1214 vectorx, vectory, vectorz, lengthShort);
1217 tmpypos + (translationToLeft - translationToFrontPer + switchSides),
1218 zpos - translationToFrontPar,
1219 vectorx, vectory, vectorz, lengthShort);
1221 tmpypos -= 2 * newradius;
1225 vectorx = -1 *
cos((60. / 180.) *
pi);
1226 vectory = -1 *
sin((60. / 180.) *
pi);
1228 ypos -= availableSpace;
1229 tmpxpos = xpos + (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
1230 tmpypos = ypos - (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
1232 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1236 tmpypos + translationToLeft *
cos(sixtyrad),
1239 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1240 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1243 for (
int i = 0;
i < extraStrawsPipe;
i++)
1246 lengthShort = lengthsShortPipe[
i];
1249 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1250 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1251 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1254 tmpypos + (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1255 zpos + translationToFrontPar,
1256 vectorx, vectory, vectorz, lengthShort);
1259 tmpypos + (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1260 zpos - translationToFrontPar,
1261 vectorx, vectory, vectorz, lengthShort);
1263 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1264 tmpypos -= 2 * newradius *
cos((60. / 180.) *
pi);
1268 vectorx = 1 *
cos((60. / 180.) *
pi);
1269 vectory = -1 *
sin((60. / 180.) *
pi);
1271 xpos += availableSpace *
sin((60. / 180.) *
pi);
1272 ypos -= availableSpace *
cos((60. / 180.) *
pi);
1273 tmpxpos = xpos + (extraspacePipe + newradius + pipespace) *
sin((60. / 180.) *
pi);
1274 tmpypos = ypos + (extraspacePipe + newradius + pipespace) *
cos((60. / 180.) *
pi);
1276 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1280 tmpypos - translationToLeft *
cos(sixtyrad),
1283 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1284 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1287 for (
int i = 0;
i < extraStrawsPipe;
i++)
1290 lengthShort = lengthsShortPipe[
i];
1293 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1294 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1295 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1299 tmpypos - (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1300 zpos + translationToFrontPar,
1301 vectorx, vectory, vectorz, lengthShort);
1304 tmpypos - (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1305 zpos - translationToFrontPar,
1306 vectorx, vectory, vectorz, lengthShort);
1308 tmpxpos += 2 * newradius *
sin((60. / 180.) *
pi);
1309 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1316 xpos += availableSpace *
sin((60. / 180.) *
pi);
1317 ypos += availableSpace *
cos((60. / 180.) *
pi);
1319 tmpypos = ypos + extraspace + newradius;
1321 for(
int i = 0;
i < possibleStraws;
i++)
1326 tmpypos += 2 * newradius;
1329 for (
int i = 0;
i < extraStraws;
i++)
1332 lengthShort = lengthsShort[
i];
1335 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1336 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1337 switchSides = 2 * newradius * (possibleStraws + 1 + (2 *
i)) *
cos(skewanglerad);
1340 tmpypos - (translationToLeft + translationToFrontPer),
1341 zpos + translationToFrontPar,
1342 vectorx, vectory, vectorz, lengthShort);
1345 tmpypos - (translationToLeft - translationToFrontPer + switchSides),
1346 zpos - translationToFrontPar,
1347 vectorx, vectory, vectorz, lengthShort);
1349 tmpypos += 2 * newradius;
1353 vectorx =
cos((60. / 180.) *
pi);
1354 vectory =
sin((60. / 180.) *
pi);
1356 ypos += availableSpace;
1357 tmpxpos = xpos - (extraspacePipe + newradius) *
sin((60. / 180.) *
pi);
1358 tmpypos = ypos + (extraspacePipe + newradius) *
cos((60. / 180.) *
pi);
1360 for(
int i = 0;
i < possibleStrawsPipe;
i++)
1364 tmpypos - translationToLeft *
cos(sixtyrad),
1367 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1368 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1371 for (
int i = 0;
i < extraStrawsPipe;
i++)
1374 lengthShort = lengthsShortPipe[
i];
1377 translationToFrontPar = ((
tubeLength - lengthShort) / 2.) *
cos(skewanglerad),
1378 translationToFrontPer = ((
tubeLength - lengthShort) / 2.) *
sin(skewanglerad),
1379 switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 *
i)) *
cos(skewanglerad);
1382 tmpypos - (translationToLeft + translationToFrontPer) *
cos(sixtyrad),
1383 zpos + translationToFrontPar,
1384 vectorx, vectory, vectorz, lengthShort);
1387 tmpypos - (translationToLeft - translationToFrontPer + switchSides) *
cos(sixtyrad),
1388 zpos - translationToFrontPar,
1389 vectorx, vectory, vectorz, lengthShort);
1391 tmpxpos -= 2 * newradius *
sin((60. / 180.) *
pi);
1392 tmpypos += 2 * newradius *
cos((60. / 180.) *
pi);
1412 while (ringteller *
sqrt(3.) * radius - radius <= startRadius)
1416 cerr <<
"startRadius " << startRadius << endl;
1418 startRadius = (ringteller + 1) *
sqrt(3.) * radius;
1421 cerr <<
"positioning ring at: " << ringteller *
sqrt(3.) * radius << endl;
1424 cerr <<
"positioning ring at: " << (ringteller + 1) *
sqrt(3.) * radius << endl;
1427 cerr <<
"ringteller " << ringteller << endl;
1445 startRadius = (ringteller + 1) *
sqrt(3.) * radius;
1447 cerr <<
"positioning ring at: " << ringteller *
sqrt(3.) * radius << endl;
1449 cerr <<
"ringteller " << ringteller <<
" radius " << radius << endl;
1483 cout << setiosflags(ios::fixed) << setprecision(6);
1498 cout <<
cave << endl;
1499 cout <<
"ASSEMBLY" << endl;
1500 cout <<
air << endl;
1503 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1511 writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
1520 writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
1529 writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
1538 writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
1545 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1549 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1553 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1557 writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1584 cerr <<
"start radius before skewed " << startRadius << endl;
1593 cerr <<
"start radius after " << startRadius << endl;
1596 cerr <<
"start radius " << startRadius << endl;
static int axialtubeteller
int main(int argc, char **argv)
friend F32vec4 cos(const F32vec4 &a)
bool putStraw(double posX, double posY, double posZ)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
bool putStrawRotatedShortLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
static double maximumradius
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)
#define outerCoverThickness
#define innerCoverThickness
void plotrotright(double x, double y, double z)
void makeSingleLayerStraightExact(double &startRadius)
void placeSingleLayerStraightExact(double ringteller)
static int skewedtubeteller
friend F32vec4 fabs(const F32vec4 &a)
void makeDoubleLayerSkewedRight(double startRadius)
void placeSingleLayerSkewedRight(double ringposition)
bool putStrawRotatedLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
void writehalftube(double inner, double outer, double length)
static double minimumradius
void placeSingleLayerSkewedLeft(double ringposition)
void makeDoubleLayerSkewedLeft(double startRadius)
void writetube(double inner, double outer, double length)
static int shortskewedtubeteller
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)