source: trunk/source/geometry/solids/BREPS/src/G4BREPSolidBox.cc@ 1347

Last change on this file since 1347 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.8 KB
Line 
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: G4BREPSolidBox.cc,v 1.11 2008/01/22 16:03:52 tnikitin Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30// ----------------------------------------------------------------------
31// GEANT 4 class source file
32//
33// G4BREPSolidBox.cc
34//
35// ----------------------------------------------------------------------
36
37#include "G4BREPSolidBox.hh"
38#include "G4FPlane.hh"
39#include "G4Point3DVector.hh"
40
41G4BREPSolidBox::G4BREPSolidBox(const G4String& name,
42 const G4Point3D& Pt1,
43 const G4Point3D& Pt2,
44 const G4Point3D& Pt3,
45 const G4Point3D& Pt4,
46 const G4Point3D& Pt5,
47 const G4Point3D& Pt6,
48 const G4Point3D& Pt7,
49 const G4Point3D& Pt8): G4BREPSolid(name)
50{
51 nb_of_surfaces=6;
52 active=1;PlaneSolid=1;
53 SurfaceVec = new G4Surface*[6];
54 G4Point3DVector PVec(4);
55 G4int sense=0;
56
57 PVec[0] = Pt1;
58 PVec[1] = Pt2;
59 PVec[2] = Pt3;
60 PVec[3] = Pt4;
61 SurfaceVec[0] = new G4FPlane(&PVec);
62
63 PVec[2] = Pt6;
64 PVec[3] = Pt5;
65 SurfaceVec[1] = new G4FPlane(&PVec,0,sense);
66
67 PVec[0] = Pt2;
68 PVec[1] = Pt6;
69 PVec[2] = Pt7;
70 PVec[3] = Pt3;
71 SurfaceVec[2] = new G4FPlane(&PVec);
72
73 PVec[0] = Pt3;
74 PVec[1] = Pt7;
75 PVec[2] = Pt8;
76 PVec[3] = Pt4;
77 SurfaceVec[3] = new G4FPlane(&PVec);
78
79 PVec[0] = Pt1;
80 PVec[1] = Pt5;
81 PVec[2] = Pt8;
82 PVec[3] = Pt4;
83 SurfaceVec[4] = new G4FPlane(&PVec,0,sense);
84
85 PVec[0] = Pt5;
86 PVec[1] = Pt6;
87 PVec[2] = Pt7;
88 PVec[3] = Pt8;
89 SurfaceVec[5] = new G4FPlane(&PVec,0,sense);
90
91 // Save the constructor parameters
92 constructorParams[0] = Pt1;
93 constructorParams[1] = Pt2;
94 constructorParams[2] = Pt3;
95 constructorParams[3] = Pt4;
96 constructorParams[4] = Pt5;
97 constructorParams[5] = Pt6;
98 constructorParams[6] = Pt7;
99 constructorParams[7] = Pt8;
100
101 Initialize();
102
103}
104
105G4BREPSolidBox::G4BREPSolidBox( __void__& a )
106 : G4BREPSolid(a)
107{
108}
109
110G4BREPSolidBox::~G4BREPSolidBox()
111{
112}
113
114EInside G4BREPSolidBox::Inside(register const G4ThreeVector& Pt) const
115{
116 G4Point3D Point(Pt);
117
118 // Get the bounding box extent
119 G4Point3D min = bbox->GetBoxMin();
120 min += G4Point3D(-0.5*kCarTolerance,-0.5*kCarTolerance,-0.5*kCarTolerance);
121
122 G4Point3D max = bbox->GetBoxMax();
123 max += G4Point3D(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
124
125 if( (Point.x() < min.x() || Point.x() > max.x()) ||
126 (Point.y() < min.y() || Point.y() > max.y()) ||
127 (Point.z() < min.z() || Point.z() > max.z()) )
128 return kOutside;
129
130 if( (Point.x() > min.x() && Point.x() < max.x())&&
131 (Point.y() > min.y() && Point.y() < max.y())&&
132 (Point.z() > min.z() && Point.z() < max.z()) )
133 return kInside;
134
135 return kSurface;
136}
137
138// Streams solid contents to output stream.
139std::ostream& G4BREPSolidBox::StreamInfo(std::ostream& os) const
140{
141 G4BREPSolid::StreamInfo( os )
142 << "\n"
143 << " Pt1: " << constructorParams[0]
144 << " Pt2: " << constructorParams[1]
145 << " Pt3: " << constructorParams[2]
146 << " Pt4: " << constructorParams[3]
147 << "\n Pt5: " << constructorParams[4]
148 << " Pt6: " << constructorParams[5]
149 << " Pt7: " << constructorParams[6]
150 << " Pt8: " << constructorParams[7]
151 << "\n-----------------------------------------------------------\n";
152
153 return os;
154}
155
Note: See TracBrowser for help on using the repository browser.