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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/solids/CSG/include/G4Para.hh (Version 11.3.0) and /geometry/solids/CSG/include/G4Para.hh (Version 1.1)


                                                   >>   1 // This code implementation is the intellectual property of
                                                   >>   2 // the GEANT4 collaboration.
  1 //                                                  3 //
  2 // ******************************************* <<   4 // By copying, distributing or modifying the Program (or any work
  3 // * License and Disclaimer                    <<   5 // based on the Program) you indicate your acceptance of this statement,
  4 // *                                           <<   6 // and all its terms.
  5 // * The  Geant4 software  is  copyright of th <<   7 //
  6 // * the Geant4 Collaboration.  It is provided <<   8 // $Id: G4Para.hh,v 1.3 1999/12/15 14:50:06 gunter Exp $
  7 // * conditions of the Geant4 Software License <<   9 // GEANT4 tag $Name: geant4-01-01 $
  8 // * LICENSE and available at  http://cern.ch/ <<  10 //
  9 // * include a list of copyright holders.      <<  11 // class G4Para
 10 // *                                           <<  12 //
 11 // * Neither the authors of this software syst <<  13 // A G4Parallepiped, essentially a box with half lengths dx,dy,dz `skewed'
 12 // * institutes,nor the agencies providing fin <<  14 // so that there are angles theta & phi of the polar line joining the faces at
 13 // * work  make  any representation or  warran <<  15 // +-dz in z, and alpha formed by the y axis and the plane joinng the
 14 // * regarding  this  software system or assum <<  16 // centre of the faces G4Parallel to the z-x plane at -dy and +dy.
 15 // * use.  Please see the license in the file  <<  17 //
 16 // * for the full disclaimer and the limitatio <<  18 // A G4Para is defined by:
 17 // *                                           <<  19 //  dx,dy,dz  Half-length in x,y,z
 18 // * This  code  implementation is the result  <<  20 //  alpha   Angle formed by the y axis and by the plane joining
 19 // * technical work of the GEANT4 collaboratio <<  21 //      the centre of the faces G4Parallel to the z-x plane
 20 // * By using,  copying,  modifying or  distri <<  22 //      at -dy and +dy
 21 // * any work based  on the software)  you  ag <<  23 //  theta   Polar angle of the line joining the centres of the
 22 // * use  in  resulting  scientific  publicati <<  24 //      faces at -dz and +dz in z
 23 // * acceptance of all terms of the Geant4 Sof <<  25 //  phi   Azimuthal angle of the line joining the centres of the
 24 // ******************************************* <<  26 //      faces at -dz and +dz in z
 25 //                                             <<  27 // Member data:
 26 // G4Para                                      << 
 27 //                                             << 
 28 // Class description:                          << 
 29 //                                             << 
 30 //   A G4Parallepiped, essentially a box with  << 
 31 //   `skewed' so that there are angles theta & << 
 32 //   joining the faces at +-dz in z, and alpha << 
 33 //   and the plane joinng the centre of the fa << 
 34 //   z-x plane at -dy and +dy.                 << 
 35 //                                             << 
 36 //   A G4Para is defined by:                   << 
 37 //   dx,dy,dz - Half-length in x,y,z           << 
 38 //   alpha    - Angle formed by the y axis and << 
 39 //              the centre of the faces G4Para << 
 40 //              at -dy and +dy                 << 
 41 //   theta    - Polar angle of the line joinin << 
 42 //              faces at -dz and +dz in z      << 
 43 //   phi      - Azimuthal angle of the line jo << 
 44 //              faces at -dz and +dz in z      << 
 45 //   Member data:                              << 
 46 //                                                 28 //
 47 //   Note that the angles parameters are not s <<  29 // Note that the angles parameters are not stored - precomputed trig is
 48 //   stored instead.                           <<  30 // stored instead.
 49 //                                                 31 //
 50 //      fDx   Half-length in x                     32 //      fDx   Half-length in x
 51 //      fDy   Half-length in y                     33 //      fDy   Half-length in y
 52 //      fDz   Half-length in z                     34 //      fDz   Half-length in z
 53 //                                                 35 //
 54 //      fTalpha       Tan of alpha                 36 //      fTalpha       Tan of alpha
 55 //      fTthetaCphi   Tan theta * Cos phi          37 //      fTthetaCphi   Tan theta * Cos phi
 56 //      fTthetaSphi   Tan theta * Sin phi          38 //      fTthetaSphi   Tan theta * Sin phi
 57                                                <<  39 //
                                                   >>  40 // History:
 58 // 21.3.94 P.Kent Old C++ code converted to to     41 // 21.3.94 P.Kent Old C++ code converted to tolerant geometry
 59 // 31.10.96 V.Grichine Modifications according     42 // 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
 60 // ------------------------------------------- <<  43 // 18.11.99 V.Grichine , kUndefined was added to ESide
 61 #ifndef G4PARA_HH                              << 
 62 #define G4PARA_HH                              << 
 63                                                    44 
 64 #include "G4GeomTypes.hh"                      <<  45 #ifndef G4Para_HH
 65                                                <<  46 #define G4Para_HH
 66 #if defined(G4GEOM_USE_USOLIDS)                << 
 67 #define G4GEOM_USE_UPARA 1                     << 
 68 #endif                                         << 
 69                                                << 
 70 #if defined(G4GEOM_USE_UPARA)                  << 
 71   #define G4UPara G4Para                       << 
 72   #include "G4UPara.hh"                        << 
 73 #else                                          << 
 74                                                    47 
 75 #include "G4CSGSolid.hh"                           48 #include "G4CSGSolid.hh"
 76 #include "G4Polyhedron.hh"                     << 
 77                                                << 
 78 class G4Para : public G4CSGSolid               << 
 79 {                                              << 
 80   public:  // with description                 << 
 81                                                << 
 82     G4Para(const G4String& pName,              << 
 83                  G4double pDx, G4double pDy, G << 
 84                  G4double pAlpha, G4double pTh << 
 85                                                << 
 86     G4Para(const G4String& pName,              << 
 87            const G4ThreeVector pt[8]);         << 
 88                                                << 
 89     ~G4Para() override;                        << 
 90                                                << 
 91     // Accessors                               << 
 92                                                << 
 93     inline G4double GetZHalfLength()  const;   << 
 94     inline G4ThreeVector GetSymAxis() const;   << 
 95     inline G4double GetYHalfLength()  const;   << 
 96     inline G4double GetXHalfLength()  const;   << 
 97     inline G4double GetTanAlpha()     const;   << 
 98                                                << 
 99     inline G4double GetAlpha()  const;         << 
100     inline G4double GetTheta()  const;         << 
101     inline G4double GetPhi()    const;         << 
102     // Obtain (re)computed values of original  << 
103                                                << 
104     // Modifiers                               << 
105                                                << 
106     inline void SetXHalfLength(G4double val);  << 
107     inline void SetYHalfLength(G4double val);  << 
108     inline void SetZHalfLength(G4double val);  << 
109     inline void SetAlpha(G4double alpha);      << 
110     inline void SetTanAlpha(G4double val);     << 
111     inline void SetThetaAndPhi(G4double pTheta << 
112                                                << 
113     void SetAllParameters(G4double pDx, G4doub << 
114                           G4double pAlpha, G4d << 
115                                                << 
116     // Methods of solid                        << 
117                                                << 
118     G4double GetCubicVolume() override;        << 
119     G4double GetSurfaceArea() override;        << 
120                                                    49 
                                                   >>  50 class G4Para : public G4CSGSolid {
                                                   >>  51 public:
                                                   >>  52           G4Para(const G4String& pName,
                                                   >>  53            G4double pDx, G4double pDy, G4double pDz,
                                                   >>  54            G4double pAlpha, G4double pTheta, G4double pPhi);
                                                   >>  55      
                                                   >>  56           G4Para( const G4String& pName,
                                                   >>  57             const G4ThreeVector pt[8]) ;
                                                   >>  58      
                                                   >>  59     virtual ~G4Para() ;
                                                   >>  60     
                                                   >>  61                                       // Access functions
                                                   >>  62 
                                                   >>  63     G4double GetZHalfLength() const
                                                   >>  64     {
                                                   >>  65   return fDz ;
                                                   >>  66     }
                                                   >>  67     
                                                   >>  68     G4ThreeVector GetSymAxis() const
                                                   >>  69     {
                                                   >>  70      G4double cosTheta = 1.0/sqrt(1+fTthetaCphi*fTthetaCphi+fTthetaSphi*fTthetaSphi) ;
                                                   >>  71      
                                                   >>  72      return G4ThreeVector(fTthetaCphi*cosTheta,fTthetaSphi*cosTheta,cosTheta) ;
                                                   >>  73     }
                                                   >>  74 
                                                   >>  75     G4double GetYHalfLength() const
                                                   >>  76     {
                                                   >>  77   return fDy ;
                                                   >>  78     }
                                                   >>  79     
                                                   >>  80 
                                                   >>  81     G4double GetXHalfLength() const
                                                   >>  82     {
                                                   >>  83   return fDx ;
                                                   >>  84     }
                                                   >>  85 
                                                   >>  86 
                                                   >>  87     G4double GetTanAlpha()    const
                                                   >>  88     {
                                                   >>  89         return fTalpha ; 
                                                   >>  90     }
                                                   >>  91     
                                                   >>  92                                              // Set  functions
                                                   >>  93 
                                                   >>  94     void SetXHalfLength(G4double val)
                                                   >>  95     {
                                                   >>  96   fDx= val;
                                                   >>  97     }
                                                   >>  98     void SetYHalfLength(G4double val) 
                                                   >>  99     {
                                                   >> 100   fDy= val;
                                                   >> 101     }
                                                   >> 102     void SetZHalfLength(G4double val) 
                                                   >> 103     {
                                                   >> 104   fDz= val;
                                                   >> 105     }
                                                   >> 106     void SetAlpha(double alpha)    
                                                   >> 107     {
                                                   >> 108         fTalpha= tan(alpha); 
                                                   >> 109     }
                                                   >> 110     void SetTanAlpha(double val)    
                                                   >> 111     {
                                                   >> 112         fTalpha= val; 
                                                   >> 113     }
                                                   >> 114     void SetThetaAndPhi(double pTheta, double pPhi)    
                                                   >> 115     {
                                                   >> 116   fTthetaCphi=tan(pTheta)*cos(pPhi);
                                                   >> 117   fTthetaSphi=tan(pTheta)*sin(pPhi);
                                                   >> 118     }
                                                   >> 119     void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, 
                                                   >> 120             G4double pAlpha, G4double pTheta, G4double pPhi);
                                                   >> 121     
                                                   >> 122                                                       // Methods
                                                   >> 123     
121     void ComputeDimensions(G4VPVParameterisati    124     void ComputeDimensions(G4VPVParameterisation* p,
122                            const G4int n,         125                            const G4int n,
123                            const G4VPhysicalVo << 126                            const G4VPhysicalVolume* pRep);
124                                                << 
125     void BoundingLimits(G4ThreeVector& pMin, G << 
126                                                   127 
127     G4bool CalculateExtent(const EAxis pAxis,     128     G4bool CalculateExtent(const EAxis pAxis,
128                            const G4VoxelLimits    129                            const G4VoxelLimits& pVoxelLimit,
129                            const G4AffineTrans    130                            const G4AffineTransform& pTransform,
130                                  G4double& pMi << 131                            G4double& pMin, G4double& pMax) const;    
131                                                << 132         
132     EInside Inside(const G4ThreeVector& p) con << 133     EInside Inside(const G4ThreeVector& p) const;
133                                                   134 
134     G4ThreeVector SurfaceNormal( const G4Three << 135     G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
135                                                   136 
136     G4double DistanceToIn(const G4ThreeVector&    137     G4double DistanceToIn(const G4ThreeVector& p,
137                           const G4ThreeVector& << 138                           const G4ThreeVector& v) const;
138     G4double DistanceToIn(const G4ThreeVector& << 139     G4double DistanceToIn(const G4ThreeVector& p) const;
139                                                << 140     
140     G4double DistanceToOut(const G4ThreeVector << 141     G4double DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v,
141                            const G4bool calcNo << 142          const G4bool calcNorm=G4bool(false),
142                                  G4bool* valid << 143          G4bool *validNorm=0,G4ThreeVector *n=0) const;
143                                  G4ThreeVector << 144     G4double DistanceToOut(const G4ThreeVector& p) const;
144     G4double DistanceToOut(const G4ThreeVector << 145 
145                                                << 146              // Naming method (pseudo-RTTI : run-time type identification
146     G4GeometryType GetEntityType() const overr << 147 
147                                                << 148     virtual G4GeometryType  GetEntityType() const { return G4String("G4Para"); }
148     G4ThreeVector GetPointOnSurface() const ov << 149 
                                                   >> 150                         // Visualisation functions
                                                   >> 151 
                                                   >> 152     void                DescribeYourselfTo (G4VGraphicsScene& scene) const;
                                                   >> 153     
                                                   >> 154     G4VisExtent         GetExtent          () const;
                                                   >> 155     
                                                   >> 156     G4Polyhedron* CreatePolyhedron   () const;
                                                   >> 157     
                                                   >> 158     G4NURBS*      CreateNURBS        () const;
149                                                   159 
150     G4bool IsFaceted() const override;         << 160 protected:
151                                                   161 
152     G4VSolid* Clone() const override;          << 162     G4ThreeVectorList*
                                                   >> 163     CreateRotatedVertices(const G4AffineTransform& pTransform) const;
153                                                   164 
154     std::ostream& StreamInfo(std::ostream& os) << 165 private:
155                                                << 166     G4double fDx,fDy,fDz;
156     // Visualisation functions                 << 167     G4double fTalpha,fTthetaCphi,fTthetaSphi;
157                                                << 168 };
158     void          DescribeYourselfTo (G4VGraph << 169     
159     G4Polyhedron* CreatePolyhedron   () const  << 170 #endif
160                                                << 
161     G4Para(__void__&);                         << 
162       // Fake default constructor for usage re << 
163       // persistency for clients requiring pre << 
164       // persistifiable objects                << 
165                                                << 
166     G4Para(const G4Para& rhs);                 << 
167     G4Para& operator=(const G4Para& rhs);      << 
168       // Copy constructor and assignment opera << 
169                                                   171 
170   private:                                     << 
171                                                   172 
172     void CheckParameters();                    << 
173       // Check parameters                      << 
174                                                   173 
175     void MakePlanes();                         << 
176       // Set side planes                       << 
177                                                   174 
178     G4ThreeVector ApproxSurfaceNormal(const G4 << 
179       // Algorithm for SurfaceNormal() followi << 
180       // specification for points not on the s << 
181                                                   175 
182                                                << 
183   private:                                     << 
184                                                   176 
185     G4double halfCarTolerance;                 << 
186     G4double fDx,fDy,fDz;                      << 
187     G4double fTalpha,fTthetaCphi,fTthetaSphi;  << 
188     struct { G4double a,b,c,d; } fPlanes[4];   << 
189 };                                             << 
190                                                   177 
191 #include "G4Para.icc"                          << 
192                                                   178 
193 #endif                                         << 
194                                                   179 
195 #endif                                         << 
196                                                   180