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: G4Ellipsoid.hh,v 1.12 2007/05/18 07:39:56 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: HEAD $ |
---|
29 | // |
---|
30 | // |
---|
31 | // -------------------------------------------------------------------- |
---|
32 | // GEANT 4 class header file |
---|
33 | // |
---|
34 | // G4Ellipsoid |
---|
35 | // |
---|
36 | // Class description: |
---|
37 | // |
---|
38 | // A G4Ellipsoid is an ellipsoidal solid, optionally cut at a given z. |
---|
39 | // |
---|
40 | // Member Data: |
---|
41 | // |
---|
42 | // xSemiAxis semi-axis, x |
---|
43 | // ySemiAxis semi-axis, y |
---|
44 | // zSemiAxis semi-axis, z |
---|
45 | // zBottomCut lower cut plane level, z (solid lies above this plane) |
---|
46 | // zTopCut upper cut plane level, z (solid lies below this plane) |
---|
47 | |
---|
48 | // History: |
---|
49 | // ------- |
---|
50 | // 10.11.1999 G.Horton-Smith (Caltech, USA) - First implementation |
---|
51 | // 10.02.2005 G.Guerrieri (INFN Genova, Italy) - Revision |
---|
52 | // -------------------------------------------------------------------- |
---|
53 | #ifndef G4Ellipsoid_HH |
---|
54 | #define G4Ellipsoid_HH |
---|
55 | |
---|
56 | #include "G4VSolid.hh" |
---|
57 | |
---|
58 | class G4Ellipsoid : public G4VSolid |
---|
59 | { |
---|
60 | public: // with description |
---|
61 | |
---|
62 | G4Ellipsoid(const G4String& pName, |
---|
63 | G4double pxSemiAxis, |
---|
64 | G4double pySemiAxis, |
---|
65 | G4double pzSemiAxis, |
---|
66 | G4double pzBottomCut=0, |
---|
67 | G4double pzTopCut=0); |
---|
68 | |
---|
69 | virtual ~G4Ellipsoid(); |
---|
70 | |
---|
71 | // Access functions |
---|
72 | |
---|
73 | inline G4double GetSemiAxisMax (G4int i) const; |
---|
74 | inline G4double GetZBottomCut() const; |
---|
75 | inline G4double GetZTopCut() const; |
---|
76 | inline void SetSemiAxis (G4double x, G4double y, G4double z); |
---|
77 | inline void SetZCuts (G4double newzBottomCut, G4double newzTopCut); |
---|
78 | inline G4double GetCubicVolume(); |
---|
79 | inline G4double GetSurfaceArea(); |
---|
80 | |
---|
81 | // Solid standard methods |
---|
82 | |
---|
83 | G4bool CalculateExtent(const EAxis pAxis, |
---|
84 | const G4VoxelLimits& pVoxelLimit, |
---|
85 | const G4AffineTransform& pTransform, |
---|
86 | G4double& pmin, G4double& pmax) const; |
---|
87 | EInside Inside(const G4ThreeVector& p) const; |
---|
88 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const; |
---|
89 | G4double DistanceToIn(const G4ThreeVector& p, |
---|
90 | const G4ThreeVector& v) const; |
---|
91 | G4double DistanceToIn(const G4ThreeVector& p) const; |
---|
92 | G4double DistanceToOut(const G4ThreeVector& p, |
---|
93 | const G4ThreeVector& v, |
---|
94 | const G4bool calcNorm=G4bool(false), |
---|
95 | G4bool *validNorm=0, |
---|
96 | G4ThreeVector *n=0) const; |
---|
97 | G4double DistanceToOut(const G4ThreeVector& p) const; |
---|
98 | |
---|
99 | G4GeometryType GetEntityType() const; |
---|
100 | |
---|
101 | std::ostream& StreamInfo(std::ostream& os) const; |
---|
102 | |
---|
103 | G4ThreeVector GetPointOnSurface() const; |
---|
104 | |
---|
105 | // Visualisation functions |
---|
106 | |
---|
107 | G4Polyhedron* GetPolyhedron () const; |
---|
108 | void DescribeYourselfTo(G4VGraphicsScene& scene) const; |
---|
109 | G4VisExtent GetExtent() const; |
---|
110 | G4Polyhedron* CreatePolyhedron() const; |
---|
111 | G4NURBS* CreateNURBS() const; |
---|
112 | |
---|
113 | public: // without description |
---|
114 | |
---|
115 | G4Ellipsoid(__void__&); |
---|
116 | // Fake default constructor for usage restricted to direct object |
---|
117 | // persistency for clients requiring preallocation of memory for |
---|
118 | // persistifiable objects. |
---|
119 | |
---|
120 | protected: // without description |
---|
121 | |
---|
122 | G4ThreeVectorList* CreateRotatedVertices(const G4AffineTransform& pT, |
---|
123 | G4int& noPV) const; |
---|
124 | |
---|
125 | mutable G4Polyhedron* fpPolyhedron; |
---|
126 | |
---|
127 | private: |
---|
128 | |
---|
129 | G4double kRadTolerance; |
---|
130 | |
---|
131 | G4double fCubicVolume; |
---|
132 | G4double fSurfaceArea; |
---|
133 | G4double xSemiAxis, ySemiAxis, zSemiAxis, |
---|
134 | semiAxisMax, zBottomCut, zTopCut; |
---|
135 | }; |
---|
136 | |
---|
137 | #include "G4Ellipsoid.icc" |
---|
138 | |
---|
139 | #endif |
---|