14 #include "GeoModelKernel/GeoBox.h"
15 #include "GeoModelKernel/GeoTube.h"
16 #include "GeoModelKernel/GeoSimplePolygonBrep.h"
17 #include "GeoModelKernel/GeoLogVol.h"
18 #include "GeoModelKernel/GeoPhysVol.h"
19 #include "GeoModelKernel/GeoMaterial.h"
20 #include "GeoModelKernel/GeoNameTag.h"
22 #include "GeoModelKernel/GeoTransform.h"
23 #include "GeoModelKernel/GeoDefinitions.h"
24 #include "GaudiKernel/PhysicalConstants.h"
34 GeoModelIO::ReadGeoModel* sqliteReader,
35 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
36 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
57 double pmWidth=pm.
Width();
64 double pmThicknessN3D=-1;
65 double pmThicknessP3D=-1.;
67 double pmShilftLateral3D=0.;
68 double radialShift=0.;
69 double radialShiftThickN=0.;
70 if(staveLayout==5||staveLayout==6||staveLayout==7)
78 if(pmThicknessP3D>pmThicknessP) radialShift = -(pmThicknessP3D-pmThicknessP);
83 pmWidth3D=pm3D.
Width();
85 m_gmt_mgr->
msg(MSG::INFO) <<
"Module thicknesses : SiPl P/N "<<pmThicknessP<<
" "<<pmThicknessN<<
" "<<pmWidth<<
86 " SiPl P/N "<<pmThicknessP3D<<
" "<<pmThicknessN3D<<
" "<<pmWidth3D<<
91 pmShilftLateral3D= -(MechanicalStaveOffset3D-MechanicalStaveOffset);
93 radialShiftThickN=fabs(radialShift)+(pmThicknessN3D-pmThicknessN)*.5;
97 int ModuleNumber_allPlanar=ModuleNumber;
99 double ModuleLength=pm.
Length();
102 int Module3DNumber= 0;
103 double Module3DLength=0;
111 if(staveLayout==5||staveLayout==6||staveLayout==7)
114 bool isModule3D=
true;
117 Module3DLength=pm3D.
Length();
119 if(staveLayout==5||staveLayout==7)
121 Module3DNumber=(ModuleNumber/4)*2;
122 ModuleNumber=ModuleNumber*0.75;
124 else if(staveLayout==6)
126 ModuleNumber=ModuleNumber/2;
127 Module3DNumber=ModuleNumber*2;
142 double lgEndBlock=2.0*MechanicalStaveEndBlockLength;
145 double compStaveLength=lgPlanar+lg3D+lgEndBlock;
146 double lgNAStave=(totalStaveLength-compStaveLength)*0.5;
154 m_gmt_mgr->
msg(MSG::INFO) <<
" planar/3D/endblock/NonActive lengths : "<<lgPlanar<<
" "<<lg3D<<
" "<<lgEndBlock<<
" "<<lgNAStave<<
endmsg;
170 if(FacePlateGreaseThick>0.001) FacePlateThick+=FacePlateGreaseThick;
192 bool bFlexConstantThickness =
true;
193 if(!bFlexAndWing) bFlexConstantThickness =
false;
203 double MaxFlexThickness;
204 if (!bFlexConstantThickness){
205 if(ModuleNumber_allPlanar%2==0)
206 MaxFlexThickness=FlexBaseThick+(ModuleNumber_allPlanar/2-1)*FlexLayerThick;
208 MaxFlexThickness=FlexBaseThick+((ModuleNumber_allPlanar-1)/2)*FlexLayerThick;
211 MaxFlexThickness=FlexBaseThick;
213 m_gmt_mgr->
msg(MSG::INFO) <<
"Flex thickness (max) : "<<MaxFlexThickness<<
" computed for "<<ModuleNumber_allPlanar<<
" modules "<<
endmsg;
215 double halfMecStaveWidth=MechanicalStaveWidth*0.5;
229 FlexWidth = sqrt(xDelta*xDelta+yDelta*yDelta);
233 m_gmt_mgr->
msg(MSG::INFO)<<
" MechanicalStaveLength = "<<MechanicalStaveLength <<
endmsg;
234 m_gmt_mgr->
msg(MSG::INFO)<<
" MechanicalStaveOffset = "<<MechanicalStaveOffset <<
endmsg;
236 m_gmt_mgr->
msg(MSG::INFO)<<
" MechanicalStaveEndBlockLength = "<<MechanicalStaveEndBlockLength <<
endmsg;
248 double MiddleSectionLength=MechanicalStaveLength-2.0*MechanicalStaveEndBlockLength;
269 foam1x += xGblOffset;
270 foam2x += xGblOffset;
271 foam3x += xGblOffset;
272 foam4x += xGblOffset;
273 foam5x += xGblOffset;
275 double FoamBaseWidth=sqrt((foam5x-foam1x)*(foam5x-foam1x)+(foam5y-foam1y)*(foam5y-foam1y));
284 double omega1x, omega1y, omega2x, omega2y, omega3x, omega3y;
285 double omega4x, omega4y, omega5x, omega5y;
286 omega1x=omega1y=omega2x=omega2y=omega3x=omega3y=omega4x=omega4y=omega5x=omega5y=0.0;
288 omega1x = 0.0; omega1y = -halfMecStaveWidth;
292 omega5x = 0.0; omega5y = halfMecStaveWidth;
294 omega1x += xGblOffset;
295 omega2x += xGblOffset;
296 omega3x += xGblOffset;
297 omega4x += xGblOffset;
298 omega5x += xGblOffset;
307 double plate1x =0.0, plate1y= foam1y;
308 double plate2x =FacePlateThick, plate2y= foam1y;
309 double plate3x =FacePlateThick, plate3y= foam5y;
310 double plate4x =0.0, plate4y= foam5y;
312 plate1y=omega1y; plate4y=omega5y;
321 double seg1x, seg2x, seg1y, seg2y;
322 seg1x=omega3x; seg1y=omega3y;
323 seg2x=omega4x; seg2y=omega4y;
325 double vDirX=(seg2x-seg1x), vDirY=(seg2y-seg1y);
326 double invNorm=1.0/sqrt(vDirX*vDirX+vDirY*vDirY);
327 vDirX*=invNorm; vDirY*=invNorm;
328 double vPerpDirX=vDirY, vPerpDirY=-vDirX;
333 double flexHalfWidth=FlexWidth*0.5;
334 double wingHalfWidth = WingWidth*.5;
336 double flexWingMaxR=0.;
337 double maxFlex1x = foamMidX-(FlexOffset+flexHalfWidth)*vDirX;
338 double maxFlex1y = foamMidY-(FlexOffset+flexHalfWidth)*vDirY;
339 double maxFlex2x = maxFlex1x+MaxFlexThickness*vPerpDirX;
340 double maxFlex2y = maxFlex1y+MaxFlexThickness*vPerpDirY;
341 double maxFlex4x = foamMidX+(-FlexOffset+flexHalfWidth)*vDirX;
342 double maxFlex4y = foamMidY+(-FlexOffset+flexHalfWidth)*vDirY;
345 double maxFlex4x_wings = foamMidX+(-FlexOffset+flexHalfWidth+2.*wingHalfWidth+.5)*vDirX;
346 double maxFlex4y_wings = foamMidY+(-FlexOffset+flexHalfWidth+2.*wingHalfWidth+.5)*vDirY;
347 double maxFlex3x_wings = maxFlex4x_wings+MaxFlexThickness*vPerpDirX;
348 double maxFlex3y_wings = maxFlex4y_wings+MaxFlexThickness*vPerpDirY;
351 wingHalfWidth = WingWidth*.5*.6;
352 maxFlex4x_wings = foamMidX+(-FlexOffset+flexHalfWidth+2.*wingHalfWidth+.5)*vDirX;
353 maxFlex4y_wings = foamMidY+(-FlexOffset+flexHalfWidth+2.*wingHalfWidth+.5)*vDirY;
354 maxFlex3x_wings = maxFlex4x_wings+MaxFlexThickness*vPerpDirX;
355 maxFlex3y_wings = maxFlex4y_wings+MaxFlexThickness*vPerpDirY;
367 std::vector<double> xShape, yShape;
368 std::vector<int>iShapeExcept;
371 double plate1y_tmp =
std::min(plate1y,-pm.
Width()*.5-yStaveOffset);
372 double omega1y_tmp =
std::min(omega1y,-pm.
Width()*.5-yStaveOffset);
374 xShape.push_back(plate1x); yShape.push_back(plate1y_tmp); iShapeExcept.push_back(1);
375 xShape.push_back(omega1x); yShape.push_back(omega1y_tmp); iShapeExcept.push_back(0);
376 xShape.push_back(omega2x); yShape.push_back(omega2y); iShapeExcept.push_back(0);
377 xShape.push_back(omega3x); yShape.push_back(omega3y); iShapeExcept.push_back(0);
379 xShape.push_back(maxFlex1x); yShape.push_back(maxFlex1y); iShapeExcept.push_back(0);
380 xShape.push_back(maxFlex2x); yShape.push_back(maxFlex2y); iShapeExcept.push_back(0);
382 xShape.push_back(maxFlex3x_wings); yShape.push_back(maxFlex3y_wings); iShapeExcept.push_back(0);
383 xShape.push_back(maxFlex4x_wings); yShape.push_back(maxFlex4y_wings); iShapeExcept.push_back(0);
386 xShape.push_back(maxFlex4x); yShape.push_back(maxFlex4y); iShapeExcept.push_back(1);
387 flexWingMaxR=sqrt((maxFlex3x_wings+layerRadius)*(maxFlex3x_wings+layerRadius)+maxFlex3y_wings*maxFlex3y_wings);
390 xShape.push_back(omega4x); yShape.push_back(omega4y); iShapeExcept.push_back(0);
391 xShape.push_back(omega5x); yShape.push_back(omega5y); iShapeExcept.push_back(0);
393 xShape.push_back(plate4x); yShape.push_back(plate4y); iShapeExcept.push_back(1);
401 for(
unsigned int iPt=0; iPt<xShape.size(); iPt++)
407 GeoPhysVol * logVolPV =
new GeoPhysVol(logVol);
415 GeoSimplePolygonBrep * foam_shape =
new GeoSimplePolygonBrep(MiddleSectionLength*.5);
416 foam_shape->addVertex(foam1x,foam1y);
417 foam_shape->addVertex(foam2x,foam2y);
418 foam_shape->addVertex(foam3x,foam3y);
419 foam_shape->addVertex(foam4x,foam4y);
420 foam_shape->addVertex(foam5x,foam5y);
423 GeoNameTag* foam_tag =
new GeoNameTag(
"CarbonFoam");
424 GeoTransform* foam_xform =
new GeoTransform(GeoTrf::Transform3D::Identity());
426 GeoLogVol * foam_logVol =
new GeoLogVol(
"CarbonFoam",foam_shape,foam_material);
427 GeoPhysVol * foam_logVolPV =
new GeoPhysVol(foam_logVol);
435 GeoSimplePolygonBrep * omega_shape =
new GeoSimplePolygonBrep(MiddleSectionLength*.5);
436 omega_shape->addVertex(omega1x,omega1y);
437 omega_shape->addVertex(omega2x,omega2y);
438 omega_shape->addVertex(omega3x,omega3y);
439 omega_shape->addVertex(omega4x,omega4y);
440 omega_shape->addVertex(omega5x,omega5y);
441 omega_shape->addVertex(foam5x,foam5y);
442 omega_shape->addVertex(foam4x,foam4y);
443 omega_shape->addVertex(foam3x,foam3y);
444 omega_shape->addVertex(foam2x,foam2y);
445 omega_shape->addVertex(foam1x,foam1y);
447 GeoLogVol * omega_logVol =
nullptr;
449 if(OmegaGlueThick<0.0001)
454 omega_logVol =
new GeoLogVol(
"Omega",omega_shape,omega_material);
459 double omegaVolume = omega_shape->volume();
460 double glueVolume = omegaVolume*(OmegaGlueThick/OmegaThick);
461 const std::string compMatName=
"OmegaGlue_IBL";
464 omegaVolume,
"pix::Omega_IBL",
465 glueVolume,
"pix::Stycast2850FT");
467 omega_logVol =
new GeoLogVol(
"Omega",omega_shape,omega_material);
470 GeoNameTag* omega_tag =
new GeoNameTag(
"Omega");
471 GeoTransform* omega_xform =
new GeoTransform(GeoTrf::Transform3D::Identity());
478 GeoPhysVol * omega_logVolPV =
new GeoPhysVol(omega_logVol);
479 logVolPV->add(omega_tag);
480 logVolPV->add(omega_xform);
481 logVolPV->add(omega_logVolPV);
490 GeoBox * faceplate_shape =
new GeoBox(FacePlateThick*0.5,MechanicalStaveWidth*0.5,MiddleSectionLength*.5);
491 GeoTrf::Translate3D faceplate_pos((plate1x+plate2x+plate3x+plate4x)*0.25,(plate1y+plate2y+plate3y+plate4y)*0.25,0.0);
492 GeoTransform* faceplate_xform =
new GeoTransform(faceplate_pos);
494 std::string faceplateMatName;
495 const GeoMaterial* faceplate_material;
498 if(FacePlateGlueThick<0.0001)
500 m_gmt_mgr->
msg(MSG::INFO)<<
"** FacePlate : without Stycast "<<FacePlateGlueThick<<
endmsg;
501 faceplateMatName =
"pix::FacePlate_IBL";
506 m_gmt_mgr->
msg(MSG::INFO)<<
" ** FacePlate : with Stycast "<<FacePlateGlueThick<<
" grease : "<<FacePlateGreaseThick<<
endmsg;
508 double glueVolume = FacePlateGlueThick*MechanicalStaveWidth*MiddleSectionLength;
509 double facePlateVolume = (FacePlateThick-FacePlateGreaseThick)*MechanicalStaveWidth*MiddleSectionLength;
511 faceplateMatName=
"FacePlateGlue_IBL";
514 facePlateVolume,
"pix::FacePlate_IBL",
515 glueVolume,
"pix::Stycast2850FT");
520 GeoLogVol * faceplate_logVol =
nullptr;
521 if(FacePlateGreaseThick<0.0001)
525 faceplate_logVol =
new GeoLogVol(
"FacePlate",faceplate_shape,faceplate_material);
531 double greaseVolume = FacePlateGreaseThick*MechanicalStaveWidth*MiddleSectionLength;
532 double facePlateVolume = (FacePlateThick-FacePlateGreaseThick)*MechanicalStaveWidth*MiddleSectionLength;
534 std::string compMatName=
"FacePlateGrease_IBL";
535 if(FacePlateGlueThick>0.0001) compMatName=
"FacePlateGlueGrease_IBL";
537 facePlateVolume+greaseVolume,
538 facePlateVolume,faceplateMatName,
539 greaseVolume,
"pix::ThermGrease_IBL");
540 faceplate_logVol =
new GeoLogVol(
"FacePlate",faceplate_shape,faceplate_material);
546 GeoPhysVol * faceplate_logVolPV =
new GeoPhysVol(faceplate_logVol);
547 GeoNameTag* faceplate_tag =
new GeoNameTag(
"FacePlate");
548 logVolPV->add(faceplate_tag);
549 logVolPV->add(faceplate_xform);
550 logVolPV->add(faceplate_logVolPV);
561 double ModuleLength_flex=pm.
Length();
563 double ModuleTotLength=ModuleLength_flex+ModuleGap_flex;
564 double ModulePosZ=ModuleTotLength*0.5;
565 int NbModuleRL=ModuleNumber_flex/2;
566 if(ModuleNumber_flex%2==1)
571 double FlexThicknessRL=FlexBaseThick;
572 double flex_angle=((maxFlex1x-maxFlex4x)*(foam1x-foam5x)+(maxFlex1y-maxFlex4y)*(foam1y-foam5y))/(FlexWidth*FoamBaseWidth);
573 flex_angle=acos(flex_angle);
577 m_gmt_mgr->
msg(MSG::INFO)<<
"Flex angle : "<<flex_angle<<
" Flex pos. in Z : ";
578 double EndblockFlexXpos=0.;
579 double EndblockFlexYpos=0.;
580 double EndblockFlexThickness=0.;
582 double wingZmin=0., wingZmax=0.;
584 GeoLogVol * wingflex_logVol =
nullptr;
585 double wingFlexPosX = 0.;
586 double wingFlexPosY = 0.;
588 for(
int iModule=0; iModule<NbModuleRL; iModule++)
594 if(iModule==NbModuleRL-1)
596 wingZmax=ModulePosZ+ModuleTotLength*0.5;
597 double delta=MiddleSectionLength*0.5-(ModulePosZ+ModuleTotLength*0.5);
598 ModulePosZ+=delta*0.5;
599 ModuleTotLength+=delta;
604 flexGapZ = FlexStaveMiddleGap;
609 GeoBox * cableflex_shape =
new GeoBox(FlexThicknessRL*0.5,FlexWidth*0.5,(ModuleTotLength-
m_SafetyMargin-flexGapZ)*.5);
611 double flex1x = foamMidX-(FlexOffset+flexHalfWidth)*vDirX;
612 double flex1y = foamMidY-(FlexOffset+flexHalfWidth)*vDirY;
613 double flex2x = flex1x+FlexThicknessRL*vPerpDirX;
614 double flex2y = flex1y+FlexThicknessRL*vPerpDirY;
615 double flex4x = foamMidX+(-FlexOffset+flexHalfWidth)*vDirX;
616 double flex4y = foamMidY+(-FlexOffset+flexHalfWidth)*vDirY;
617 double flex3x = flex4x+FlexThicknessRL*vPerpDirX;
618 double flex3y = flex4y+FlexThicknessRL*vPerpDirY;
621 std::ostringstream lname;
622 int iFlexModule=(ModuleNumber_flex%2==0)?(iModule+1):iModule;
623 lname <<
"StaveFlex_"<<iFlexModule;
624 if(!(ModuleNumber_flex%2==1&&iModule==0))lname<<
"A";
627 const GeoMaterial* scaledFlexMaterial=
nullptr;
641 GeoTrf::Translation3D cableflex_pos((flex1x+flex2x+flex3x+flex4x)*0.25,(flex1y+flex2y+flex3y+flex4y)*0.25,ModulePosZ+flexGapZ*0.5);
643 GeoTransform* cableflex_xform =
new GeoTransform(
GeoTrf::Transform3D(cableflex_pos*GeoTrf::RotateZ3D(fabs(flex_angle))));
645 GeoLogVol * cableflex_logVol =
nullptr;
646 if(bFlexAndWing||bFlexConstantThickness)
647 cableflex_logVol=
new GeoLogVol(lname.str(),cableflex_shape,scaledFlexMaterial);
649 cableflex_logVol=
new GeoLogVol(lname.str(),cableflex_shape,cableflex_material);
654 std::ostringstream wingName;
655 wingName <<
"WingFlex";
660 double flex1x_tmp = flex4x;
661 double flex1y_tmp = flex4y;
662 double flex2x_tmp = flex4x+2.*wingHalfWidth*vDirX;
663 double flex2y_tmp = flex4y+2.*wingHalfWidth*vDirY;
664 double flex4x_tmp = flex1x_tmp+WingThick*vPerpDirX;
665 double flex4y_tmp = flex1y_tmp+WingThick*vPerpDirY;
666 double flex3x_tmp = flex2x_tmp+WingThick*vPerpDirX;
667 double flex3y_tmp = flex2y_tmp+WingThick*vPerpDirY;
669 maxFlex3x_wings = flex3x_tmp;
670 maxFlex3y_wings = flex3y_tmp;
671 maxFlex4x_wings = flex4x_tmp;
672 maxFlex4y_wings = flex4y_tmp;
673 wingFlexPosX = (flex1x_tmp+flex2x_tmp+flex3x_tmp+flex4x_tmp)*0.25;
674 wingFlexPosY = (flex1y_tmp+flex2y_tmp+flex3y_tmp+flex4y_tmp)*0.25;
676 double wingHalfLength = 12.15*.5;
677 GeoBox* wingflex_shape =
new GeoBox(WingThick*0.5,wingHalfWidth,wingHalfLength);
681 wingflex_logVol =
new GeoLogVol(wingName.str(),wingflex_shape,wingflex_material);
687 double zPos = (iModule+.5)*ModuleLength_flex+(iModule+.5)*ModuleGap_flex;
689 GeoTransform* wingflex_xformA =
new GeoTransform(
GeoTrf::Transform3D(wingflex_posA*GeoTrf::RotateZ3D(fabs(flex_angle))));
691 GeoPhysVol * wingflex_logVolPV_1 =
new GeoPhysVol(wingflex_logVol);
692 GeoNameTag* wingflex_tag =
new GeoNameTag(wingName.str());
693 logVolPV->add(wingflex_tag);
694 logVolPV->add(wingflex_xformA);
695 logVolPV->add(wingflex_logVolPV_1);
698 GeoTransform* wingflex_xformA_2 =
new GeoTransform(
GeoTrf::Transform3D(wingflex_posA_2*GeoTrf::RotateZ3D(fabs(flex_angle))));
700 GeoPhysVol * wingflex_logVolPV_2 =
new GeoPhysVol(wingflex_logVol);
701 logVolPV->add(wingflex_tag);
702 logVolPV->add(wingflex_xformA_2);
703 logVolPV->add(wingflex_logVolPV_2);
708 GeoTransform* wingflex_xformC =
new GeoTransform(
GeoTrf::Transform3D(wingflex_posC*GeoTrf::RotateZ3D(fabs(flex_angle))));
710 GeoPhysVol * wingflex_logVolPV_C1 =
new GeoPhysVol(wingflex_logVol);
711 logVolPV->add(wingflex_tag);
712 logVolPV->add(wingflex_xformC);
713 logVolPV->add(wingflex_logVolPV_C1);
716 GeoTransform* wingflex_xformC_2 =
new GeoTransform(
GeoTrf::Transform3D(wingflex_posC_2*GeoTrf::RotateZ3D(fabs(flex_angle))));
718 GeoPhysVol * wingflex_logVolPV_C2 =
new GeoPhysVol(wingflex_logVol);
719 logVolPV->add(wingflex_tag);
720 logVolPV->add(wingflex_xformC_2);
721 logVolPV->add(wingflex_logVolPV_C2);
725 GeoPhysVol * cableflex_logVolPV =
new GeoPhysVol(cableflex_logVol);
726 GeoNameTag* cableflex_tag =
new GeoNameTag(lname.str());
727 logVolPV->add(cableflex_tag);
728 logVolPV->add(cableflex_xform);
729 logVolPV->add(cableflex_logVolPV);
732 <<
"(" << cableflex_pos.x() <<
"," << cableflex_pos.y() <<
"," << cableflex_pos.z() <<
")"
733 <<
" " << FlexThicknessRL<<
" / ";
736 if((ModuleNumber_flex%2==1&&iModule>0)||ModuleNumber_flex%2==0)
738 std::ostringstream lname;
739 lname <<
"StaveFlex_"<<iFlexModule<<
"C";
741 GeoTrf::Translation3D cableflex_pos2((flex1x+flex2x+flex3x+flex4x)*0.25,(flex1y+flex2y+flex3y+flex4y)*0.25,-ModulePosZ-flexGapZ*0.5);
742 GeoTransform* cableflex_xform2 =
new GeoTransform(
GeoTrf::Transform3D(cableflex_pos2*GeoTrf::RotateZ3D(fabs(flex_angle))));
743 GeoLogVol * cableflex_logVol =
nullptr;
745 const GeoMaterial* scaledFlexMaterial=
nullptr;
758 if(bFlexAndWing||bFlexConstantThickness)
759 cableflex_logVol=
new GeoLogVol(lname.str(),cableflex_shape,scaledFlexMaterial);
761 cableflex_logVol=
new GeoLogVol(lname.str(),cableflex_shape,cableflex_material);
762 GeoPhysVol * cableflex_logVolPV =
new GeoPhysVol(cableflex_logVol);
763 GeoNameTag* cableflex_tag =
new GeoNameTag(lname.str());
764 logVolPV->add(cableflex_tag);
765 logVolPV->add(cableflex_xform2);
766 logVolPV->add(cableflex_logVolPV);
770 if(iModule==NbModuleRL-1)
772 EndblockFlexXpos=(flex1x+flex2x+flex3x+flex4x)*0.25;
773 EndblockFlexYpos=(flex1y+flex2y+flex3y+flex4y)*0.25;
774 EndblockFlexThickness=FlexThicknessRL;
777 ModulePosZ+=ModuleTotLength;
778 if(!bFlexConstantThickness)
779 FlexThicknessRL+=FlexLayerThick;
790 if(bFlexAndWing&&nbModuleSvc==0)
795 double flex1x = foamMidX+(wingPos+wingHalfWidth)*vDirX;
796 double flex1y = foamMidY+(wingPos+wingHalfWidth)*vDirY;
797 double flex2x = flex1x+WingThick*vPerpDirX;
798 double flex2y = flex1y+WingThick*vPerpDirY;
799 double flex4x = foamMidX+(wingPos)*vDirX;
800 double flex4y = foamMidY+(wingPos)*vDirY;
801 double flex3x = flex4x+WingThick*vPerpDirX;
802 double flex3y = flex4y+WingThick*vPerpDirY;
804 GeoBox* wingflex_shape =
new GeoBox(WingThick*0.5,wingHalfWidth-
m_SafetyMargin,(wingZmax-wingZmin)*.5);
807 std::ostringstream wingName;
808 wingName <<
"WingFlex";
811 GeoTrf::Vector3D wingflex_posA((flex1x+flex2x+flex3x+flex4x)*0.25,(flex1y+flex2y+flex3y+flex4y)*0.25,(wingZmax-wingZmin)*.5+FlexStaveMiddleGap);
812 GeoTransform* wingflex_xformA =
new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0.0,0.0,std::abs(flex_angle)),wingflex_posA));
815 GeoLogVol * wingflex_logVol =
new GeoLogVol(wingName.str(),wingflex_shape,wingflex_material);
817 GeoPhysVol * wingflex_logVolPV =
new GeoPhysVol(wingflex_logVol);
818 GeoNameTag* wingflex_tag =
new GeoNameTag(wingName.str());
819 logVolPV->add(wingflex_tag);
820 logVolPV->add(wingflex_xformA);
821 logVolPV->add(wingflex_logVolPV);
823 GeoTrf::Vector3D wingflex_posC((flex1x+flex2x+flex3x+flex4x)*0.25,(flex1y+flex2y+flex3y+flex4y)*0.25,-((wingZmax-wingZmin)*.5+FlexStaveMiddleGap));
824 GeoTransform* wingflex_xformC =
new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0.0,0.0,std::abs(flex_angle)),wingflex_posC));
825 logVolPV->add(wingflex_tag);
826 logVolPV->add(wingflex_xformC);
827 logVolPV->add(wingflex_logVolPV);
835 const GeoTube* coolingPipe =
new GeoTube(0.0,TubeOuterDiam*0.5,MiddleSectionLength*0.5);
836 const GeoTube* coolingPipeInner =
new GeoTube(0.0,TubeInnerDiam*0.5,MiddleSectionLength*0.5);
838 GeoLogVol * cp_logVol =
nullptr;
840 if(TubeGlueThick<0.0001)
844 cp_logVol =
new GeoLogVol(
"CoolingPipe",coolingPipe,cp_material);
848 m_gmt_mgr->
msg(MSG::INFO)<<
"** TUBE : with Stycast "<<TubeGlueThick<<
" diam "<<TubeOuterDiam*0.5<<
" "<<TubeInnerDiam*0.5<<
endmsg;
849 double glueVolume = (TubeOuterDiam*0.5+TubeGlueThick)*(TubeOuterDiam*0.5+TubeGlueThick)*
M_PI*MiddleSectionLength;
850 double tubeOuterVolume = TubeOuterDiam*TubeOuterDiam*0.25*
M_PI*MiddleSectionLength;
851 double tubeInnerVolume = TubeInnerDiam*TubeInnerDiam*0.25*
M_PI*MiddleSectionLength;
853 const std::string compMatName=
"CoolingPipeGlue_IBL";
855 tubeOuterVolume-tubeInnerVolume,
856 tubeOuterVolume-tubeInnerVolume,
"pix::CoolingPipe_IBL",
857 glueVolume-tubeOuterVolume,
"pix::Stycast2850FT");
859 cp_logVol =
new GeoLogVol(
"CoolingPipe",coolingPipe,cp_material);
862 GeoPhysVol * cp_logPV =
new GeoPhysVol(cp_logVol);
868 GeoNameTag* cp_tag =
new GeoNameTag(
"CoolingPipe");
869 GeoTrf::Translate3D cp_pos(xGblOffset+TubeMiddlePos,0.0,0.0);
870 GeoTransform* cp_xform =
new GeoTransform(cp_pos);
871 foam_logVolPV->add(cp_tag);
872 foam_logVolPV->add(cp_xform);
873 foam_logVolPV->add(cp_logPV);
877 GeoLogVol * cp_inner_log =
new GeoLogVol(
"CoolingPipeInner",coolingPipeInner,cp_inner_material);
878 GeoPhysVol * cp_inner_logPV =
new GeoPhysVol(cp_inner_log);
880 GeoNameTag* cp_inner_tag =
new GeoNameTag(
"CoolingPipeInner");
881 GeoTransform* cp_inner_xform =
new GeoTransform(GeoTrf::Transform3D::Identity());
882 cp_logPV->add(cp_inner_tag);
883 cp_logPV->add(cp_inner_xform);
884 cp_logPV->add(cp_inner_logPV);
886 logVolPV->add(foam_tag);
887 logVolPV->add(foam_xform);
888 logVolPV->add(foam_logVolPV);
910 double doglegFlexLength=FlexDogLeg_length;
921 GeoSimplePolygonBrep * endblock_shape =
new GeoSimplePolygonBrep(
m_endblockLength*.5+safetyMarginZ);
922 endblock_shape->addVertex(plate1x,plate1y);
923 endblock_shape->addVertex(omega1x,omega1y);
924 endblock_shape->addVertex(omega2x,omega2y);
925 endblock_shape->addVertex(omega3x,omega3y);
926 endblock_shape->addVertex(omega4x,omega4y);
927 endblock_shape->addVertex(omega5x,omega5y);
928 endblock_shape->addVertex(plate4x,plate4y);
931 GeoLogVol * endblock_logVol =
nullptr;
932 GeoLogVol * endblockA_logVol =
nullptr;
933 GeoLogVol * endblockC_logVol =
nullptr;
934 if(endblock_material_weight){
936 double omegaStaveVolume = omega_shape->volume();
937 double omegaVolume = omegaStaveVolume*endblockOmegaOverlap/omegaStaveVolume;
938 double endblockVolume = endblock_shape->volume();
940 const std::string compMatNameA=
"EndblockOgA_IBL";
942 endblockVolume+omegaVolume,
943 omegaVolume,
"pix::Omega_IBL",
944 endblockVolume,
"pix::EndblockA_IBLwght");
946 endblockA_logVol =
new GeoLogVol(
"EndBlock",endblock_shape,endblockA_omega_material);
949 const std::string compMatNameC=
"EndblockOgC_IBL";
951 endblockVolume+omegaVolume,
952 omegaVolume,
"pix::Omega_IBL",
953 endblockVolume,
"pix::EndblockC_IBLwght");
954 endblockC_logVol =
new GeoLogVol(
"EndBlock",endblock_shape,endblockC_omega_material);
960 endblock_logVol =
new GeoLogVol(
"EndBlock",endblock_shape,endblock_material);
973 const GeoTube* endblock_coolingPipe =
new GeoTube(0.0,TubeOuterDiam*0.5,
m_endblockLength*.5);
976 GeoLogVol * cp_endblock_log =
new GeoLogVol(
"EndBlockCoolingPipe",endblock_coolingPipe,cp_endblock_material);
977 GeoPhysVol * cp_endblock_logPV =
new GeoPhysVol(cp_endblock_log);
979 GeoNameTag* cp_endblock_tag =
new GeoNameTag(
"EndBlockCoolingPipe");
980 GeoTrf::Translate3D cp_endblock_pos(xGblOffset+TubeMiddlePos,0.0,0.0);
981 GeoTransform* cp_endblock_xform =
new GeoTransform(cp_endblock_pos);
991 const GeoTube* endblock_coolingPipeInner =
new GeoTube(0.0,TubeInnerDiam*0.5,
m_endblockLength*.5);
993 GeoLogVol * cp_endblock_inner_log =
new GeoLogVol(
"EndBlockCoolingPipeInner",endblock_coolingPipeInner,cp_endblock_inner_material);
994 GeoPhysVol * cp_endblock_inner_logPV =
new GeoPhysVol(cp_endblock_inner_log);
996 GeoNameTag* cp_endblock_inner_tag =
new GeoNameTag(
"EndBlockCoolingPipeInner");
997 GeoTransform* cp_endblock_inner_xform =
new GeoTransform(GeoTrf::Transform3D::Identity());
998 cp_endblock_logPV->add(cp_endblock_inner_tag);
999 cp_endblock_logPV->add(cp_endblock_inner_xform);
1000 cp_endblock_logPV->add(cp_endblock_inner_logPV);
1005 m_gmt_mgr->
msg(MSG::INFO)<<
"IBL EOS : mechanical stave length : "<<MechanicalStaveLength*0.5<<
endmsg;
1018 const GeoMaterial* scaledFlexMaterial=
nullptr;
1035 std::ostringstream lname;
1036 lname <<
"SrvEndblockFlex";
1041 m_endblockFlexTrf =
new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0.0,0.0, std::abs(flex_angle)),cableflex_pos));
1042 GeoLogVol * cableflex_logVol =
new GeoLogVol(lname.str(),cableflex_shape,scaledFlexMaterial);
1045 m_gmt_mgr->
msg(MSG::INFO)<<
"Flex half thickness srv : "<<EndblockFlexThickness<<
endmsg;
1056 const GeoTube* service_coolingPipe =
new GeoTube(0.0,TubeOuterDiam*0.5,
m_endblockSrvLength*.5+doglegFlexLength*.5-2*safetyMarginZ);
1059 GeoLogVol * cp_service_log =
new GeoLogVol(
"SrvCoolingPipe",service_coolingPipe,cp_service_material);
1072 const GeoTube* service_coolingPipeInner =
new GeoTube(0.0,TubeInnerDiam*0.5,
m_endblockSrvLength*.5+doglegFlexLength*.5-2*safetyMarginZ);
1074 GeoLogVol * cp_service_inner_log =
new GeoLogVol(
"SrvCoolingPipeInner",service_coolingPipeInner,cp_service_inner_material);
1075 GeoPhysVol * cp_service_inner_logPV =
new GeoPhysVol(cp_service_inner_log);
1077 GeoNameTag* cp_service_inner_tag =
new GeoNameTag(
"SrvCoolingPipeInner");
1078 GeoTransform* cp_service_inner_xform =
new GeoTransform(GeoTrf::Transform3D::Identity());
1096 pmThicknessN3D,pmThicknessP3D,pmShilftLateral3D);
1119 double moduleThickN3D,
double ,
double pmShilftLateral3D)
1131 if(FacePlateGreaseThick>0.001) FacePlateThick+=FacePlateGreaseThick;
1133 double stave_xOffset=StaveModuleOffset+moduleThickP, stave_yOffset=MechanicalStaveOffset;
1136 m_transform = GeoTrf::Translate3D(stave_xOffset,stave_yOffset,0);
1140 m_thicknessN = (moduleThickN3D>moduleThickN)?moduleThickN3D:moduleThickN;
1149 std::vector<double> xVertices, yVertices;
1150 for(
int iPt=0; iPt<nbVertices; iPt++)
1157 double moduleThicknessN=
max(moduleThickN,moduleThickN3D);
1158 double moduleThicknessP=moduleThickP;
1162 double module1x =-moduleThicknessN, module1y= -moduleWidth*0.5;
1163 double module2x =moduleThicknessP, module2y= -moduleWidth*0.5;
1164 double module3x =moduleThicknessP, module3y= moduleWidth*0.5;
1165 double module4x =-moduleThicknessN, module4y= moduleWidth*0.5;
1168 if(pmShilftLateral3D<0){
1169 module1y+=pmShilftLateral3D;
1170 module2y+=pmShilftLateral3D;
1173 module3y+=pmShilftLateral3D;
1174 module4y+=pmShilftLateral3D;
1186 if (fabs(sqrt((xVertices[0]-module2x)*(xVertices[0]-module2x)+(yVertices[0]-module2y)*(yVertices[0]-module2y)))>0.01)
1188 for(
int iPt=0; iPt<nbVertices; iPt++)
1190 if (fabs(sqrt((xVertices[nbVertices-1]-module3x)*(xVertices[nbVertices-1]-module3x)+(yVertices[nbVertices-1]-module3y)*(yVertices[nbVertices-1]-module3y)))>0.01)
1195 for(
int iPt=0; iPt<nbVertices; iPt++)
1196 if(iPt==0||iPt==nbVertices-1)
1210 else if(iObject==-2){
1238 if(safetyMargin<0 || m_staveEnvelopShape==nullptr || m_staveEnvelopShape->getNVertices()<=0)
1244 std::vector<double> xVertices, yVertices;
1245 for(
int iPt=0; iPt<nbVertices; iPt++)
1262 GeoSimplePolygonBrep* convexStaveEnvelopShape =
new GeoSimplePolygonBrep(shapeDZ);
1265 for(
unsigned int iPt=0; iPt<xVertices.size(); iPt++)
1267 convexStaveEnvelopShape->addVertex(xVertices[iPt],yVertices[iPt]);
1271 for(
unsigned int iPt=1; iPt<xVertices.size()-1; iPt++)
1273 convexStaveEnvelopShape->addVertex(xVertices[iPt],yVertices[iPt]);
1279 unsigned int iPoint = xVertices.size()-1;
1283 double xDir = xVertices[0]-xVertices[iPoint];
1284 double yDir = yVertices[0]-yVertices[iPoint];
1285 double tmp = 1./sqrt(xDir*xDir+yDir*yDir);
1290 convexStaveEnvelopShape->addVertex(xMid, yMid);
1297 convexStaveEnvelopShape->addVertex(xMid-delta*
m_thicknessN_svc*.5, yVertices[0]);
1302 return convexStaveEnvelopShape;
1310 bool bRemovedPoint=
true;
1311 int iMaxWhileLoop=xPoint.size();
1315 while(bRemovedPoint&&iWhileLoop<iMaxWhileLoop)
1317 bRemovedPoint=
false;
1318 int nbPoint=xPoint.size();
1319 for(
int iPt=0; iPt<nbPoint&&!bRemovedPoint; iPt++)
1322 int i2=(iPt+1)%(nbPoint);
1324 double zDist=fabs(sqrt((xPoint[i1]-xPoint[i2])*(xPoint[i1]-xPoint[i2])+(yPoint[i1]-yPoint[i2])*(yPoint[i1]-yPoint[i2])));
1326 xPoint.erase(xPoint.begin()+i1);
1327 yPoint.erase(yPoint.begin()+i1);
1336 iMaxWhileLoop=xPoint.size();
1338 while(bRemovedPoint&&iWhileLoop<iMaxWhileLoop)
1340 bRemovedPoint=
false;
1341 int nbPoint=xPoint.size();
1342 for(
int iPt=0; iPt<nbPoint&&!bRemovedPoint; iPt++)
1344 int i1=(iPt-1);
if(i1<0)i1=nbPoint-1;
1346 int i2=(iPt+1)%(nbPoint);
1348 double zScalProd=(xPoint[i1]-xPoint[
i])*(xPoint[i2]-xPoint[
i])+(yPoint[i1]-yPoint[
i])*(yPoint[i2]-yPoint[
i]);
1349 double vNorm1=sqrt((xPoint[i1]-xPoint[
i])*(xPoint[i1]-xPoint[
i])+(yPoint[i1]-yPoint[
i])*(yPoint[i1]-yPoint[
i]));
1350 double vNorm2=sqrt((xPoint[i2]-xPoint[
i])*(xPoint[i2]-xPoint[
i])+(yPoint[i2]-yPoint[
i])*(yPoint[i2]-yPoint[
i]));
1351 if(fabs(zScalProd/(vNorm1*vNorm2))>1.0-0.0017)
1353 xPoint.erase(xPoint.begin()+
i);
1354 yPoint.erase(yPoint.begin()+
i);
1365 std::vector<int> iException)
1369 bool bEndPointReached=
false;
1370 int iMaxWhileLoop=xVertices.size();
1375 if(iException.empty()) iException.assign(xVertices.size(), 0);
1377 std::vector<int>iRemoved( xVertices.size(), 0);
1382 std::vector<double> xTmp, yTmp;
1383 std::vector<int> iTmp;
1384 while(!bEndPointReached&&iWhileLoop<iMaxWhileLoop)
1386 bool bRemovedPoint=
false;
1389 xTmp.clear(); yTmp.clear(); iTmp.clear();
1390 for(
int i=0;
i<(
int)xVertices.size();
i++)
1392 xTmp.push_back(xVertices[
i]);
1393 yTmp.push_back(yVertices[
i]);
1399 int nbTmp=xTmp.size();
1401 for(iPt=0; iPt<nbTmp&&!bRemovedPoint; iPt++)
1402 if(iException[iTmp[iPt]]==0)
1404 int i1=(iPt-1);
if(i1<0)i1=nbTmp-1;
1406 int i2=(iPt+1)%(nbTmp);
1408 double zProdVect=(xTmp[i1]-xTmp[
i])*(yTmp[i2]-yTmp[
i])-(xTmp[i2]-xTmp[
i])*(yTmp[i1]-yTmp[
i]);
1415 iRemoved[iTmp[iPt]]++;
1424 if(!bRemovedPoint)bEndPointReached=
true;
1428 xVertices = std::move(xTmp);
1429 yVertices = std::move(yTmp);
1440 int nbPoint=xPoint.size();
1441 std::vector<double> xEndPoint1,yEndPoint1,xEndPoint2,yEndPoint2;
1442 for(
int iPt=0; iPt<nbPoint; iPt++)
1444 int i1=(iPt-1);
if(i1<0) i1=nbPoint-1;
1448 double xPt1=xPoint[i1];
double yPt1=yPoint[i1];
1449 double xPt2=xPoint[i2];
double yPt2=yPoint[i2];
1450 double vDirX=(xPt2-xPt1), vDirY=(yPt2-yPt1);
1451 double invNorm=1.0/sqrt(vDirX*vDirX+vDirY*vDirY);
1452 vDirX*=invNorm; vDirY*=invNorm;
1453 double vPerpDirX=vDirY, vPerpDirY=-vDirX;
1456 double xNewPt1, yNewPt1, xNewPt2, yNewPt2;
1457 if(fabs(vDirX)<fabs(vDirY))
1459 double coeffDir=1.0;
if(vPerpDirX<0)coeffDir=-1.0;
1460 xNewPt1=xPt1+coeffDir*vMarginX;
1462 xNewPt2=xPt2+coeffDir*vMarginX;
1467 double coeffDir=1.0;
if(vPerpDirY<0)coeffDir=-1.0;
1469 yNewPt1=yPt1+coeffDir*vMarginY;
1471 yNewPt2=yPt2+coeffDir*vMarginY;
1474 xEndPoint1.push_back(xNewPt1); yEndPoint1.push_back(yNewPt1);
1475 xEndPoint2.push_back(xNewPt2); yEndPoint2.push_back(yNewPt2);
1481 std::vector<double> xInter, yInter;
1482 for(
int iPt=0; iPt<nbPoint; iPt++)
1485 int i2=(iPt+1)%nbPoint;
1487 double Ax=xEndPoint1[i1], Ay=yEndPoint1[i1];
1488 double Bx=xEndPoint2[i1], By=yEndPoint2[i1];
1490 double Cx=xEndPoint1[i2], Cy=yEndPoint1[i2];
1491 double Dx=xEndPoint2[i2], Dy=yEndPoint2[i2];
1493 double tmp=(Bx-Ax)*(Dy-Cy)-(By-Ay)*(Dx-Cx);
1494 double invTmp=1.0/
tmp;
1496 double r=((Ay-Cy)*(Dx-Cx)-(Ax-Cx)*(Dy-Cy))*invTmp;
1499 double xInter1=Ax+
r*(Bx-Ax);
1500 double yInter1=Ay+
r*(By-Ay);
1504 xInter.push_back(xInter1); yInter.push_back(yInter1);
1509 for(
int iPt=0; iPt<nbPoint; iPt++)
1511 xPoint[iPt]=xInter[iPt];
1512 yPoint[iPt]=yInter[iPt];
1542 double midCos=
cos(midStaveAngle);
1543 double midSin=
sin(midStaveAngle);
1549 double endStavePt1=sqrt(endStaveRadius*endStaveRadius-endStaveCenter.x()*endStaveCenter.x())+endStaveCenter.y();
1550 double endStavePt2=-sqrt(endStaveRadius*endStaveRadius-endStaveCenter.x()*endStaveCenter.x())+endStaveCenter.y();
1551 double endStavePt=endStavePt1;
1552 if(fabs(endStavePt2-omegaEndStavePointY)<fabs(endStavePt1-omegaEndStavePointY))endStavePt=endStavePt2;
1561 GeoTrf::Vector3D midSidePt(midStaveCenter.x()+midStaveRadius*midCos, midStaveCenter.y()+midStaveRadius*midSin, 0.0);
1563 m_gmt_mgr->
msg(
MSG::DEBUG)<<
"-> verif : "<<(midSidePt.x()-midStaveCenter.x())*(midSidePt.x()-midStaveCenter.x())+(midSidePt.y()-midStaveCenter.y())*(midSidePt.y()-midStaveCenter.y())-midStaveRadius*midStaveRadius<<
" ps : "<<(midSidePt.x()-midStaveCenter.x())*midSin+(midSidePt.y()-midStaveCenter.y())*midCos<<
endmsg;
1566 GeoTrf::Vector3D midSideDir(midSidePt.x()-midStaveCenter.x(),midSidePt.y()-midStaveCenter.y(),0.0);
1571 endSidePt=
GeoTrf::Vector3D(endStaveCenter.x()+endStaveRadius*midCos, endStaveCenter.y()+endStaveRadius*midSin, 0.0);
1573 m_gmt_mgr->
msg(
MSG::DEBUG)<<
"-> verif : "<<(endSidePt.x()-endStaveCenter.x())*(endSidePt.x()-endStaveCenter.x())+(endSidePt.y()-endStaveCenter.y())*(endSidePt.y()-endStaveCenter.y())-endStaveRadius*endStaveRadius<<
" ps : "<<(endSidePt.x()-endStaveCenter.x())*midSin-(endSidePt.y()-endStaveCenter.y())*midCos<<
endmsg;
1576 GeoTrf::Vector3D endSideDir(endSidePt.x()-endStaveCenter.x(),endSidePt.y()-endStaveCenter.y(),0.0);
1584 midStavePoint=
IntersectionPoint(midSidePt.x(),midSidePt.y(),endSidePt.x(),endSidePt.y(),
1585 midSidePt.x(),-midSidePt.y(),endSidePt.x(),-endSidePt.y());
1591 midStavePoint_omega=
IntersectionPoint(midSidePt_omega.x(),midSidePt_omega.y(),endSidePt_omega.x(),endSidePt_omega.y(),
1592 midSidePt_omega.x(),-midSidePt_omega.y(),endSidePt_omega.x(),-endSidePt_omega.y());
1601 GeoTrf::Vector3D endStaveDir(endStavePoint.x()-endStaveCenter.x(),endStavePoint.y()-endStaveCenter.y(),0.0);
1602 endStavePoint_omega=
NeighbourPoint_Rad(endStavePoint,std::move(endStaveDir),omegaThick);
1605 endSidePt_omega2=
IntersectionPoint(midSidePt_omega.x(),midSidePt_omega.y(),endSidePt_omega.x(),endSidePt_omega.y(),
1606 endStavePoint_omega.x(),endStavePoint_omega.y(),endStavePoint.x(),endStavePoint.y()+
m_OmegaEndStaveThick);
1613 endSidePt_inner=
NeighbourPoint_Perp(std::move(endSidePt_omega2),std::move(endSidePt_vec),omegaThick,-1);
1617 endSidePt_inter=
IntersectionPoint(midSidePt.x(),midSidePt.y(),endSidePt.x(),endSidePt.y(),
1618 endSidePt_inner.x(),endSidePt_inner.y(),endStavePoint.x(),endStavePoint.y());
1625 double angle1=
ComputeAngle(0.0,1.0,endSidePt.x()-midSidePt.x(),endSidePt.y()-midSidePt.y());
1633 midSidePoint=
IntersectionPoint(midSidePt_omega.x(),midSidePt_omega.y(),endSidePt_omega.x(),endSidePt_omega.y(),
1643 double tmp=(Bx-Ax)*(Dy-Cy)-(By-Ay)*(Dx-Cx);
1644 double invTmp=1.0/
tmp;
1646 double r=((Ay-Cy)*(Dx-Cx)-(Ax-Cx)*(Dy-Cy))*invTmp;
1656 double tmp=1.0/sqrt(
v.x()*
v.x()+
v.y()*
v.y());
1664 double xnew=
p.x()+delta*vNorm.x();
1665 double ynew=
p.y()+delta*vNorm.y();
1672 double xnew=
p.x()-iDir*delta*vNorm.y();
1673 double ynew=
p.y()+iDir*delta*vNorm.x();
1686 double pScal=uNorm.x()*vNorm.x()+uNorm.y()*vNorm.y();
1687 double angle=acos(pScal);
1694 return sqrt((
q.x()-
p.x())*(
q.x()-
p.x())+(
q.y()-
p.y())*(
q.y()-
p.y()));