source: trunk/source/geometry/solids/specific/include/G4TessellatedGeometryAlgorithms.hh @ 831

Last change on this file since 831 was 831, checked in by garnier, 16 years ago

import all except CVS

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