// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // // Test for G4DisplacedSolid class // // 22.11.98 V.Grichine // 14.11.99 V.Grichine, modifications for CalculateExtent(...) method // #include #include #include "globals.hh" #include "geomdefs.hh" #include "ApproxEqual.hh" #include "G4ThreeVector.hh" #include "G4RotationMatrix.hh" #include "G4AffineTransform.hh" #include "G4Transform3D.hh" #include "G4VoxelLimits.hh" #include "G4Box.hh" #include "G4Cons.hh" #include "G4Para.hh" #include "G4Sphere.hh" #include "G4Torus.hh" #include "G4Trap.hh" #include "G4Trd.hh" #include "G4Tubs.hh" #include "G4IntersectionSolid.hh" #include "G4SubtractionSolid.hh" #include "G4UnionSolid.hh" #include "G4DisplacedSolid.hh" int main() { G4ThreeVector pzero(0,0,0), p; G4ThreeVector ponxside(20,0,0),ponyside(0,30,0),ponzside(0,0,40), ponb2x(10,0,0),ponb2y(0,10,0),ponb2z(0,0,10), ponb2mx(-10,0,0),ponb2my(0,-10,0),ponb2mz(0,0,-10); G4ThreeVector ponmxside(-20,0,0),ponmyside(0,-30,0),ponmzside(0,0,-40); G4ThreeVector ponzsidey(0,25,40),ponmzsidey(0,25,-40), ponb2zy(0,5,10),ponb2mzy(0,5,-10) ; G4ThreeVector pbigx(100,0,0),pbigy(0,100,0),pbigz(0,0,100); G4ThreeVector pbigmx(-100,0,0),pbigmy(0,-100,0),pbigmz(0,0,-100); G4ThreeVector vx(1,0,0),vy(0,1,0),vz(0,0,1); G4ThreeVector vmx(-1,0,0),vmy(0,-1,0),vmz(0,0,-1); G4ThreeVector vxy(1/std::sqrt(2.0),1/std::sqrt(2.0),0); G4ThreeVector vmxy(-1/std::sqrt(2.0),1/std::sqrt(2.0),0); G4ThreeVector vmxmy(-1/std::sqrt(2.0),-1/std::sqrt(2.0),0); G4ThreeVector vxmy(1/std::sqrt(2.0),-1/std::sqrt(2.0),0); G4ThreeVector vxmz(1/std::sqrt(2.0),0,-1/std::sqrt(2.0)); G4double dist; G4int i; G4ThreeVector *pNorm,norm; G4bool *pgoodNorm,goodNorm,calcNorm=true; pNorm=&norm; pgoodNorm=&goodNorm; G4RotationMatrix identity, xRot ; // NOTE: xRot = rotation such that x axis->y axis & y axis->-x axis xRot.rotateZ(-pi*0.5) ; G4Transform3D transform(xRot,pzero) ; G4Box b1("Test Box #1",20,30,40); G4Box b2("Test Box #2",10,10,10); G4Box b3("Test Box #3",10,50,10); G4Tubs t1("Solid Tube #1",0,50,50,0,360); G4Tubs t2("Hole Tube #2",45,50,50,0,360); G4Tubs t3("Solid cutted Tube #3",0,50,50,0,pi/2.0); G4Cons c1("Hollow Full Tube",50,100,50,100,50,0,2*pi), c2("Full Cone",0,50,0,100,50,0,2*pi) ; G4IntersectionSolid b1Ib2("b1Intersectionb2",&b1,&b2), t1Ib2("t1Intersectionb2",&t1,&b2), c2Ib2("c2Intersectionb2",&c2,&b2) ; // passRotT3 should be in 2 octant, while actiRotT3 in 4 one G4DisplacedSolid passRotT3("passRotT3",&t3,&xRot,ponb2mx) ; G4DisplacedSolid actiRotT3("actiRotT3",&t3,transform) ; G4DisplacedSolid actiRotB1("actiRotB3",&b1,transform) ; G4DisplacedSolid passRotB2("passRotT3",&b2,&xRot,ponb2mx) ; G4ThreeVector pRmaxPlus(50,1,0) ; dist = passRotT3.DistanceToIn(pRmaxPlus,vmx) ; G4cout<<"passRotT3.DistanceToIn(pRmaxPlus,vmx) = "<