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
00037
00038
00039 #ifndef __SOLID_H
00040 #define __SOLID_H
00041
00042 #include "G4VSolid.hh"
00043 #include "G4Surface.hh"
00044 #include "G4Axis2Placement3D.hh"
00045 #include "G4PointRat.hh"
00046 #include "G4BoundingBox3D.hh"
00047
00048 class G4Ray;
00049
00050 class G4BREPSolid : public G4VSolid
00051 {
00052
00053 public:
00054
00055 G4BREPSolid(const G4String& name);
00056 G4BREPSolid(const G4String&, G4Surface**, G4int);
00057 virtual ~G4BREPSolid();
00058
00059
00060 virtual void Initialize();
00061
00062
00063
00064 G4bool CalculateExtent(const EAxis pAxis ,
00065 const G4VoxelLimits& pVoxelLimit,
00066 const G4AffineTransform& pTransform ,
00067 G4double& pMin ,
00068 G4double& pMax ) const;
00069
00070
00071
00072
00073 virtual EInside Inside(register const G4ThreeVector& Pt) const;
00074
00075
00076
00077 virtual G4ThreeVector SurfaceNormal(const G4ThreeVector&) const;
00078
00079
00080
00081 virtual G4double DistanceToIn(const G4ThreeVector&) const;
00082
00083
00084
00085
00086 virtual G4double DistanceToIn(register const G4ThreeVector& Pt,
00087 register const G4ThreeVector& V) const;
00088
00089
00090
00091
00092
00093 virtual G4double DistanceToOut(const G4ThreeVector&) const;
00094
00095
00096
00097
00098 virtual G4double DistanceToOut(register const G4ThreeVector& Pt,
00099 register const G4ThreeVector& V,
00100 const G4bool calcNorm=false ,
00101 G4bool *validNorm=0 ,
00102 G4ThreeVector *n=0 ) const;
00103
00104
00105
00106
00107
00108
00109
00110 G4Point3D Scope() const;
00111
00112
00113
00114 virtual G4String GetEntityType() const;
00115
00116
00117
00118 virtual G4VSolid* Clone() const;
00119
00120
00121
00122 virtual std::ostream& StreamInfo(std::ostream& os) const;
00123
00124
00125 void DescribeYourselfTo (G4VGraphicsScene& scene) const;
00126
00127
00128 G4Polyhedron* CreatePolyhedron () const;
00129 G4NURBS* CreateNURBS () const;
00130
00131
00132 virtual G4Polyhedron* GetPolyhedron () const;
00133
00134
00135
00136 G4int Intersect(register const G4Ray&) const;
00137
00138
00139
00140 inline G4Surface* GetSurface(G4int) const;
00141 inline void Active(G4int) const;
00142 inline G4int Active() const;
00143 inline G4double GetShortestDistance() const;
00144 inline G4int GetId() const;
00145 inline void SetId(G4int);
00146 inline const G4String& GetName() const;
00147 inline void SetName(const G4String& name);
00148 inline G4int GetNumberOfFaces() const;
00149 inline G4int GetNumberOfSolids() const;
00150 inline const G4Axis2Placement3D* GetPlace() const;
00151 inline const G4BoundingBox3D* GetBBox() const;
00152
00153
00154 inline G4int GetCubVolStatistics() const;
00155 inline G4double GetCubVolEpsilon() const;
00156 inline void SetCubVolStatistics(G4int st);
00157 inline void SetCubVolEpsilon(G4double ep);
00158 inline G4int GetAreaStatistics() const;
00159 inline G4double GetAreaAccuracy() const;
00160 inline void SetAreaStatistics(G4int st);
00161 inline void SetAreaAccuracy(G4double ep);
00162
00163
00164 public:
00165
00166 inline G4double GetCubicVolume();
00167
00168
00169 inline G4double GetSurfaceArea();
00170
00171
00172
00173 inline G4double IntersectionDistance() const;
00174 inline void IntersectionDistance(G4double) const;
00175
00176
00177 virtual void Reset() const;
00178
00179
00180 public:
00181
00182 G4BREPSolid(__void__&);
00183
00184
00185
00186
00187 G4BREPSolid(const G4BREPSolid& rhs);
00188 G4BREPSolid& operator=(const G4BREPSolid& rhs);
00189
00190
00191 protected:
00192
00193 G4ThreeVectorList* CreateRotatedVertices(const G4AffineTransform&) const;
00194 G4bool IsConvex();
00195
00196 virtual void CalcBBoxes();
00197
00198
00199 void CheckSurfaceNormals();
00200 void RemoveHiddenFaces(register const G4Ray& G4Rayref, G4int) const;
00201
00202
00203
00204
00205
00206
00207 void TestSurfaceBBoxes(register const G4Ray&) const;
00208
00209
00210
00211 inline G4int StartInside() const;
00212 inline void StartInside(G4int si) const;
00213
00214 inline void QuickSort( register G4Surface** SrfVec,
00215 register G4int left, register G4int right) const;
00216
00217 protected:
00218
00219 static G4int NumberOfSolids;
00220 static G4Ray Track;
00221 static G4double ShortestDistance;
00222
00223 G4int Box, Convex, AxisBox, PlaneSolid;
00224 G4Axis2Placement3D* place;
00225 G4BoundingBox3D* bbox;
00226 G4double intersectionDistance;
00227 G4int active;
00228 G4int startInside;
00229 G4int nb_of_surfaces;
00230 G4Point3D intersection_point;
00231 G4Surface** SurfaceVec;
00232 G4double RealDist;
00233 G4String solidname;
00234 G4int Id;
00235
00236
00237 private:
00238
00239 G4int IsBox();
00240 G4int FinalEvaluation(register const G4Ray&, G4int =0) const;
00241
00242 private:
00243
00244 G4int fStatistics;
00245 G4double fCubVolEpsilon;
00246 G4double fAreaAccuracy;
00247 G4double fCubicVolume;
00248 G4double fSurfaceArea;
00249
00250
00251 mutable G4Polyhedron* fpPolyhedron;
00252
00253 };
00254
00255 #include "G4BREPSolid.icc"
00256
00257 #endif