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 and of QinetiQ Ltd, * |
---|
20 | // * subject to DEFCON 705 IPR conditions. * |
---|
21 | // * By using, copying, modifying or distributing the software (or * |
---|
22 | // * any work based on the software) you agree to acknowledge its * |
---|
23 | // * use in resulting scientific publications, and indicate your * |
---|
24 | // * acceptance of all terms of the Geant4 Software license. * |
---|
25 | // ******************************************************************** |
---|
26 | // |
---|
27 | // $Id: |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
31 | // |
---|
32 | // MODULE: G4TessellatedGeometryAlgorithms.hh |
---|
33 | // |
---|
34 | // Date: 07/08/2005 |
---|
35 | // Author: Rickard Holmberg & Pete Truscott |
---|
36 | // Organisation: QinetiQ Ltd, UK (PT) |
---|
37 | // Customer: ESA-ESTEC / TEC-EES |
---|
38 | // Contract: |
---|
39 | // |
---|
40 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
41 | // |
---|
42 | // CHANGE HISTORY |
---|
43 | // -------------- |
---|
44 | // |
---|
45 | // 07 August 2007, P R Truscott, QinetiQ Ltd, UK - Created, with member |
---|
46 | // functions based on the work of Rickard Holmberg. |
---|
47 | // |
---|
48 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
49 | // |
---|
50 | // Class description: |
---|
51 | // |
---|
52 | // The G4TessellatedGeometryAlgorithms class is used to contain standard |
---|
53 | // routines to determine whether (and if so where) simple geometric shapes |
---|
54 | // intersect. |
---|
55 | // |
---|
56 | // The constructor doesn't need to do anything, and neither does the |
---|
57 | // destructor. |
---|
58 | // |
---|
59 | // IntersectLineAndTriangle2D |
---|
60 | // Determines whether there is an intersection between a line defined |
---|
61 | // by r = p + s.v and a triangle defined by verticies P0, P0+E0 and P0+E1. |
---|
62 | // Here: |
---|
63 | // p = 2D vector |
---|
64 | // s = scaler on [0,infinity) |
---|
65 | // v = 2D vector |
---|
66 | // P0, E0 and E1 are 2D vectors |
---|
67 | // Information about where the intersection occurs is returned in the |
---|
68 | // variable location. |
---|
69 | // |
---|
70 | // IntersectLineAndLineSegment2D |
---|
71 | // Determines whether there is an intersection between a line defined |
---|
72 | // by r = P0 + s.D0 and a line-segment with endpoints P1 and P1+D1. |
---|
73 | // Here: |
---|
74 | // P0 = 2D vector |
---|
75 | // s = scaler on [0,infinity) |
---|
76 | // D0 = 2D vector |
---|
77 | // P1 and D1 are 2D vectors |
---|
78 | // Information about where the intersection occurs is returned in the |
---|
79 | // variable location. |
---|
80 | |
---|
81 | /////////////////////////////////////////////////////////////////////////////// |
---|
82 | #ifndef G4TessellatedGeometryAlgorithms_hh |
---|
83 | #define G4TessellatedGeometryAlgorithms_hh 1 |
---|
84 | |
---|
85 | #include "globals.hh" |
---|
86 | #include "G4TwoVector.hh" |
---|
87 | |
---|
88 | class G4TessellatedGeometryAlgorithms |
---|
89 | { |
---|
90 | public: // with description |
---|
91 | |
---|
92 | static G4TessellatedGeometryAlgorithms* GetInstance(); |
---|
93 | G4bool IntersectLineAndTriangle2D (const G4TwoVector p, |
---|
94 | const G4TwoVector v, |
---|
95 | const G4TwoVector P0, |
---|
96 | const G4TwoVector E0, |
---|
97 | const G4TwoVector E1, |
---|
98 | G4TwoVector location[2]); |
---|
99 | |
---|
100 | G4int IntersectLineAndLineSegment2D (const G4TwoVector P0, |
---|
101 | const G4TwoVector D0, |
---|
102 | const G4TwoVector P1, |
---|
103 | const G4TwoVector D1, |
---|
104 | G4TwoVector location[2]); |
---|
105 | |
---|
106 | inline G4double cross(const G4TwoVector v1, const G4TwoVector v2) const; |
---|
107 | |
---|
108 | protected: |
---|
109 | |
---|
110 | G4TessellatedGeometryAlgorithms(); |
---|
111 | |
---|
112 | private: |
---|
113 | |
---|
114 | static G4TessellatedGeometryAlgorithms *fInstance; |
---|
115 | }; |
---|
116 | |
---|
117 | #include "G4TessellatedGeometryAlgorithms.icc" |
---|
118 | |
---|
119 | #endif |
---|