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 #include "G4BREPSolidCylinder.hh"
00036 #include "G4CircularCurve.hh"
00037 #include "G4FPlane.hh"
00038 #include "G4FCylindricalSurface.hh"
00039
00040 G4BREPSolidCylinder::G4BREPSolidCylinder(const G4String& name,
00041 const G4ThreeVector& origin,
00042 const G4ThreeVector& axis,
00043 const G4ThreeVector& direction,
00044 G4double radius,
00045 G4double length)
00046 : G4BREPSolid(name)
00047 {
00048 nb_of_surfaces = 3;
00049 active=1;
00050
00051
00052 constructorParams.origin = origin;
00053 constructorParams.axis = axis;
00054 constructorParams.direction = direction;
00055 constructorParams.length = length;
00056 constructorParams.radius = radius;
00057
00058 InitializeCylinder();
00059 }
00060
00061 G4BREPSolidCylinder::G4BREPSolidCylinder( __void__& a )
00062 : G4BREPSolid(a)
00063 {
00064 }
00065
00066 G4BREPSolidCylinder::~G4BREPSolidCylinder()
00067 {
00068 }
00069
00070 G4BREPSolidCylinder::G4BREPSolidCylinder(const G4BREPSolidCylinder& rhs)
00071 : G4BREPSolid(rhs)
00072 {
00073 constructorParams.origin = rhs.constructorParams.origin;
00074 constructorParams.axis = rhs.constructorParams.axis;
00075 constructorParams.direction = rhs.constructorParams.direction;
00076 constructorParams.length = rhs.constructorParams.length;
00077 constructorParams.radius = rhs.constructorParams.radius;
00078
00079 InitializeCylinder();
00080 }
00081
00082 G4BREPSolidCylinder&
00083 G4BREPSolidCylinder::operator = (const G4BREPSolidCylinder& rhs)
00084 {
00085
00086
00087 if (this == &rhs) { return *this; }
00088
00089
00090
00091 G4BREPSolid::operator=(rhs);
00092
00093
00094
00095 constructorParams.origin = rhs.constructorParams.origin;
00096 constructorParams.axis = rhs.constructorParams.axis;
00097 constructorParams.direction = rhs.constructorParams.direction;
00098 constructorParams.length = rhs.constructorParams.length;
00099 constructorParams.radius = rhs.constructorParams.radius;
00100
00101 InitializeCylinder();
00102
00103 return *this;
00104 }
00105
00106 void G4BREPSolidCylinder::InitializeCylinder()
00107 {
00108 SurfaceVec = new G4Surface*[3];
00109 G4CurveVector cv;
00110 G4CircularCurve* tmp;
00111
00112
00113 SurfaceVec[0] = new G4FCylindricalSurface(constructorParams.origin,
00114 constructorParams.axis,
00115 constructorParams.radius,
00116 constructorParams.length);
00117
00118
00119
00120
00121 G4Point3D ArcStart1 = G4Point3D( constructorParams.origin
00122 + ( constructorParams.radius
00123 * constructorParams.direction ) );
00124 G4Vector3D axis1 = G4Vector3D( constructorParams.axis.cross( constructorParams.direction ) );
00125
00126 tmp = new G4CircularCurve;
00127 tmp->Init( G4Axis2Placement3D(constructorParams.direction, axis1,
00128 constructorParams.origin),
00129 constructorParams.radius );
00130 tmp->SetBounds(ArcStart1, ArcStart1);
00131 cv.push_back(tmp);
00132
00133 SurfaceVec[1] = new G4FPlane(constructorParams.direction, axis1,
00134 constructorParams.origin);
00135 SurfaceVec[1]->SetBoundaries(&cv);
00136 cv.clear();
00137
00138
00139
00140 G4Point3D origin2 = G4Point3D( constructorParams.origin
00141 + ( constructorParams.length
00142 * constructorParams.axis ) );
00143 G4Point3D ArcStart2 = origin2
00144 + G4Point3D( constructorParams.radius
00145 * constructorParams.direction );
00146 G4Vector3D axis2 = axis1;
00147
00148 tmp = new G4CircularCurve;
00149 tmp->Init( G4Axis2Placement3D(constructorParams.direction,
00150 axis2, origin2),
00151 constructorParams.radius);
00152 tmp->SetBounds(ArcStart2, ArcStart2);
00153 cv.push_back(tmp);
00154
00155 SurfaceVec[2] = new G4FPlane(constructorParams.direction, axis2, origin2);
00156 SurfaceVec[2]->SetBoundaries(&cv);
00157 cv.clear();
00158
00159 Initialize();
00160 }
00161
00162 G4VSolid* G4BREPSolidCylinder::Clone() const
00163 {
00164 return new G4BREPSolidCylinder(*this);
00165 }
00166
00167 std::ostream& G4BREPSolidCylinder::StreamInfo(std::ostream& os) const
00168 {
00169
00170
00171 G4BREPSolid::StreamInfo( os )
00172 << "\n origin: " << constructorParams.origin
00173 << "\n axis: " << constructorParams.axis
00174 << "\n direction: " << constructorParams.direction
00175 << "\n length: " << constructorParams.length
00176 << "\n radius: " << constructorParams.radius
00177 << "\n-----------------------------------------------------------\n";
00178
00179 return os;
00180 }
00181