G4PlacedSolid.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // ----------------------------------------------------------------------
00030 // GEANT 4 class source file
00031 //
00032 // G4PlacedSolid.cc
00033 //
00034 // ----------------------------------------------------------------------
00035 
00036 #include "G4PlacedSolid.hh"
00037 #include "G4GeometryTolerance.hh"
00038 
00039 G4PlacedSolid::G4PlacedSolid()
00040 {
00041   solid =0;
00042   solidRotation =0;
00043   solidTranslation =0;
00044 }
00045 
00046 
00047 G4PlacedSolid::G4PlacedSolid(G4BREPSolid* sol, G4Axis2Placement3D* p)
00048 {
00049   solid = sol;
00050   if(p)
00051   {
00052     G4double x,y,z;
00053     G4Point3D srfpoint = p->GetLocation();
00054     
00055     x = srfpoint.x();
00056     y = srfpoint.y();
00057     z = srfpoint.z();
00058     solidTranslation = new G4ThreeVector(x,y,z);
00059     
00060     G4Vector3D tmpvec = p->GetAxis();
00061     x = tmpvec.x();
00062     y = tmpvec.y();
00063     z = tmpvec.z();
00064     G4ThreeVector x_axis(x,y,z);
00065 
00066     G4double kCarTolerance = G4GeometryTolerance::GetInstance()
00067                              ->GetSurfaceTolerance();
00068     if( (x<kCarTolerance)&&
00069         (y<kCarTolerance)&&
00070         (z<kCarTolerance)   )
00071       solidRotation=0;
00072     else
00073     {
00074       tmpvec = p->GetRefDirection();
00075       x = tmpvec.x();
00076       y = tmpvec.y();
00077       z = tmpvec.z();
00078 
00079       G4ThreeVector y_axis(x,y,z);
00080       solidRotation = new G4RotationMatrix();
00081       solidRotation->rotateAxes(x_axis, y_axis, x_axis.cross(y_axis));
00082     }
00083   }
00084   else
00085   {
00086     solidTranslation=0;
00087     solidRotation=0;
00088   }
00089 }
00090 
00091 
00092 G4PlacedSolid::~G4PlacedSolid()
00093 {
00094   //delete solid;
00095   if(solidRotation)
00096     delete solidRotation;
00097   
00098   if(solidTranslation)
00099     delete solidTranslation;
00100 }

Generated on Mon May 27 17:49:22 2013 for Geant4 by  doxygen 1.4.7