|
|
|||
File indexing completed on 2026-09-26 08:57:35
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 // G4VoxelLimits 0027 // 0028 // Class description: 0029 // 0030 // Represents limitation/restrictions of space, where restrictions 0031 // are only made perpendicular to the cartesian axes. 0032 // 0033 // Member data: 0034 // 0035 // G4double fxAxisMin,fxAxisMax 0036 // G4double fyAxisMin,fyAxisMax 0037 // G4double fzAxisMin,fzAxisMax 0038 // - The min and max values along each axis. +-kInfinity if not restricted. 0039 0040 // Author: Paul Kent (CERN), 13.07.1995 - Initial version. 0041 // -------------------------------------------------------------------- 0042 #ifndef G4VOXELLIMITS_HH 0043 #define G4VOXELLIMITS_HH 0044 0045 #include "G4Types.hh" 0046 #include "geomdefs.hh" 0047 0048 #include "G4ThreeVector.hh" 0049 0050 #include <assert.h> 0051 0052 /** 0053 * @brief G4VoxelLimits represents limitation/restrictions of space, where 0054 * restrictions are only made perpendicular to the Cartesian axes. 0055 */ 0056 0057 class G4VoxelLimits 0058 { 0059 public: 0060 0061 /** 0062 * Default Constructor & Destructor. 0063 * Constructor initialises to be unlimited. Volume unrestricted. 0064 */ 0065 G4VoxelLimits() = default; 0066 ~G4VoxelLimits() = default; 0067 0068 /** 0069 * Restricts the volume to between specified min and max along the 0070 * given axis. Cartesian axes only, pMin<=pMax. 0071 */ 0072 void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax); 0073 0074 /** 0075 * Accessors for max extent 0076 */ 0077 G4double GetMaxXExtent() const; 0078 G4double GetMaxYExtent() const; 0079 G4double GetMaxZExtent() const; 0080 0081 /** 0082 * Accessors for min extent 0083 */ 0084 G4double GetMinXExtent() const; 0085 G4double GetMinYExtent() const; 0086 G4double GetMinZExtent() const; 0087 0088 /** 0089 * Accessors for the extent of the volume along the specified axis. 0090 */ 0091 G4double GetMaxExtent(const EAxis pAxis) const; 0092 G4double GetMinExtent(const EAxis pAxis) const; 0093 0094 /** 0095 * Return true if the X/Y/Z axis is limited. 0096 */ 0097 G4bool IsXLimited() const; 0098 G4bool IsYLimited() const; 0099 G4bool IsZLimited() const; 0100 0101 /** 0102 * Return true if limited along any axis. 0103 */ 0104 G4bool IsLimited() const; 0105 0106 /** 0107 * Return true if the specified axis is restricted/limited. 0108 */ 0109 G4bool IsLimited(const EAxis pAxis) const; 0110 0111 /** 0112 * Clips the line segment pStart->pEnd to the volume described by the 0113 * current limits. Returns true if the line remains after clipping, 0114 * else false, and leaves the vectors in an undefined state. 0115 */ 0116 G4bool ClipToLimits(G4ThreeVector& pStart, G4ThreeVector& pEnd) const; 0117 0118 /** 0119 * Returns true if the specified vector is inside/on boundaries of limits. 0120 */ 0121 G4bool Inside(const G4ThreeVector& pVec) const; 0122 0123 /** 0124 * Calculates the 'outcode' for the specified vector. 0125 * Intended for use during clipping against the limits. 0126 * The bits are set given the following conditions: 0127 * 0 pVec.x()<fxAxisMin && IsXLimited() 0128 * 1 pVec.x()>fxAxisMax && IsXLimited() 0129 * 2 pVec.y()<fyAxisMin && IsYLimited() 0130 * 3 pVec.y()>fyAxisMax && IsYLimited() 0131 * 4 pVec.z()<fzAxisMin && IsZLimited() 0132 * 5 pVec.z()>fzAxisMax && IsZLimited() 0133 */ 0134 G4int OutCode(const G4ThreeVector& pVec) const; 0135 0136 private: 0137 0138 G4double fxAxisMin = -kInfinity, fxAxisMax = kInfinity; 0139 G4double fyAxisMin = -kInfinity, fyAxisMax = kInfinity; 0140 G4double fzAxisMin = -kInfinity, fzAxisMax = kInfinity; 0141 }; 0142 0143 /** 0144 * Prints the limits to the stream in the form: 0145 * "{(xmin,xmax) (ymin,ymax) (zmin,zmax)}" 0146 * Replaces (xmin,xmax) by (-,-) when not limited. 0147 */ 0148 std::ostream& operator << (std::ostream& os, const G4VoxelLimits& pLim); 0149 0150 #include "G4VoxelLimits.icc" 0151 0152 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|