|
|
|||
File indexing completed on 2026-09-11 09:12:01
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 // Author: P.R.Truscott (QinetiQ Ltd, UK), 07.08.2007 - Created, with member 0061 // functions based on the work of Rickard Holmberg. 0062 // M.Gayer (CERN), 12.10.2012 - Reviewed and optimized implementation. 0063 // -------------------------------------------------------------------- 0064 #ifndef G4TESSELLATEDGEOMETRYALGORITHMS_HH 0065 #define G4TESSELLATEDGEOMETRYALGORITHMS_HH 0066 0067 #include "G4TwoVector.hh" 0068 0069 /** 0070 * @brief G4TessellatedGeometryAlgorithms contains standard methods to 0071 * determine whether (and if so where) simple geometric shapes intersect. 0072 */ 0073 0074 class G4TessellatedGeometryAlgorithms 0075 { 0076 public: 0077 0078 /** 0079 * Determines whether there is an intersection between a line defined 0080 * by r = p + s.v and a triangle defined by vertices p0, p0+e0 and p0+e1. 0081 * @param[in] p Coefficient of line equation. 0082 * @param[in] v Coefficient of line equation. 0083 * @param[in] p0 First vertex of triangle. 0084 * @param[in] e0 Second vertex of triangle. 0085 * @param[in] e1 Third vertex of triangle. 0086 * @param[out] location The returned location of the intersection. 0087 * @returns false if no intersection occours. 0088 */ 0089 static G4bool IntersectLineAndTriangle2D (const G4TwoVector& p, 0090 const G4TwoVector& v, 0091 const G4TwoVector& p0, 0092 const G4TwoVector& e0, 0093 const G4TwoVector& e1, 0094 G4TwoVector location[2]); 0095 0096 /** 0097 * Determines whether there is an intersection between a line defined 0098 * by r = p0 + s.d0 and a line-segment with endpoints p1 and p1+d1. 0099 * @param[in] p0 Coefficient of line equation. 0100 * @param[in] d0 Coefficient of line equation. 0101 * @param[in] p1 First line-segment end-point.. 0102 * @param[in] d1 Delta line-segment end-point. 0103 * @param[out] location The returned location of the intersection. 0104 * @returns false if no intersection occours. 0105 */ 0106 static G4int IntersectLineAndLineSegment2D (const G4TwoVector& p0, 0107 const G4TwoVector& d0, 0108 const G4TwoVector& p1, 0109 const G4TwoVector& d1, 0110 G4TwoVector location[2]); 0111 0112 /** 0113 * Ficticious "cross-product" function for two 2D vectors. 0114 * @param[in] v1 First 2D vector. 0115 * @param[in] v2 Second 2D vector. 0116 * @returns The cross-product of v1 and v2. 0117 */ 0118 static G4double cross(const G4TwoVector& v1, const G4TwoVector& v2); 0119 }; 0120 0121 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|