|
|
|||
File indexing completed on 2026-08-09 09:09:50
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4Para 0027 // 0028 // Class description: 0029 // 0030 // A parallelepiped, essentially a box with half lengths dx,dy,dz 0031 // 'skewed' so that there are angles theta & phi of the polar line 0032 // joining the faces at +-dz in z, and alpha formed by the y axis 0033 // and the plane joining the centre of the faces parallel to the 0034 // z-x plane at -dy and +dy. 0035 // 0036 // A G4Para is defined by: 0037 // dx,dy,dz - Half-length in x,y,z 0038 // alpha - Angle formed by the y axis and by the plane joining 0039 // the centre of the faces parallel to the z-x plane 0040 // at -dy and +dy 0041 // theta - Polar angle of the line joining the centres of the 0042 // faces at -dz and +dz in z 0043 // phi - Azimuthal angle of the line joining the centres of the 0044 // faces at -dz and +dz in z 0045 // Member data: 0046 // 0047 // Note that the angles parameters are not stored - precomputed trig is 0048 // stored instead. 0049 // 0050 // fDx Half-length in x 0051 // fDy Half-length in y 0052 // fDz Half-length in z 0053 // 0054 // fTalpha Tan of alpha 0055 // fTthetaCphi Tan theta * Cos phi 0056 // fTthetaSphi Tan theta * Sin phi 0057 0058 // Author: Paul Kent (CERN), 21.03.1994 - Code converted to tolerant geometry 0059 // -------------------------------------------------------------------- 0060 #ifndef G4PARA_HH 0061 #define G4PARA_HH 0062 0063 #include "G4GeomTypes.hh" 0064 0065 #if defined(G4GEOM_USE_USOLIDS) 0066 #define G4GEOM_USE_UPARA 1 0067 #endif 0068 0069 #if defined(G4GEOM_USE_UPARA) 0070 #define G4UPara G4Para 0071 #include "G4UPara.hh" 0072 #else 0073 0074 #include "G4CSGSolid.hh" 0075 #include "G4Polyhedron.hh" 0076 0077 /** 0078 * @brief G4Para represents a parallelepiped, essentially a box with half 0079 * lengths dx,dy,dz 'skewed' so that there are angles theta & phi of the 0080 * polar line joining the faces at +-dz in z, and alpha formed by the y axis 0081 * and the plane joining the centre of the faces parallel to the z-x plane 0082 * at -dy and +dy. 0083 */ 0084 0085 class G4Para : public G4CSGSolid 0086 { 0087 public: 0088 0089 /** 0090 * Constructs a parallelepiped, given a name and its parameters. 0091 * @param[in] pName The name of the solid. 0092 * @param[in] pDx Half-length in x. 0093 * @param[in] pDy Half-length in y. 0094 * @param[in] pDz Half-length in z. 0095 * @param[in] pAlpha Angle formed by the Y axis and by the plane joining 0096 * the centre of the faces parallel to the Z-X plane at -dy 0097 * and +dy. 0098 * @param[in] pTheta Polar angle of the line joining the centres of the 0099 * faces at -dz and +dz in Z. 0100 * @param[in] pPhi Azimuthal angle of the line joining the centres of 0101 * the faces at -dz and +dz in Z. 0102 */ 0103 G4Para(const G4String& pName, 0104 G4double pDx, G4double pDy, G4double pDz, 0105 G4double pAlpha, G4double pTheta, G4double pPhi); 0106 0107 /** 0108 * Constructs a parallelepiped, given a name and its 8 vertices. 0109 * @param[in] pName The name of the solid. 0110 * @param[in] pt Points of the 8 vertices. 0111 */ 0112 G4Para(const G4String& pName, 0113 const G4ThreeVector pt[8]); 0114 0115 /** 0116 * Default destructor. 0117 */ 0118 ~G4Para() override = default; 0119 0120 /** 0121 * Accessors. Obtain (re)computed values of the original parameters. 0122 */ 0123 inline G4double GetZHalfLength() const; 0124 inline G4ThreeVector GetSymAxis() const; 0125 inline G4double GetYHalfLength() const; 0126 inline G4double GetXHalfLength() const; 0127 inline G4double GetTanAlpha() const; 0128 inline G4double GetAlpha() const; 0129 inline G4double GetTheta() const; 0130 inline G4double GetPhi() const; 0131 0132 /** 0133 * Modifiers. 0134 */ 0135 inline void SetXHalfLength(G4double val); 0136 inline void SetYHalfLength(G4double val); 0137 inline void SetZHalfLength(G4double val); 0138 inline void SetAlpha(G4double alpha); 0139 inline void SetTanAlpha(G4double val); 0140 inline void SetThetaAndPhi(G4double pTheta, G4double pPhi); 0141 0142 /** 0143 * Sets all parameters, as for constructor. 0144 */ 0145 void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, 0146 G4double pAlpha, G4double pTheta, G4double pPhi); 0147 0148 /** 0149 * Returning an estimation of the solid volume (capacity) and 0150 * surface area, in internal units. 0151 */ 0152 G4double GetCubicVolume() override; 0153 G4double GetSurfaceArea() override; 0154 0155 /** 0156 * Dispatch method for parameterisation replication mechanism and 0157 * dimension computation. 0158 */ 0159 void ComputeDimensions(G4VPVParameterisation* p, 0160 const G4int n, 0161 const G4VPhysicalVolume* pRep) override; 0162 0163 /** 0164 * Computes the bounding limits of the solid. 0165 * @param[out] pMin The minimum bounding limit point. 0166 * @param[out] pMax The maximum bounding limit point. 0167 */ 0168 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0169 0170 /** 0171 * Calculates the minimum and maximum extent of the solid, when under the 0172 * specified transform, and within the specified limits. 0173 * @param[in] pAxis The axis along which compute the extent. 0174 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0175 * @param[in] pTransform The internal transformation applied to the solid. 0176 * @param[out] pMin The minimum extent value. 0177 * @param[out] pMax The maximum extent value. 0178 * @returns True if the solid is intersected by the extent region. 0179 */ 0180 G4bool CalculateExtent(const EAxis pAxis, 0181 const G4VoxelLimits& pVoxelLimit, 0182 const G4AffineTransform& pTransform, 0183 G4double& pMin, G4double& pMax) const override; 0184 0185 /** 0186 * Concrete implementations of the expected query interfaces for 0187 * solids, as defined in the base class G4VSolid. 0188 */ 0189 EInside Inside(const G4ThreeVector& p) const override; 0190 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override; 0191 G4double DistanceToIn(const G4ThreeVector& p, 0192 const G4ThreeVector& v) const override; 0193 G4double DistanceToIn(const G4ThreeVector& p) const override; 0194 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v, 0195 const G4bool calcNorm = false, 0196 G4bool* validNorm = nullptr, 0197 G4ThreeVector* n = nullptr) const override; 0198 G4double DistanceToOut(const G4ThreeVector& p) const override; 0199 0200 /** 0201 * Returns the type ID, "G4Para" of the solid. 0202 */ 0203 G4GeometryType GetEntityType() const override; 0204 0205 /** 0206 * Returns a random point located and uniformly distributed on the 0207 * surface of the solid. 0208 */ 0209 G4ThreeVector GetPointOnSurface() const override; 0210 0211 /** 0212 * Returns true as the solid has only planar faces. 0213 */ 0214 G4bool IsFaceted() const override; 0215 0216 /** 0217 * Makes a clone of the object for use in multi-treading. 0218 * @returns A pointer to the new cloned allocated solid. 0219 */ 0220 G4VSolid* Clone() const override; 0221 0222 /** 0223 * Streams the object contents to an output stream. 0224 */ 0225 std::ostream& StreamInfo(std::ostream& os) const override; 0226 0227 /** 0228 * Methods for creating graphical representations (i.e. for visualisation). 0229 */ 0230 void DescribeYourselfTo (G4VGraphicsScene& scene) const override; 0231 G4Polyhedron* CreatePolyhedron () const override; 0232 0233 /** 0234 * Fake default constructor for usage restricted to direct object 0235 * persistency for clients requiring preallocation of memory for 0236 * persistifiable objects. 0237 */ 0238 G4Para(__void__&); 0239 0240 /** 0241 * Copy constructor and assignment operator. 0242 */ 0243 G4Para(const G4Para& rhs); 0244 G4Para& operator=(const G4Para& rhs); 0245 0246 private: 0247 0248 /** 0249 * Checks the dimension parameters given in input. 0250 */ 0251 void CheckParameters(); 0252 0253 /** 0254 * Sets the side planes. 0255 */ 0256 void MakePlanes(); 0257 0258 /** 0259 * Algorithm for SurfaceNormal() following the original specification 0260 * for points not on the surface. 0261 */ 0262 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const; 0263 0264 private: 0265 0266 G4double halfCarTolerance; 0267 G4double fDx,fDy,fDz; 0268 G4double fTalpha,fTthetaCphi,fTthetaSphi; 0269 struct { G4double a,b,c,d; } fPlanes[4]; 0270 }; 0271 0272 #include "G4Para.icc" 0273 0274 #endif 0275 0276 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|