Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BREPSolidBox.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29// ----------------------------------------------------------------------
30// GEANT 4 class source file
31//
32// G4BREPSolidBox.cc
33//
34// ----------------------------------------------------------------------
35
36#include "G4BREPSolidBox.hh"
37#include "G4FPlane.hh"
38#include "G4Point3DVector.hh"
39
41 const G4Point3D& Pt1,
42 const G4Point3D& Pt2,
43 const G4Point3D& Pt3,
44 const G4Point3D& Pt4,
45 const G4Point3D& Pt5,
46 const G4Point3D& Pt6,
47 const G4Point3D& Pt7,
48 const G4Point3D& Pt8): G4BREPSolid(name)
49{
51 active=1; PlaneSolid=1;
52
53 // Save the constructor parameters
54 constructorParams[0] = Pt1;
55 constructorParams[1] = Pt2;
56 constructorParams[2] = Pt3;
57 constructorParams[3] = Pt4;
58 constructorParams[4] = Pt5;
59 constructorParams[5] = Pt6;
60 constructorParams[6] = Pt7;
61 constructorParams[7] = Pt8;
62
63 InitializeBox();
64}
65
67 : G4BREPSolid(a)
68{
69}
70
72{
73}
74
76 : G4BREPSolid(rhs), Rotation(rhs.Rotation)
77{
78 for (size_t i=0; i<8; ++i) { constructorParams[i]= rhs.constructorParams[i]; }
79 InitializeBox();
80}
81
83{
84 // Check assignment to self
85 //
86 if (this == &rhs) { return *this; }
87
88 // Copy base class data
89 //
91
92 // Copy data
93 //
94 Rotation= rhs.Rotation;
95 for (size_t i=0; i<8; ++i) { constructorParams[i]= rhs.constructorParams[i]; }
96 InitializeBox();
97
98 return *this;
99}
100
101void G4BREPSolidBox::InitializeBox()
102{
103 SurfaceVec = new G4Surface*[6];
104 G4Point3DVector PVec(4);
105 G4int sense=0;
106
107 PVec[0] = constructorParams[0];
108 PVec[1] = constructorParams[1];
109 PVec[2] = constructorParams[2];
110 PVec[3] = constructorParams[3];
111 SurfaceVec[0] = new G4FPlane(&PVec);
112
113 PVec[2] = constructorParams[5];
114 PVec[3] = constructorParams[4];
115 SurfaceVec[1] = new G4FPlane(&PVec,0,sense);
116
117 PVec[0] = constructorParams[1];
118 PVec[1] = constructorParams[5];
119 PVec[2] = constructorParams[6];
120 PVec[3] = constructorParams[2];
121 SurfaceVec[2] = new G4FPlane(&PVec);
122
123 PVec[0] = constructorParams[2];
124 PVec[1] = constructorParams[6];
125 PVec[2] = constructorParams[7];
126 PVec[3] = constructorParams[3];
127 SurfaceVec[3] = new G4FPlane(&PVec);
128
129 PVec[0] = constructorParams[0];
130 PVec[1] = constructorParams[4];
131 PVec[2] = constructorParams[7];
132 PVec[3] = constructorParams[3];
133 SurfaceVec[4] = new G4FPlane(&PVec,0,sense);
134
135 PVec[0] = constructorParams[4];
136 PVec[1] = constructorParams[5];
137 PVec[2] = constructorParams[6];
138 PVec[3] = constructorParams[7];
139 SurfaceVec[5] = new G4FPlane(&PVec,0,sense);
140
141 Initialize();
142}
143
145{
146 G4Point3D Point(Pt);
147
148 // Get the bounding box extent
149 G4Point3D min = bbox->GetBoxMin();
150 min += G4Point3D(-0.5*kCarTolerance,-0.5*kCarTolerance,-0.5*kCarTolerance);
151
152 G4Point3D max = bbox->GetBoxMax();
154
155 if( (Point.x() < min.x() || Point.x() > max.x()) ||
156 (Point.y() < min.y() || Point.y() > max.y()) ||
157 (Point.z() < min.z() || Point.z() > max.z()) )
158 return kOutside;
159
160 if( (Point.x() > min.x() && Point.x() < max.x())&&
161 (Point.y() > min.y() && Point.y() < max.y())&&
162 (Point.z() > min.z() && Point.z() < max.z()) )
163 return kInside;
164
165 return kSurface;
166}
167
169{
170 return new G4BREPSolidBox(*this);
171}
172
173std::ostream& G4BREPSolidBox::StreamInfo(std::ostream& os) const
174{
175 // Streams solid contents to output stream.
176
178 << "\n"
179 << " Pt1: " << constructorParams[0]
180 << " Pt2: " << constructorParams[1]
181 << " Pt3: " << constructorParams[2]
182 << " Pt4: " << constructorParams[3]
183 << "\n Pt5: " << constructorParams[4]
184 << " Pt6: " << constructorParams[5]
185 << " Pt7: " << constructorParams[6]
186 << " Pt8: " << constructorParams[7]
187 << "\n-----------------------------------------------------------\n";
188
189 return os;
190}
191
std::vector< G4Point3D > G4Point3DVector
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
int G4int
Definition: G4Types.hh:66
EInside Inside(register const G4ThreeVector &Pt) const
std::ostream & StreamInfo(std::ostream &os) const
G4BREPSolidBox(const G4String &, const G4Point3D &, const G4Point3D &, const G4Point3D &, const G4Point3D &, const G4Point3D &, const G4Point3D &, const G4Point3D &, const G4Point3D &)
G4VSolid * Clone() const
G4BREPSolidBox & operator=(const G4BREPSolidBox &rhs)
G4Surface ** SurfaceVec
Definition: G4BREPSolid.hh:231
G4BREPSolid & operator=(const G4BREPSolid &rhs)
Definition: G4BREPSolid.cc:138
G4int nb_of_surfaces
Definition: G4BREPSolid.hh:229
G4BoundingBox3D * bbox
Definition: G4BREPSolid.hh:225
virtual std::ostream & StreamInfo(std::ostream &os) const
G4int PlaneSolid
Definition: G4BREPSolid.hh:223
virtual void Initialize()
Definition: G4BREPSolid.cc:171
G4Point3D GetBoxMin() const
G4Point3D GetBoxMax() const
G4double kCarTolerance
Definition: G4VSolid.hh:307
EInside
Definition: geomdefs.hh:58
@ kInside
Definition: geomdefs.hh:58
@ kOutside
Definition: geomdefs.hh:58
@ kSurface
Definition: geomdefs.hh:58