00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
00095 if(solidRotation)
00096 delete solidRotation;
00097
00098 if(solidTranslation)
00099 delete solidTranslation;
00100 }