BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / meshTools / triSurface / triangleFuncs / triangleFuncs.H
blobada448cb0b4b5b46063e0cb7191789411d416a22
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::triangleFuncs
27 Description
28     Various triangle functions.
30 SourceFiles
31     triangleFuncs.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef triangleFuncs_H
36 #define triangleFuncs_H
38 #include "point.H"
39 #include "label.H"
40 #include "scalar.H"
41 #include "pointField.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // Forward declaration of classes
49 class treeBoundBox;
51 /*---------------------------------------------------------------------------*\
52                            Class triangleFuncs Declaration
53 \*---------------------------------------------------------------------------*/
55 class triangleFuncs
58 public:
60     // Public data types
62         //- Enumeration defining nearness classification
63         enum proxType
64         {
65             NONE,
66             POINT,
67             EDGE
68         };
71 private:
73     // Private Member Functions
75         //- Helper function for intersect. Sets pt to be anywhere on the edge
76         //  between oppositeSidePt and thisSidePt depending on both signs.
77         static void setIntersection
78         (
79             const point& oppositeSidePt,
80             const scalar oppositeSign,
81             const point& thisSidePt,
82             const scalar thisSign,
83             const scalar tol,
84             point& pt
85         );
87         //- Helper function.
88         static void selectPt
89         (
90             const bool select0,
91             const point& p0,
92             const point& p1,
93             point& min
94         );
96 public:
98     //- Intersect triangle with parallel edges aligned with axis i0.
99     //  Returns true (and intersection in pInter) if any of them intersects
100     //  triangle. Used in intersectBb.
101     static bool intersectAxesBundle
102     (
103         const point& V0,
104         const point& V10,
105         const point& V20,
106         const label i0,
107         const pointField& origin,
108         const scalar maxLength,
109         point& pInter
110     );
112     //- Does triangle intersect bounding box.
113     static bool intersectBb
114     (
115         const point& p0,
116         const point& p1,
117         const point& p2,
118         const treeBoundBox& cubeBb
119     );
121     //- Does triangle intersect plane. Return bool and set intersection segment.
122     static bool intersect
123     (
124         const point& va0,
125         const point& va10,
126         const point& va20,
128         const point& basePoint,
129         const vector& normal,
131         point& pInter0,
132         point& pInter1
133     );
135     //- Do triangles intersect. Return bool and set intersection segment.
136     static bool intersect
137     (
138         const point& va0,
139         const point& va10,
140         const point& va20,
142         const point& vb0,
143         const point& vb10,
144         const point& vb20,
146         point& pInter0,
147         point& pInter1
148     );
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 } // End namespace Foam
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 #endif
160 // ************************************************************************* //