34 #define outerDiam     82.2000  
   35 #define innerDiam     31.8000  
   36 #define tubeInnerDiam  1.0000 
   37 #define tubeOuterDiam  1.0060 
   38 #define tubeSeperation 1.0100 
   39 #define wireDiam       0.0020 
   40 #define tubeLength   150.0000  
   47 #define sttCenterZ 35. 
   49 #define innerCoverThickness 0.1000 // cm 
   50 #define outerCoverThickness 0.1000 // cm 
   52 #define panelthickness 0.1000  
   53 #define pipeDiam       4.0000 
   58 #define pi 3.141592653589793238512808959406186204433 
   61 #define sttassembly "stt01assembly" 
   62 #define innerCylinder "stt01innerCylinder" 
   63 #define outerCylinder "stt01outerCylinder" 
   64 #define panel1 "stt01box#1" 
   65 #define panel2 "stt01box#2" 
   66 #define panel3 "stt01box#3" 
   67 #define panel4 "stt01box#4" 
   71 #define AlBe "STTsupport" 
   73 #define HeMixture "STTmix9010_2bar" 
   84 void writename(
char const *
name, 
bool support = 
false, 
bool leftside = 
false)
 
   86   if(support && leftside)  cout << name << 
"#1" << endl;
 
   87   else if(support && !leftside) cout << name << 
"#2" << endl;
 
   88   else cout << name << endl;
 
   95   if (original && !support)
 
   96     cout << 
"TUBE" << endl;
 
   97   if(original && support)
 
   98     cout << 
"TUBS" << endl;
 
  104   cout << name << endl;
 
  106     cout << 
"TUBS" << endl;
 
  112   cout << name << endl;
 
  116 void writetube(
double inner, 
double outer,  
double length)
 
  118   cout << 0. << 
"    " << 0. << 
"    " << -1. * length * 10. << endl;  
 
  119   cout << inner * 10. << 
"   " << outer * 10. << endl;
 
  120   cout << 0. << 
"    " << 0. << 
"    " << length * 10. << endl;  
 
  126   cout << 0. << 
"    " << 0. << 
"    " << -1. * length * 10. << endl;  
 
  127   cout << inner * 10. << 
"   " << outer * 10. << endl;
 
  128   cout << 0. << 
"    " << 0. << 
"    " << length * 10. << endl;  
 
  129   cout << atan((
pipeDiam/2.)/outer) * (180. / 
pi) << 
"    " << 180. - atan((
pipeDiam/2.)/outer) * (180. / 
pi) << endl;
 
  133 void writepanel(
char const *
name, 
bool firstone, 
double xthick, 
double ythick,  
double length, 
int side)
 
  140     cout << name << endl;
 
  142     cout << 
"BOX" << endl;
 
  143     cout << 
AlBe << endl;
 
  144     cout <<  xthick/2. << 
" " << -ythick/2. << 
" " << -length / 2. << endl;
 
  145     cout <<  xthick/2. << 
" " <<  ythick/2. << 
" " << -length / 2. << endl;
 
  146     cout << -xthick/2. << 
" " <<  ythick/2. << 
" " << -length / 2. << endl;
 
  147     cout << -xthick/2. << 
" " << -ythick/2. << 
" " << -length / 2. << endl;
 
  148     cout <<  xthick/2. << 
" " << -ythick/2. << 
" " <<  length / 2. << endl;
 
  149     cout <<  xthick/2. << 
" " <<  ythick/2. << 
" " <<  length / 2. << endl;
 
  150     cout << -xthick/2. << 
" " <<  ythick/2. << 
" " <<  length / 2. << endl;
 
  151     cout << -xthick/2. << 
" " << -ythick/2. << 
" " <<  length / 2. << endl;
 
  154     cout << name << endl;
 
  163   cout << x * 10. << 
"   " << y * 10. << 
"   " << z * 10. << endl;
 
  167 void writerot(
double x00, 
double x01, 
double x02, 
double x10, 
double x11, 
double x12, 
double x20, 
double x21, 
double x22)
 
  169   cout << x00 << 
"   "  << x01 << 
"   " << x02 << 
"   "   
  170        << x10 << 
"   "  << x11 << 
"   " << x12 << 
"   "   
  171        << x20 << 
"   "  << x21 << 
"   " << x22 << endl;
 
  172   cout << 
"//----------------------------------------------------------" << endl;
 
  177 bool putStraw(
double posX, 
double posY, 
double posZ)
 
  197       conv >> tubetellerStr;
 
  200         nameItube = 
"stt01tube#" + tubetellerStr,
 
  201         nameIgas = 
"stt01gas#" + tubetellerStr,
 
  202         nameIwire = 
"stt01wire#" + tubetellerStr;
 
  225           writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  233           writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  241           writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  249           writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  268   cout << 1 + (1 - 
cos(newskewangle * (
pi / 180.))) * (x * x - 1) << 
"  "  
  269        << -z * 
sin(newskewangle * (
pi / 180.)) + (1 - 
cos(newskewangle * (
pi / 180.))) * x * y << 
"  "  
  270        << y * 
sin(newskewangle * (
pi / 180.)) + (1 - 
cos(newskewangle * (
pi / 180.))) * x * z << 
"  "  
  272        << z * 
sin(newskewangle * (
pi / 180.)) + (1 - 
cos(newskewangle * (
pi / 180.))) * x * y << 
"  "  
  273        << 1 + (1 - 
cos(newskewangle * (
pi / 180.))) * (y * y - 1) << 
"  " 
  274        << -x * 
sin(newskewangle * (
pi / 180.)) + (1 - 
cos(newskewangle * (
pi / 180.))) * y * z << 
"  "  
  276        << -y * 
sin(newskewangle * (
pi / 180.)) + (1 - 
cos(newskewangle * (
pi / 180.))) * x * z << 
"  "  
  277        << x * 
sin(newskewangle * (
pi / 180.)) + (1 - 
cos(newskewangle * (
pi / 180.))) * y * z << 
"  "  
  278        << 1 + (1 - 
cos(newskewangle * (
pi / 180.))) * (z * z - 1) << endl;
 
  279   cout << 
"//----------------------------------------------------------" << endl;
 
  286   cout << 1 + (1 - 
cos(
skewangle * (
pi / 180.))) * (x * x - 1) << 
"  "  
  297   cout << 
"//----------------------------------------------------------" << endl;
 
  301 bool putStrawRotatedShortLeft(
double posX, 
double posY, 
double posZ, 
double xvector, 
double yvector, 
double zvector, 
double length)
 
  317       conv >> tubetellerStr;
 
  320         nameItube = 
"stt01tube" + tubetellerStr,
 
  321         nameIgas = 
"stt01gas" + tubetellerStr,
 
  322         nameIwire = 
"stt01wire" + tubetellerStr;
 
  340       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  348       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  376       conv >> tubetellerStr;
 
  379         nameItube = 
"stt01tube" + tubetellerStr,
 
  380         nameIgas = 
"stt01gas" + tubetellerStr,
 
  381         nameIwire = 
"stt01wire" + tubetellerStr;
 
  399       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  407       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  416 bool putStrawRotatedLeft(
double posX, 
double posY, 
double posZ, 
double xvector, 
double yvector, 
double zvector, 
double length)
 
  430   conv >> tubetellerStr;
 
  433     nameItube = 
"stt01tube#" + tubetellerStr,
 
  434     nameIgas = 
"stt01gas#" + tubetellerStr,
 
  435     nameIwire = 
"stt01wire#" + tubetellerStr;
 
  454       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  462       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  480 bool putStrawRotatedRight(
double posX, 
double posY, 
double posZ, 
double xvector, 
double yvector, 
double zvector, 
double length)
 
  496   conv >> tubetellerStr;
 
  499     nameItube = 
"stt01tube#" + tubetellerStr,
 
  500     nameIgas = 
"stt01gas#" + tubetellerStr,
 
  501     nameIwire = 
"stt01wire#" + tubetellerStr;
 
  521       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  529       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
  556     ypos = ((ringteller) * 2 * radius), 
 
  563   for(
int i = 0; 
i < ringteller; 
i++) 
 
  565       xpos -= 
sqrt(3.) * radius;
 
  569   for(
int i = 0; 
i < ringteller; 
i++) 
 
  574   for(
int i = 0; 
i < ringteller; 
i++) 
 
  576       xpos += 
sqrt(3.) *  radius;
 
  580   for(
int i = 0; 
i < ringteller; 
i++) 
 
  582       xpos += 
sqrt(3.) * radius;
 
  586   for(
int i = 0; 
i < ringteller; 
i++) 
 
  591   for(
int i = 0; 
i < ringteller; 
i++) 
 
  593       xpos -= 
sqrt(3.) * radius;
 
  609     newradius = radius / 
cos((newskewangle / 180.) * 
pi);
 
  613     ypos = ringposition / 
cos((30. / 180.) * 
pi),  
 
  622     availableSpace = 2. * ringposition * tan((30. / 180.) * 
pi);
 
  625     possibleStraws = int((availableSpace - 
fabs(
tubeLength * 
sin((newskewangle / 180.) * 
pi))) / (newradius * 2)),
 
  626     extraStraws = -1 * possibleStraws + int(availableSpace / (newradius * 2));
 
  629     extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
 
  631   cerr << 
"extra space: " << extraspace * 2 << endl;
 
  634     skewanglerad = (newskewangle / 180.) * 
pi,
 
  635     sixtyrad = (60. / 180.) * 
pi,
 
  636     translationToLeft = - 0.5 * 
tubeLength * tan(skewanglerad);
 
  643     xpos2 = xpos - availableSpace * 
sin((60. / 180.) * 
pi),
 
  644     ypos2 = ypos - availableSpace * 
cos((60. / 180.) * 
pi),
 
  646     tmpypos2 = ypos2  - extraspace - newradius,
 
  647     limit = ypos2 - availableSpace + newradius + 
safety;
 
  649   for(
int i = 0; 
i < possibleStraws; 
i++) 
 
  651       tmpypos2 -= 2 * newradius;
 
  654   for (
int i = 0; 
i < extraStraws; 
i++)
 
  657         lengthShort = (tmpypos2 - 
limit) / 
sin(newskewangle * (
pi / 180.));
 
  663       lengthsShort.push_back(
fabs(lengthShort));
 
  665       tmpypos2 -= 2 * newradius;
 
  679     availableSpacePipe = 2. * ringposition * tan((30. / 180.) * 
pi) - pipespace;
 
  687     extraStrawsPipe = -1 * possibleStrawsPipe + int(availableSpacePipe / (newradius * 2));
 
  691     extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
 
  701     xpos2Pipe = xpos - availableSpacePipe * 
sin((60. / 180.) * 
pi),
 
  702     ypos2Pipe = ypos - availableSpacePipe * 
cos((60. / 180.) * 
pi),
 
  704     tmpxpos2Pipe = xpos2Pipe,
 
  705     tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
 
  707     limitPipe = ypos2Pipe - availableSpacePipe + newradius + 
safety;
 
  711   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
  713       tmpypos2Pipe -= 2 * newradius;
 
  717   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
  720         lengthShort = (tmpypos2Pipe - limitPipe) / 
sin(
skewangle * (
pi / 180.));
 
  724       lengthsShortPipe.push_back(lengthShort);
 
  725       tmpypos2Pipe -= 2 * newradius;
 
  730   vectorx = -
cos((60. / 180.) * 
pi);
 
  731   vectory = 
sin((60. / 180.) * 
pi);
 
  733   tmpxpos = xpos - (extraspacePipe + newradius + pipespace) * 
sin((60. / 180.) * 
pi);
 
  734   tmpypos = ypos - (extraspacePipe + newradius + pipespace) * 
cos((60. / 180.) * 
pi);
 
  736   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
  740                            tmpypos + (translationToLeft - additionalShift) * 
cos(sixtyrad), 
 
  743       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  744       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  747   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
  750         lengthShort = lengthsShortPipe[
i];
 
  753         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
  754         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
  755         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
  758                                 tmpypos + (translationToLeft - additionalShift - translationToFrontPer) * 
cos(sixtyrad), 
 
  759                                 zpos - translationToFrontPar, 
 
  760                                 vectorx, vectory, vectorz, lengthShort);
 
  763                                 tmpypos + (translationToLeft - additionalShift + translationToFrontPer + switchSides) * 
cos(sixtyrad), 
 
  764                                 zpos + translationToFrontPar, 
 
  765                                 vectorx, vectory, vectorz, lengthShort);
 
  768       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  769       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  777   xpos -= availableSpace * 
sin((60. / 180.) * 
pi);
 
  778   ypos -= availableSpace * 
cos((60. / 180.) * 
pi);
 
  780   tmpypos = ypos - extraspace - newradius;
 
  782   for(
int i = 0; 
i < possibleStraws; 
i++) 
 
  785       tmpypos -= 2 * newradius;
 
  788   for (
int i = 0; 
i < extraStraws; 
i++)
 
  791         lengthShort = lengthsShort[
i];
 
  794         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
  795         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
  796         switchSides = 2 * newradius * (possibleStraws + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
  799                                 tmpypos - additionalShift + (translationToLeft - translationToFrontPer), 
 
  800                                 zpos - translationToFrontPar, 
 
  801                                 vectorx, vectory, vectorz, lengthShort);
 
  804                                 tmpypos - additionalShift + (translationToLeft + translationToFrontPer + switchSides), 
 
  805                                 zpos + translationToFrontPar, 
 
  806                                 vectorx, vectory, vectorz, lengthShort);
 
  808       tmpypos -= 2 * newradius;
 
  812   vectorx = -1 * 
cos((60. / 180.) * 
pi);
 
  813   vectory =  -1 * 
sin((60. / 180.) * 
pi);
 
  815   ypos -= availableSpace;
 
  816   tmpxpos = xpos + (extraspacePipe + newradius) * 
sin((60. / 180.) * 
pi);
 
  817   tmpypos = ypos - (extraspacePipe + newradius) * 
cos((60. / 180.) * 
pi);
 
  819   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
  823                            tmpypos + (translationToLeft - additionalShift) * 
cos(sixtyrad), 
 
  826       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  827       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  830   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
  833         lengthShort = lengthsShortPipe[
i];
 
  836         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
  837         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
  838         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
  841                                 tmpypos + (translationToLeft - translationToFrontPer - additionalShift) * 
cos(sixtyrad), 
 
  842                                 zpos - translationToFrontPar, 
 
  843                                 vectorx, vectory, vectorz, lengthShort);
 
  846                                 tmpypos + (translationToLeft + translationToFrontPer - additionalShift + switchSides) * 
cos(sixtyrad), 
 
  847                                 zpos + translationToFrontPar, 
 
  848                                 vectorx, vectory, vectorz, lengthShort);
 
  850       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  851       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  855   vectorx = 1 * 
cos((60. / 180.) * 
pi);
 
  856   vectory = -1 * 
sin((60. / 180.) * 
pi);
 
  858   xpos += availableSpace * 
sin((60. / 180.) * 
pi);
 
  859   ypos -= availableSpace * 
cos((60. / 180.) * 
pi);
 
  860   tmpxpos = xpos + (extraspacePipe + newradius + pipespace) * 
sin((60. / 180.) * 
pi);
 
  861   tmpypos = ypos + (extraspacePipe + newradius + pipespace) * 
cos((60. / 180.) * 
pi);
 
  863   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
  867                            tmpypos - (translationToLeft - additionalShift) * 
cos(sixtyrad), 
 
  870       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  871       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  874   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
  877         lengthShort = lengthsShortPipe[
i];
 
  880         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
  881         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
  882         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
  885                                 tmpypos - (translationToLeft - additionalShift - translationToFrontPer) * 
cos(sixtyrad), 
 
  886                                 zpos - translationToFrontPar, 
 
  887                                 vectorx, vectory, vectorz, lengthShort);
 
  890                                 tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) * 
cos(sixtyrad), 
 
  891                                 zpos + translationToFrontPar, 
 
  892                                 vectorx, vectory, vectorz, lengthShort);
 
  894       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  895       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  902   xpos += availableSpace * 
sin((60. / 180.) * 
pi);
 
  903   ypos += availableSpace * 
cos((60. / 180.) * 
pi);
 
  905   tmpypos = ypos + extraspace + newradius;
 
  907   for(
int i = 0; 
i < possibleStraws; 
i++) 
 
  910       tmpypos += 2 * newradius;
 
  913   for (
int i = 0; 
i < extraStraws; 
i++)
 
  916         lengthShort = lengthsShort[
i];
 
  919         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
  920         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
  921         switchSides = 2 * newradius * (possibleStraws + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
  924                                 zpos - translationToFrontPar, 
 
  925                                 vectorx, vectory, vectorz, lengthShort);
 
  927       putStrawRotatedShortRight(tmpxpos, tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides), 
 
  928                                 zpos + translationToFrontPar, 
 
  929                                 vectorx, vectory, vectorz, lengthShort);
 
  931       tmpypos += 2 * newradius;
 
  935   vectorx = 
cos((60. / 180.) * 
pi);
 
  936   vectory = 
sin((60. / 180.) * 
pi);
 
  938   ypos += availableSpace;
 
  939   tmpxpos = xpos - (extraspacePipe + newradius) * 
sin((60. / 180.) * 
pi);
 
  940   tmpypos = ypos + (extraspacePipe + newradius) * 
cos((60. / 180.) * 
pi);
 
  942   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
  946                            tmpypos - (translationToLeft - additionalShift) * 
cos(sixtyrad), 
 
  949       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  950       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
  953   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
  956         lengthShort = lengthsShortPipe[
i];
 
  959         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
  960         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
  961         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
  964                                 tmpypos - (translationToLeft - additionalShift - translationToFrontPer) * 
cos(sixtyrad), 
 
  965                                 zpos - translationToFrontPar, 
 
  966                                 vectorx, vectory, vectorz, lengthShort);
 
  969                                 tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) * 
cos(sixtyrad), 
 
  970                                 zpos + translationToFrontPar, 
 
  971                                 vectorx, vectory, vectorz, lengthShort);
 
  973       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
  974       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1000     ypos = ringposition / 
cos((30. / 180.) * 
pi),
 
 1011     availableSpace = 2. * ringposition * tan((30. / 180.) * 
pi);
 
 1019     extraStraws = int(availableSpace / (newradius * 2)) - possibleStraws;
 
 1024     extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
 
 1030     sixtyrad = (60. / 180.) * 
pi,
 
 1032     translationToLeft = - 0.5 * 
tubeLength * tan(skewanglerad);
 
 1040     xpos2 = xpos - availableSpace * 
sin((60. / 180.) * 
pi),
 
 1041     ypos2 = ypos - availableSpace * 
cos((60. / 180.) * 
pi),
 
 1044     tmpypos2 = ypos2  - extraspace - newradius,
 
 1046     limit = ypos2 - availableSpace + newradius + 
safety;
 
 1053   for(
int i = 0; 
i < possibleStraws; 
i++) 
 
 1055       tmpypos2 -= 2 * newradius;
 
 1059   for (
int i = 0; 
i < extraStraws; 
i++)
 
 1068       lengthsShort.push_back(lengthShort);
 
 1070       tmpypos2 -= 2 * newradius;
 
 1079     availableSpacePipe = 2. * ringposition * tan((30. / 180.) * 
pi) - pipespace;
 
 1087     extraStrawsPipe = int(availableSpacePipe / (newradius * 2)) - possibleStrawsPipe;
 
 1092     extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
 
 1102     xpos2Pipe = xpos - availableSpacePipe * 
sin((60. / 180.) * 
pi),
 
 1103     ypos2Pipe = ypos - availableSpacePipe * 
cos((60. / 180.) * 
pi),
 
 1105     tmpxpos2Pipe = xpos2Pipe, 
 
 1106     tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
 
 1108     limitPipe = ypos2Pipe - availableSpacePipe + newradius + 
safety;
 
 1111   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
 1113       tmpypos2Pipe -= 2 * newradius;
 
 1117   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
 1120         lengthShort = (tmpypos2Pipe - limitPipe) / 
sin(
skewangle * (
pi / 180.));
 
 1125       lengthsShortPipe.push_back(lengthShort);
 
 1127       tmpypos2Pipe -= 2 * newradius;
 
 1132   vectorx = -
cos((60. / 180.) * 
pi);
 
 1133   vectory = 
sin((60. / 180.) * 
pi);
 
 1135   tmpxpos = xpos - (extraspacePipe + newradius + pipespace) * 
sin((60. / 180.) * 
pi);
 
 1136   tmpypos = ypos - (extraspacePipe + newradius + pipespace) * 
cos((60. / 180.) * 
pi);
 
 1138   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
 1142                           tmpypos + translationToLeft * 
cos(sixtyrad), 
 
 1145       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1146       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1149   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
 1152         lengthShort = lengthsShortPipe[
i];
 
 1155         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
 1156         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
 1158         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
 1162                                tmpypos + (translationToLeft + translationToFrontPer) * 
cos(sixtyrad), 
 
 1163                                zpos + translationToFrontPar, 
 
 1164                                vectorx, vectory, vectorz, lengthShort);
 
 1167                                tmpypos + (translationToLeft - translationToFrontPer + switchSides) * 
cos(sixtyrad),
 
 1168                                zpos - translationToFrontPar, 
 
 1169                                vectorx, vectory, vectorz, lengthShort);
 
 1172       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1173       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1180   xpos -= availableSpace * 
sin((60. / 180.) * 
pi);
 
 1181   ypos -= availableSpace * 
cos((60. / 180.) * 
pi);
 
 1183   tmpypos = ypos - extraspace - newradius;
 
 1185   for(
int i = 0; 
i < possibleStraws; 
i++) 
 
 1188       tmpypos -= 2 * newradius;
 
 1191   for (
int i = 0; 
i < extraStraws; 
i++)
 
 1194         lengthShort = lengthsShort[
i];
 
 1197         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
 1198         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
 1199         switchSides = 2 * newradius * (possibleStraws + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
 1202                                tmpypos + (translationToLeft + translationToFrontPer), 
 
 1203                                zpos + translationToFrontPar, 
 
 1204                                vectorx, vectory, vectorz, lengthShort);
 
 1207                                tmpypos + (translationToLeft - translationToFrontPer + switchSides), 
 
 1208                                zpos - translationToFrontPar, 
 
 1209                                vectorx, vectory, vectorz, lengthShort);
 
 1211       tmpypos -= 2 * newradius;
 
 1215   vectorx =  -1 * 
cos((60. / 180.) * 
pi);
 
 1216   vectory =  -1 * 
sin((60. / 180.) * 
pi);
 
 1218   ypos -= availableSpace;
 
 1219   tmpxpos = xpos + (extraspacePipe + newradius) * 
sin((60. / 180.) * 
pi);
 
 1220   tmpypos = ypos - (extraspacePipe + newradius) * 
cos((60. / 180.) * 
pi);
 
 1222   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
 1226                           tmpypos + translationToLeft * 
cos(sixtyrad), 
 
 1229       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1230       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1233   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
 1236         lengthShort = lengthsShortPipe[
i];
 
 1239         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
 1240         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
 1241         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
 1244                                tmpypos + (translationToLeft + translationToFrontPer) * 
cos(sixtyrad), 
 
 1245                                zpos + translationToFrontPar, 
 
 1246                                vectorx, vectory, vectorz, lengthShort);
 
 1249                                tmpypos + (translationToLeft - translationToFrontPer + switchSides) * 
cos(sixtyrad), 
 
 1250                                zpos - translationToFrontPar, 
 
 1251                                vectorx, vectory, vectorz, lengthShort);
 
 1253       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1254       tmpypos -= 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1258   vectorx = 1 * 
cos((60. / 180.) * 
pi);
 
 1259   vectory = -1 * 
sin((60. / 180.) * 
pi);
 
 1261   xpos += availableSpace * 
sin((60. / 180.) * 
pi);
 
 1262   ypos -= availableSpace * 
cos((60. / 180.) * 
pi);
 
 1263   tmpxpos = xpos + (extraspacePipe + newradius + pipespace) * 
sin((60. / 180.) * 
pi);
 
 1264   tmpypos = ypos + (extraspacePipe + newradius + pipespace) * 
cos((60. / 180.) * 
pi);
 
 1266   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
 1270                           tmpypos - translationToLeft * 
cos(sixtyrad), 
 
 1273       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1274       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1277   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
 1280         lengthShort = lengthsShortPipe[
i];
 
 1283         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
 1284         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
 1285         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
 1289                                tmpypos - (translationToLeft + translationToFrontPer) * 
cos(sixtyrad), 
 
 1290                                zpos + translationToFrontPar, 
 
 1291                                vectorx, vectory, vectorz, lengthShort);
 
 1294                                tmpypos - (translationToLeft - translationToFrontPer + switchSides) * 
cos(sixtyrad), 
 
 1295                                zpos - translationToFrontPar, 
 
 1296                                vectorx, vectory, vectorz, lengthShort);
 
 1298       tmpxpos += 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1299       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1306   xpos += availableSpace * 
sin((60. / 180.) * 
pi);
 
 1307   ypos += availableSpace * 
cos((60. / 180.) * 
pi);
 
 1309   tmpypos = ypos + extraspace + newradius;
 
 1311   for(
int i = 0; 
i < possibleStraws; 
i++) 
 
 1316       tmpypos += 2 * newradius;
 
 1319   for (
int i = 0; 
i < extraStraws; 
i++)
 
 1322         lengthShort = lengthsShort[
i];
 
 1325         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
 1326         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
 1327         switchSides = 2 * newradius * (possibleStraws + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
 1330                                tmpypos - (translationToLeft + translationToFrontPer), 
 
 1331                                zpos + translationToFrontPar, 
 
 1332                                vectorx, vectory, vectorz, lengthShort);
 
 1335                                tmpypos - (translationToLeft - translationToFrontPer + switchSides), 
 
 1336                                zpos - translationToFrontPar, 
 
 1337                                vectorx, vectory, vectorz, lengthShort);
 
 1339       tmpypos += 2 * newradius;
 
 1343   vectorx = 
cos((60. / 180.) * 
pi);
 
 1344   vectory = 
sin((60. / 180.) * 
pi);
 
 1346   ypos += availableSpace;
 
 1347   tmpxpos = xpos - (extraspacePipe + newradius) * 
sin((60. / 180.) * 
pi);
 
 1348   tmpypos = ypos + (extraspacePipe + newradius) * 
cos((60. / 180.) * 
pi);
 
 1350   for(
int i = 0; 
i < possibleStrawsPipe; 
i++) 
 
 1354                           tmpypos - translationToLeft * 
cos(sixtyrad), 
 
 1357       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1358       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1361   for (
int i = 0; 
i < extraStrawsPipe; 
i++)
 
 1364         lengthShort = lengthsShortPipe[
i];
 
 1367         translationToFrontPar = ((
tubeLength - lengthShort) / 2.) * 
cos(skewanglerad),
 
 1368         translationToFrontPer = ((
tubeLength - lengthShort) / 2.) * 
sin(skewanglerad),
 
 1369         switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * 
i)) * 
cos(skewanglerad); 
 
 1372                                tmpypos - (translationToLeft + translationToFrontPer) * 
cos(sixtyrad), 
 
 1373                                zpos + translationToFrontPar, 
 
 1374                                vectorx, vectory, vectorz, lengthShort);
 
 1377                                tmpypos - (translationToLeft - translationToFrontPer + switchSides) * 
cos(sixtyrad), 
 
 1378                                zpos - translationToFrontPar, 
 
 1379                                vectorx, vectory, vectorz, lengthShort);
 
 1381       tmpxpos -= 2 * newradius * 
sin((60. / 180.) * 
pi);
 
 1382       tmpypos += 2 * newradius * 
cos((60. / 180.) * 
pi);
 
 1402   while (ringteller * 
sqrt(3.) * radius - radius <= startRadius)
 
 1406   cerr << 
"startRadius " << startRadius << endl;
 
 1408   startRadius = (ringteller + 1) * 
sqrt(3.) * radius;
 
 1411   cerr << 
"positioning ring at: " << ringteller * 
sqrt(3.) * radius << endl;
 
 1414   cerr << 
"positioning ring at: " << (ringteller + 1) * 
sqrt(3.) * radius << endl;
 
 1417   cerr << 
"ringteller " << ringteller << endl;
 
 1435   startRadius = (ringteller + 1) * 
sqrt(3.) * radius;
 
 1437   cerr << 
"positioning ring at: " << ringteller * 
sqrt(3.) * radius << endl;
 
 1439   cerr << 
"ringteller " << ringteller << 
" radius " << radius << endl;
 
 1473   cout << setiosflags(ios::fixed) << setprecision(6);
 
 1488       cout << 
cave << endl;
 
 1489       cout << 
"ASSEMBLY" << endl;
 
 1490       cout << 
air  << endl;
 
 1493       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
 1502       writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
 
 1512       writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
 
 1522       writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
 
 1532       writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
 
 1539       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
 1543       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
 1547       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
 1551       writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
 
 1578       cerr << 
"start radius before skewed " << startRadius << endl;
 
 1587       cerr << 
"start radius after " << startRadius << endl;
 
 1590       cerr << 
"start radius " << startRadius << endl;
 
void plotrotleft(double x, double y, double z)
friend F32vec4 cos(const F32vec4 &a)
void makeDoubleLayerStraightExact(double &startRadius)
void placeSingleLayerSkewedLeft(double ringposition)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
bool putStrawRotatedLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
void placeSingleLayerStraightExact(double ringteller)
bool putStrawRotatedRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
bool putStrawRotatedShortLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
void writemother(char const *name, bool original=true, bool support=false)
#define innerCoverThickness
void writetrans(double x, double y, double z)
bool putStraw(double posX, double posY, double posZ)
void placeSingleLayerSkewedRight(double ringposition)
static double minimumradius
void writehalftube(double inner, double outer, double length)
friend F32vec4 fabs(const F32vec4 &a)
void makeDoubleLayerSkewedLeft(double startRadius)
void writecylsupport(char const *name, bool firstone)
void makeSingleLayerStraightExact(double &startRadius)
void writerot(double x00, double x01, double x02, double x10, double x11, double x12, double x20, double x21, double x22)
void writetube(double inner, double outer, double length)
void writepanel(char const *name, bool firstone, double xthick, double ythick, double length, int side)
bool putStrawRotatedShortRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
#define outerCoverThickness
static int axialtubeteller
void writename(char const *name, bool support=false, bool leftside=false)
static double maximumradius
void writemedium(char *name)
void makeDoubleLayerSkewedRight(double startRadius)
static int shortskewedtubeteller
void plotrotright(double x, double y, double z)
static int skewedtubeteller