1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Various triangle functions.
34 \*---------------------------------------------------------------------------*/
36 #ifndef triangleFuncs_H
37 #define triangleFuncs_H
42 #include "pointField.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
52 /*---------------------------------------------------------------------------*\
53 Class triangleFuncs Declaration
54 \*---------------------------------------------------------------------------*/
63 //- Enumeration defining nearness classification
74 // Private Member Functions
76 //- Helper function for intersect. Sets pt to be anywhere on the edge
77 // between oppositeSidePt and thisSidePt depending on both signs.
78 static void setIntersection
80 const point& oppositeSidePt,
81 const scalar oppositeSign,
82 const point& thisSidePt,
83 const scalar thisSign,
99 //- Intersect triangle with parallel edges aligned with axis i0.
100 // Returns true (and intersection in pInter) if any of them intersects
101 // triangle. Used in intersectBb.
102 static bool intersectAxesBundle
108 const pointField& origin,
109 const scalar maxLength,
113 //- Does triangle intersect bounding box.
114 static bool intersectBb
119 const treeBoundBox& cubeBb
122 //- Does triangle intersect plane. Return bool and set intersection segment.
123 static bool intersect
129 const point& basePoint,
130 const vector& normal,
136 //- Do triangles intersect. Return bool and set intersection segment.
137 static bool intersect
152 //- Classify point on triangle plane w.r.t. triangle edges.
153 // - inside/outside (returned)
154 // - near point (0, 1, 2)
155 // - near edge (0, 1, 2). Note: edges are counted from starting vertex
156 // so e.g. edge 2 is from f[2] to f[0]
159 const point& baseVertex,
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 } // End namespace Foam
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 // ************************************************************************* //