// // ******************************************************************** // * 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. * // ******************************************************************** // ////////////////////////////////////////////////////////////////////////// // $Id: G4BREPSolidPConeTest.cc,v 1.16 2006/06/29 18:43:14 gunter Exp $ // GEANT4 tag $Name: geant4-09-04-ref-00 $ ////////////////////////////////////////////////////////////////////////// // // // BREP solid test, create by L. Broglia, 20/10/98 // modification of old G4Gerep test // #include "G4Timer.hh" #include #include "G4ios.hh" #include "G4BREPSolid.hh" #include "G4BREPSolidPCone.hh" #include #include void checkNormal( G4BREPSolid* solid, G4ThreeVector& position ) { G4ThreeVector normal = solid->SurfaceNormal( position ); G4cout << G4endl << "\t\tSurface normal" << G4endl << "\t\t--------------" << G4endl << "\t\tposition x=" << position.x() << " y=" << position.y() << " z=" << position.z() << G4endl << "\t\tis normX=" << normal.x() << " normY=" << normal.y() << " normZ=" << normal.z() << G4endl; } void checkSurfInOut( G4BREPSolid* solid, G4ThreeVector& position, G4ThreeVector& direction ) { G4double d; G4cout << G4endl << "\tTest of In & Out " << solid->GetName() << G4endl << "\t--------------------------------------" << G4endl; d = solid->DistanceToIn( position, direction ); G4cout << "\tDistance to in=" << d; d = solid->DistanceToIn( position ); G4cout << "\tClosest distance to in=" << d <DistanceToOut( position, direction ); G4cout << "\tDistance to out=" << d; d = solid->DistanceToOut( position ); G4cout << "\tClosest distance to out=" << d << G4endl; } void checkSolid( const G4String& where, G4BREPSolid* solid, G4ThreeVector& position, G4ThreeVector& direction, G4double estIn = 0.0, G4double estOut = 0.0 ) { G4double d; EInside in = solid->Inside( position ); G4cout << G4endl << where << " of " << solid->GetName() << G4endl << "--------------------------------" << G4endl << "estimation to in =" << estIn << G4endl << "estimation to out =" << estOut << G4endl << "direction x=" << direction.x() << " y=" << direction.y() << " z=" << direction.z() << G4endl << "position x=" << position.x() << " y=" << position.y() << " z=" << position.z(); if( in == kInside ) { G4cout <<" is inside"; d = solid->DistanceToOut( position, direction ); G4cout<<" distance to out="<DistanceToOut( position ); G4cout<<" closest distance to out="<DistanceToIn( position, direction ); G4cout<<" distance to in="<DistanceToIn( position ); G4cout<<" closest distance to in="<Inside(pt); G4cout << "\nx=" << pt.x() << " y=" << pt.y() << " z=" << pt.z(); if( in == kInside ) G4cout <<" is inside"; else if( in == kOutside ) G4cout <<" is outside"; else G4cout <<" is on the surface"; } G4cout<<"\n\n=================================================="; G4ThreeVector start( 0, 0, -30); G4ThreeVector dir(1, 1, 0); G4double d; G4cout<<"\nPdep is (0, 0, z)"; G4cout<<"\nDir is (1, 1, 0)\n"; G4double z; for(z=-30; z<=50; z+=5) { start.setZ(z); in = MyPCone->Inside(start); G4cout<< "x=" << start.x() << " y=" << start.y() << " z=" << start.z(); if( in == kInside ) { G4cout <<" is inside"; d = MyPCone->DistanceToOut(start, dir); G4cout<<" distance to out="<DistanceToOut(start); G4cout<<" closest distance to out="<DistanceToIn(start, dir); G4cout<<" distance to in="<DistanceToIn(start); G4cout<<" closest distance to in="<