Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BoundingBox3D.hh
Go to the documentation of this file.
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$
28 //
29 // ----------------------------------------------------------------------
30 // Class G4BoundingBox3D
31 //
32 // Class description:
33 //
34 // Definition of a generic solid's bounding box in the 3D space.
35 
36 // Authors: J.Sulkimo, P.Urban.
37 // Revisions by: L.Broglia, G.Cosmo.
38 // ----------------------------------------------------------------------
39 #ifndef __G4BoundingBox3D_h
40 #define __G4BoundingBox3D_h 1
41 
42 #include "G4Ray.hh"
43 #include "G4Point3D.hh"
44 #include "G4Vector3D.hh"
45 
47 {
48 
49 public: // with description
50 
52  G4BoundingBox3D(const G4Point3D&);
53  G4BoundingBox3D(const G4Point3D&, const G4Point3D&);
55  // Constructors & destructor.
56 
59  // Copy constructor and assignment operator.
60 
61  void Init(const G4Point3D&);
62  void Init(const G4Point3D&, const G4Point3D&);
63  void Extend(const G4Point3D&);
64  // To create/extend the bounding box
65 
66  G4Point3D GetBoxMin() const;
67  G4Point3D GetBoxMax() const;
68  G4double GetDistance() const;
69  void SetDistance(G4double distance0);
70  // Accessors.
71 
72  G4int Inside(const G4Point3D&) const;
73  // Returns 1 if the point is inside and on the bbox.
74  // Returns 0 if the point is outside the bbox.
75 
76 public:
77 
78  G4int GetTestResult() const;
79  G4int Test(const G4Ray&);
80 
81  static const G4BoundingBox3D space;
82 
83 private:
84 
85  G4int BoxIntersect(const G4Point3D&,
86  const G4Point3D&,
87  const G4Vector3D&) const;
88 
89  G4double DistanceToIn(const G4Point3D&,
90  const G4Vector3D&) const;
91 
92 private:
93 
94  G4Point3D box_min;
95  G4Point3D box_max;
96  G4double distance;
97 
98  G4int test_result;
99 
100  G4Point3D MiddlePoint;
101  G4Vector3D GeantBox;
102  G4double kCarTolerance;
103 };
104 
105 #include "G4BoundingBox3D.icc"
106 
107 #endif