triangleFuncs.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::triangleFuncs
29
30Description
31 Contains various triangle static functions.
32
33SourceFiles
34 triangleFuncs.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef triangleFuncs_H
39#define triangleFuncs_H
40
41#include "pointField.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48// Forward Declarations
49class treeBoundBox;
50
51/*---------------------------------------------------------------------------*\
52 Class triangleFuncs Declaration
53\*---------------------------------------------------------------------------*/
55class triangleFuncs
56{
57 // Private Member Functions
58
59 //- Sets pt to be anywhere on the edge between oppositeSidePt
60 //- and thisSidePt depending on both signs.
61 // \note Helper function for intersect()
62 static void setIntersection
63 (
64 const point& oppositeSidePt,
65 const scalar oppositeSign,
66 const point& thisSidePt,
67 const scalar thisSign,
68 const scalar tol,
69 point& pt
70 );
71
72public:
73
74 // Static Member Functions
75
76 //- Intersect triangle with parallel edges aligned with axis i0.
77 // Returns true (and intersection in pInter) if any of them intersects
78 // triangle. Used in intersectBb.
79 static bool intersectAxesBundle
80 (
81 const point& V0,
82 const point& V10,
83 const point& V20,
84 const label i0,
85 const pointField& origin,
86 const scalar maxLength,
87 point& pInter
88 );
89
90 //- Intersect triangle with bounding box.
91 // \return true if any bounding box faces intersect the triangle,
92 // returns false if the triangle is inside the bounding box
93 static bool intersectBb
94 (
95 const point& p0,
96 const point& p1,
97 const point& p2,
98 const treeBoundBox& cubeBb
99 );
100
101 //- Intersect triangle with plane.
102 // \return bool and set intersection segment.
103 static bool intersect
104 (
105 const point& va0,
106 const point& va10,
107 const point& va20,
108
109 const point& basePoint,
110 const vector& normal,
111
112 point& pInter0,
113 point& pInter1
114 );
115
116 //- Intersection of two triangles intersect.
117 // \return bool and set intersection segment.
118 static bool intersect
119 (
120 const point& va0,
121 const point& va10,
122 const point& va20,
123
124 const point& vb0,
125 const point& vb10,
126 const point& vb20,
127
128 point& pInter0,
129 point& pInter1
130 );
131};
132
133
134// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136} // End namespace Foam
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140#endif
141
142// ************************************************************************* //
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
Contains various triangle static functions.
Definition: triangleFuncs.H:55
static bool intersectBb(const point &p0, const point &p1, const point &p2, const treeBoundBox &cubeBb)
Intersect triangle with bounding box.
static bool intersect(const point &va0, const point &va10, const point &va20, const point &basePoint, const vector &normal, point &pInter0, point &pInter1)
Intersect triangle with plane.
static bool intersectAxesBundle(const point &V0, const point &V10, const point &V20, const label i0, const pointField &origin, const scalar maxLength, point &pInter)
Intersect triangle with parallel edges aligned with axis i0.
Definition: triangleFuncs.C:68
const volScalarField & p0
Definition: EEqn.H:36
Namespace for OpenFOAM.