00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::intersection 00026 00027 Description 00028 Foam::intersection 00029 00030 SourceFiles 00031 intersection.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef intersection_H 00036 #define intersection_H 00037 00038 #include <OpenFOAM/scalar.H> 00039 #include <OpenFOAM/NamedEnum.H> 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 /*---------------------------------------------------------------------------*\ 00047 Class intersection Declaration 00048 \*---------------------------------------------------------------------------*/ 00049 00050 class intersection 00051 { 00052 private: 00053 00054 // Static data 00055 00056 //- Relative tolerance for point in a plane. 00057 // The tolerance is relative to the object size. 00058 // Used to determine if a half-ray from a point in plane of triangle 00059 // intersects the triangle or not. 00060 static scalar planarTol_; 00061 00062 public: 00063 00064 enum direction 00065 { 00066 VECTOR, 00067 CONTACT_SPHERE 00068 }; 00069 00070 enum algorithm 00071 { 00072 FULL_RAY, // Intersecting with full ray 00073 HALF_RAY, // Intersecting with half ray 00074 VISIBLE // Intersecting with the visible side 00075 }; 00076 00077 // Static member functions 00078 00079 //- Direction names 00080 static const NamedEnum<direction, 2> directionNames_; 00081 00082 //- Projection algorithm names 00083 static const NamedEnum<algorithm, 3> algorithmNames_; 00084 00085 //- Return planar tolerance 00086 static scalar planarTol() 00087 { 00088 return planarTol_; 00089 } 00090 00091 //- Set the planar tolerance, returning the previous value 00092 static scalar setPlanarTol(const scalar t) 00093 { 00094 if (t < -VSMALL) 00095 { 00096 FatalErrorIn 00097 ( 00098 "scalar intersection::setPlanarTol(const scalar t)" 00099 ) << "Negative planar tolerance. This is not allowed." 00100 << abort(FatalError); 00101 } 00102 00103 scalar oldTol = planarTol_; 00104 planarTol_ = t; 00105 00106 return oldTol; 00107 } 00108 }; 00109 00110 00111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00112 00113 } // End namespace Foam 00114 00115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00116 00117 #endif 00118 00119 // ************************ vim: set sw=4 sts=4 et: ************************ //