1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
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
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/>.
25 Foam::treeDataTriSurface
28 Encapsulates data for (indexedOc)tree searches on triSurface.
33 \*---------------------------------------------------------------------------*/
35 #ifndef treeDataTriSurface_H
36 #define treeDataTriSurface_H
38 #include "triSurface.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Forward declaration of classes
47 class treeDataTriSurface;
48 template<class Type> class indexedOctree;
50 /*---------------------------------------------------------------------------*\
51 Class treeDataTriSurface Declaration
52 \*---------------------------------------------------------------------------*/
54 class treeDataTriSurface
58 //- Reference to triSurface
59 const triSurface& surface_;
61 //- Tolerance to use for intersection tests
62 const scalar planarTol_;
64 // Private Member Functions
66 // //- fast triangle nearest point calculation. Returns point in E0, E1
67 // // coordinate system: base + s*E0 + t*E1
68 // static scalar nearestCoords
83 // Declare name of the class and its debug switch
84 ClassName("treeDataTriSurface");
89 //- Construct from triSurface and tolerance for intersection
90 // tests. Holds reference.
91 treeDataTriSurface(const triSurface&, const scalar planarTol);
98 inline const triSurface& surface() const
103 inline label size() const
105 return surface_.size();
108 //- Get representative point cloud for all shapes inside
109 // (one point per shape)
110 pointField shapePoints() const;
115 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
116 // Only makes sense for closed surfaces.
119 const indexedOctree<treeDataTriSurface>&,
123 //- Does (bb of) shape at index overlap bb
127 const treeBoundBox& sampleBb
130 //- Calculates nearest (to sample) point in shape.
131 // Returns actual point and distance (squared)
134 const labelUList& indices,
137 scalar& nearestDistSqr,
142 //- Calculates nearest (to line) point in shape.
143 // Returns point and distance (squared)
146 const labelUList& indices,
147 const linePointRef& ln,
149 treeBoundBox& tightest,
155 //- Calculate intersection of triangle with ray. Sets result
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace Foam
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 // ************************************************************************* //