Geant4  10.01.p02
UTessellatedGeometryAlgorithms.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
6 //
7 // $Id:$
8 //
9 // --------------------------------------------------------------------
10 //
11 // UTessellatedGeometryAlgorithms
12 //
13 // Class description:
14 //
15 // The UTessellatedGeometryAlgorithms class is used to contain standard
16 // routines to determine whether (and if so where) simple geometric shapes
17 // intersect.
18 //
19 // The constructor doesn't need to do anything, and neither does the
20 // destructor.
21 //
22 // IntersectLineAndTriangle2D
23 // Determines whether there is an intersection between a line defined
24 // by r = p + s.v and a triangle defined by verticies P0, P0+E0 and P0+E1.
25 // Here:
26 // p = 2D vector
27 // s = scaler on [0,infinity)
28 // v = 2D vector
29 // P0, E0 and E1 are 2D vectors
30 // Information about where the intersection occurs is returned in the
31 // variable location.
32 //
33 // IntersectLineAndLineSegment2D
34 // Determines whether there is an intersection between a line defined
35 // by r = P0 + s.D0 and a line-segment with endpoints P1 and P1+D1.
36 // Here:
37 // P0 = 2D vector
38 // s = scaler on [0,infinity)
39 // D0 = 2D vector
40 // P1 and D1 are 2D vectors
41 // Information about where the intersection occurs is returned in the
42 // variable location.
43 //
44 // 11.07.12 Marek Gayer
45 // Created from original implementation in Geant4
46 // --------------------------------------------------------------------
47 
48 #ifndef UTessellatedGeometryAlgorithms_hh
49 #define UTessellatedGeometryAlgorithms_hh 1
50 
51 #include "UVector2.hh"
52 
54 {
55  public:
56 
57  static bool IntersectLineAndTriangle2D(const UVector2& p,
58  const UVector2& v,
59  const UVector2& p0,
60  const UVector2& e0,
61  const UVector2& e1,
62  UVector2 location[2]);
63 
64  static int IntersectLineAndLineSegment2D(const UVector2& p0,
65  const UVector2& d0,
66  const UVector2& p1,
67  const UVector2& d1,
68  UVector2 location[2]);
69 
70  static double Cross(const UVector2& v1, const UVector2& v2);
71 
72 };
73 
74 #endif
static const G4double d1
static bool IntersectLineAndTriangle2D(const UVector2 &p, const UVector2 &v, const UVector2 &p0, const UVector2 &e0, const UVector2 &e1, UVector2 location[2])
static double Cross(const UVector2 &v1, const UVector2 &v2)
const G4double p1
static int IntersectLineAndLineSegment2D(const UVector2 &p0, const UVector2 &d0, const UVector2 &p1, const UVector2 &d1, UVector2 location[2])
static const G4double e1
const G4double p0