00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // ---------------------------------------------------------------------- 00030 // Class G4BoundingBox3D 00031 // 00032 // Class description: 00033 // 00034 // Definition of a generic solid's bounding box in the 3D space. 00035 00036 // Authors: J.Sulkimo, P.Urban. 00037 // Revisions by: L.Broglia, G.Cosmo. 00038 // ---------------------------------------------------------------------- 00039 #ifndef __G4BoundingBox3D_h 00040 #define __G4BoundingBox3D_h 1 00041 00042 #include "G4Ray.hh" 00043 #include "G4Point3D.hh" 00044 #include "G4Vector3D.hh" 00045 00046 class G4BoundingBox3D 00047 { 00048 00049 public: // with description 00050 00051 G4BoundingBox3D(); 00052 G4BoundingBox3D(const G4Point3D&); 00053 G4BoundingBox3D(const G4Point3D&, const G4Point3D&); 00054 ~G4BoundingBox3D(); 00055 // Constructors & destructor. 00056 00057 G4BoundingBox3D(const G4BoundingBox3D& right); 00058 G4BoundingBox3D& operator=(const G4BoundingBox3D& right); 00059 // Copy constructor and assignment operator. 00060 00061 void Init(const G4Point3D&); 00062 void Init(const G4Point3D&, const G4Point3D&); 00063 void Extend(const G4Point3D&); 00064 // To create/extend the bounding box 00065 00066 G4Point3D GetBoxMin() const; 00067 G4Point3D GetBoxMax() const; 00068 G4double GetDistance() const; 00069 void SetDistance(G4double distance0); 00070 // Accessors. 00071 00072 G4int Inside(const G4Point3D&) const; 00073 // Returns 1 if the point is inside and on the bbox. 00074 // Returns 0 if the point is outside the bbox. 00075 00076 public: 00077 00078 G4int GetTestResult() const; 00079 G4int Test(const G4Ray&); 00080 00081 static const G4BoundingBox3D space; 00082 00083 private: 00084 00085 G4int BoxIntersect(const G4Point3D&, 00086 const G4Point3D&, 00087 const G4Vector3D&) const; 00088 00089 G4double DistanceToIn(const G4Point3D&, 00090 const G4Vector3D&) const; 00091 00092 private: 00093 00094 G4Point3D box_min; 00095 G4Point3D box_max; 00096 G4double distance; 00097 00098 G4int test_result; 00099 00100 G4Point3D MiddlePoint; 00101 G4Vector3D GeantBox; 00102 G4double kCarTolerance; 00103 }; 00104 00105 #include "G4BoundingBox3D.icc" 00106 00107 #endif