![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 intersection 00027 00028 \*---------------------------------------------------------------------------*/ 00029 00030 #ifndef intersection_H 00031 #define intersection_H 00032 00033 #include "scalar.H" 00034 #include "NamedEnum.H" 00035 00036 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00037 00038 namespace Foam 00039 { 00040 00041 /*---------------------------------------------------------------------------*\ 00042 Class intersection Declaration 00043 \*---------------------------------------------------------------------------*/ 00044 00045 class intersection 00046 { 00047 private: 00048 00049 // Static data 00050 00051 //- Relative tolerance for point in a plane. 00052 // The tolerance is relative to the object size. 00053 // Used to determine if a half-ray from a point in plane of triangle 00054 // intersects the triangle or not. 00055 static scalar planarTol_; 00056 00057 public: 00058 00059 enum direction 00060 { 00061 VECTOR, 00062 CONTACT_SPHERE 00063 }; 00064 00065 enum algorithm 00066 { 00067 FULL_RAY, // Intersecting with full ray 00068 HALF_RAY, // Intersecting with half ray 00069 VISIBLE // Intersecting with the visible side 00070 }; 00071 00072 // Static member functions 00073 00074 //- Direction names 00075 static const NamedEnum<direction, 2> directionNames_; 00076 00077 //- Projection algorithm names 00078 static const NamedEnum<algorithm, 3> algorithmNames_; 00079 00080 //- Return planar tolerance 00081 static scalar planarTol() 00082 { 00083 return planarTol_; 00084 } 00085 00086 //- Set the planar tolerance, returning the previous value 00087 static scalar setPlanarTol(const scalar t) 00088 { 00089 if (t < -VSMALL) 00090 { 00091 FatalErrorIn 00092 ( 00093 "scalar intersection::setPlanarTol(const scalar t)" 00094 ) << "Negative planar tolerance. This is not allowed." 00095 << abort(FatalError); 00096 } 00097 00098 scalar oldTol = planarTol_; 00099 planarTol_ = t; 00100 00101 return oldTol; 00102 } 00103 }; 00104 00105 00106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00107 00108 } // End namespace Foam 00109 00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00111 00112 #endif 00113 00114 // ************************************************************************* //