1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Implementation of the triangle intersection algorithm
32 University of Massachusetts Amherst
38 \*---------------------------------------------------------------------------*/
40 #ifndef triIntersection_H
41 #define triIntersection_H
46 #include "FixedList.H"
47 #include "DynamicList.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class triIntersection Declaration
56 \*---------------------------------------------------------------------------*/
62 //- Const reference to clipping triangle
63 const FixedList<point, 3>& clipTri_;
65 //- Clip triangle normal
68 //- Hessian-normal plane definition
69 typedef Tuple2<vector, scalar> hPlane;
71 FixedList<hPlane, 3> clipPlanes_;
73 //- Triangles used as temporaries
74 DynamicList<FixedList<point, 3> > inside_;
76 //- All intersection tris
77 DynamicList<FixedList<point, 3> > allTris_;
79 // Private Member Functions
81 //- Disallow default bitwise copy construct
82 triIntersection(const triIntersection&);
84 //- Disallow default bitwise assignment
85 void operator=(const triIntersection&);
87 //- Compute clip-planes
88 inline void computeClipPlanes();
90 //- Split and decompose
91 inline void splitAndDecompose
93 const label triPlaneIndex,
94 FixedList<point, 3>& tri,
95 DynamicList<FixedList<point, 3> >& decompTris
102 //- Construct from components
103 inline triIntersection(const FixedList<point, 3>& clipTri);
107 inline ~triIntersection();
111 //- Evaluate for intersections against input triangle
112 inline bool evaluate(const FixedList<point, 3>& subjectTri);
114 //- Return intersections
115 inline const DynamicList<FixedList<point, 3> >& getIntersection() const;
117 //- Evaluate and return area / centroid
118 inline void getAreaAndCentre(scalar& area, vector& centre) const;
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 } // End namespace Foam
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 #include "triIntersectionI.H"
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 // ************************************************************************* //