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