Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:09

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration and of QinetiQ Ltd,   *
0020 // * subject to DEFCON 705 IPR conditions.                            *
0021 // * By using,  copying,  modifying or  distributing the software (or *
0022 // * any work based  on the software)  you  agree  to acknowledge its *
0023 // * use  in  resulting  scientific  publications,  and indicate your *
0024 // * acceptance of all terms of the Geant4 Software license.          *
0025 // ********************************************************************
0026 //
0027 // G4TessellatedGeometryAlgorithms
0028 //
0029 // Class description:
0030 //
0031 //   The G4TessellatedGeometryAlgorithms class is used to contain standard
0032 //   routines to determine whether (and if so where) simple geometric shapes
0033 //   intersect.
0034 //   
0035 //   The constructor doesn't need to do anything, and neither does the
0036 //   destructor.
0037 //   
0038 //   IntersectLineAndTriangle2D
0039 //     Determines whether there is an intersection between a line defined
0040 //     by r = p + s.v and a triangle defined by verticies P0, P0+E0 and P0+E1.
0041 //     Here:
0042 //        p = 2D vector
0043 //        s = scaler on [0,infinity)
0044 //        v = 2D vector
0045 //        P0, E0 and E1 are 2D vectors
0046 //     Information about where the intersection occurs is returned in the
0047 //     variable location.
0048 //
0049 //   IntersectLineAndLineSegment2D
0050 //     Determines whether there is an intersection between a line defined
0051 //     by r = P0 + s.D0 and a line-segment with endpoints P1 and P1+D1.
0052 //     Here:
0053 //        P0 = 2D vector
0054 //        s  = scaler on [0,infinity)
0055 //        D0 = 2D vector
0056 //        P1 and D1 are 2D vectors
0057 //     Information about where the intersection occurs is returned in the
0058 //     variable location.
0059 
0060 // 07 August 2007, P R Truscott, QinetiQ Ltd, UK - Created, with member
0061 //                 functions based on the work of Rickard Holmberg.
0062 // 12 October 2012, M Gayer, CERN, - Reviewed optimized implementation.
0063 // --------------------------------------------------------------------
0064 #ifndef G4TESSELLATEDGEOMETRYALGORITHMS_HH
0065 #define G4TESSELLATEDGEOMETRYALGORITHMS_HH 1
0066 
0067 #include "G4TwoVector.hh"
0068 
0069 class G4TessellatedGeometryAlgorithms
0070 {
0071   public:
0072 
0073     static G4bool IntersectLineAndTriangle2D (const G4TwoVector& p,
0074                                               const G4TwoVector& v,
0075                                               const G4TwoVector& p0, 
0076                                               const G4TwoVector& e0,
0077                                               const G4TwoVector& e1,
0078                                                     G4TwoVector location[2]);
0079     static G4int IntersectLineAndLineSegment2D (const G4TwoVector& p0,
0080                                                 const G4TwoVector& d0,
0081                                                 const G4TwoVector& p1,
0082                                                 const G4TwoVector& d1,
0083                                                       G4TwoVector location[2]);
0084     static G4double cross(const G4TwoVector& v1, const G4TwoVector& v2);
0085 };
0086 
0087 #endif