| 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: G4EllipticalCone.hh,v 1.12 2008/11/21 09:26:22 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | // G4EllipticalCone
|
|---|
| 35 | //
|
|---|
| 36 | // Class description:
|
|---|
| 37 | //
|
|---|
| 38 | // G4EllipticalCone is a full cone with elliptical base which can be cut in Z.
|
|---|
| 39 | //
|
|---|
| 40 | // Member Data:
|
|---|
| 41 | //
|
|---|
| 42 | // xSemiAxis semi-axis, x, without dimentions
|
|---|
| 43 | // ySemiAxis semi-axis, y, without dimentions
|
|---|
| 44 | // zheight height, z
|
|---|
| 45 | // zTopCut upper cut plane level, z
|
|---|
| 46 | //
|
|---|
| 47 | // The height in Z corresponds to where the elliptical cone hits the
|
|---|
| 48 | // Z-axis if it had no Z cut. Also the cone is centered at zero having a
|
|---|
| 49 | // base at zTopCut and another at -zTopCut. The semi-major axes at the Z=0
|
|---|
| 50 | // plane are given by xSemiAxis*zheight and ySemiAxis*zheight so that the
|
|---|
| 51 | // curved surface of our cone satisfies the equation:
|
|---|
| 52 | //
|
|---|
| 53 | // ***************************************************************************
|
|---|
| 54 | // * *
|
|---|
| 55 | // * (x/xSemiAxis)^2 + (y/ySemiAxis)^2 = (zheight - z)^2 *
|
|---|
| 56 | // * *
|
|---|
| 57 | // ***************************************************************************
|
|---|
| 58 | //
|
|---|
| 59 | // In case you want to construct G4EllipticalCone from :
|
|---|
| 60 | // 1. halflength in Z = zTopCut
|
|---|
| 61 | // 2. Dx and Dy = halflength of ellipse axis at z = -zTopCut
|
|---|
| 62 | // 3. dx and dy = halflength of ellipse axis at z = zTopCut
|
|---|
| 63 | // ! Attention : dx/dy=Dx/Dy
|
|---|
| 64 | //
|
|---|
| 65 | // You need to find xSemiAxis,ySemiAxis and zheight:
|
|---|
| 66 | //
|
|---|
| 67 | // xSemiAxis = (Dx-dx)/(2*zTopCut)
|
|---|
| 68 | // ySemiAxis = (Dy-dy)/(2*zTopCut)
|
|---|
| 69 | // zheight = (Dx+dx)/(2*xSemiAxis)
|
|---|
| 70 | //
|
|---|
| 71 | // Author:
|
|---|
| 72 | // Dionysios Anninos, 8.9.2005
|
|---|
| 73 | //
|
|---|
| 74 | // Revision:
|
|---|
| 75 | // Lukas Lindroos, Tatiana Nikitina 20.08.2007
|
|---|
| 76 | //
|
|---|
| 77 | // --------------------------------------------------------------------
|
|---|
| 78 | #ifndef G4EllipticalCone_HH
|
|---|
| 79 | #define G4EllipticalCone_HH
|
|---|
| 80 |
|
|---|
| 81 | #include "G4VSolid.hh"
|
|---|
| 82 |
|
|---|
| 83 | class G4EllipticalCone : public G4VSolid
|
|---|
| 84 | {
|
|---|
| 85 | public: // with description
|
|---|
| 86 |
|
|---|
| 87 | G4EllipticalCone(const G4String& pName,
|
|---|
| 88 | G4double pxSemiAxis,
|
|---|
| 89 | G4double pySemiAxis,
|
|---|
| 90 | G4double zMax,
|
|---|
| 91 | G4double pzTopCut);
|
|---|
| 92 |
|
|---|
| 93 | virtual ~G4EllipticalCone();
|
|---|
| 94 |
|
|---|
| 95 | // Access functions
|
|---|
| 96 | //
|
|---|
| 97 | inline G4double GetSemiAxisMax () const;
|
|---|
| 98 | inline G4double GetSemiAxisX () const;
|
|---|
| 99 | inline G4double GetSemiAxisY () const;
|
|---|
| 100 | inline G4double GetZMax() const;
|
|---|
| 101 | inline G4double GetZTopCut() const;
|
|---|
| 102 | inline void SetSemiAxis (G4double x, G4double y, G4double z);
|
|---|
| 103 | inline void SetZCut (G4double newzTopCut);
|
|---|
| 104 |
|
|---|
| 105 | inline G4double GetCubicVolume();
|
|---|
| 106 | inline G4double GetSurfaceArea();
|
|---|
| 107 |
|
|---|
| 108 | // Solid standard methods
|
|---|
| 109 | //
|
|---|
| 110 | G4bool CalculateExtent(const EAxis pAxis,
|
|---|
| 111 | const G4VoxelLimits& pVoxelLimit,
|
|---|
| 112 | const G4AffineTransform& pTransform,
|
|---|
| 113 | G4double& pmin, G4double& pmax) const;
|
|---|
| 114 |
|
|---|
| 115 | EInside Inside(const G4ThreeVector& p) const;
|
|---|
| 116 |
|
|---|
| 117 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
|
|---|
| 118 |
|
|---|
| 119 | G4double DistanceToIn(const G4ThreeVector& p,
|
|---|
| 120 | const G4ThreeVector& v) const;
|
|---|
| 121 |
|
|---|
| 122 | G4double DistanceToIn(const G4ThreeVector& p) const;
|
|---|
| 123 |
|
|---|
| 124 | G4double DistanceToOut(const G4ThreeVector& p,
|
|---|
| 125 | const G4ThreeVector& v,
|
|---|
| 126 | const G4bool calcNorm=G4bool(false),
|
|---|
| 127 | G4bool *validNorm=0,
|
|---|
| 128 | G4ThreeVector *n=0) const;
|
|---|
| 129 |
|
|---|
| 130 | G4double DistanceToOut(const G4ThreeVector& p) const;
|
|---|
| 131 |
|
|---|
| 132 | G4GeometryType GetEntityType() const;
|
|---|
| 133 |
|
|---|
| 134 | G4ThreeVector GetPointOnSurface() const;
|
|---|
| 135 |
|
|---|
| 136 | std::ostream& StreamInfo(std::ostream& os) const;
|
|---|
| 137 |
|
|---|
| 138 | // Visualisation functions
|
|---|
| 139 | //
|
|---|
| 140 | G4Polyhedron* GetPolyhedron () const;
|
|---|
| 141 | void DescribeYourselfTo(G4VGraphicsScene& scene) const;
|
|---|
| 142 | G4VisExtent GetExtent() const;
|
|---|
| 143 | G4Polyhedron* CreatePolyhedron() const;
|
|---|
| 144 | G4NURBS* CreateNURBS() const;
|
|---|
| 145 |
|
|---|
| 146 | public: // without description
|
|---|
| 147 |
|
|---|
| 148 | G4EllipticalCone(__void__&);
|
|---|
| 149 | // Fake default constructor for usage restricted to direct object
|
|---|
| 150 | // persistency for clients requiring preallocation of memory for
|
|---|
| 151 | // persistifiable objects.
|
|---|
| 152 |
|
|---|
| 153 | protected: // without description
|
|---|
| 154 |
|
|---|
| 155 | G4ThreeVectorList* CreateRotatedVertices(const G4AffineTransform& pT,
|
|---|
| 156 | G4int& noPV) const;
|
|---|
| 157 |
|
|---|
| 158 | mutable G4Polyhedron* fpPolyhedron;
|
|---|
| 159 |
|
|---|
| 160 | private:
|
|---|
| 161 |
|
|---|
| 162 | G4double kRadTolerance;
|
|---|
| 163 |
|
|---|
| 164 | G4double fCubicVolume;
|
|---|
| 165 | G4double fSurfaceArea;
|
|---|
| 166 | G4double xSemiAxis, ySemiAxis, zheight,
|
|---|
| 167 | semiAxisMax, zTopCut;
|
|---|
| 168 | };
|
|---|
| 169 |
|
|---|
| 170 | #include "G4EllipticalCone.icc"
|
|---|
| 171 |
|
|---|
| 172 | #endif
|
|---|