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 Holds data for octree to work on an edges subset.
33 \*---------------------------------------------------------------------------*/
35 #ifndef treeDataEdge_H
36 #define treeDataEdge_H
38 #include "treeBoundBoxList.H"
39 #include "linePointRef.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
47 template<class Type> class indexedOctree;
49 /*---------------------------------------------------------------------------*\
50 Class treeDataEdge Declaration
51 \*---------------------------------------------------------------------------*/
57 //- tolerance on linear dimensions
63 //- Reference to edgeList
64 const edgeList& edges_;
66 //- Reference to points
67 const pointField& points_;
70 const labelList edgeLabels_;
72 //- Whether to precalculate and store face bounding box
75 //- bbs for all above edges (valid only if cacheBb_)
76 treeBoundBoxList bbs_;
79 // Private Member Functions
81 //- Calculate edge bounding box
82 treeBoundBox calcBb(const label edgeI) const;
86 // Declare name of the class and its debug switch
87 ClassName("treeDataEdge");
92 //- Construct from selected edges. !Holds references to edges and points
96 const edgeList& edges,
97 const pointField& points,
98 const labelList& edgeLabels
108 return edgeLabels_.size();
111 //- Get representative point cloud for all shapes inside
112 // (one point per shape)
113 pointField points() const;
118 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
119 // Only makes sense for closed surfaces.
122 const indexedOctree<treeDataEdge>&,
126 //- Does (bb of) shape at index overlap bb
130 const treeBoundBox& sampleBb
133 //- Calculates nearest (to sample) point in shape.
134 // Returns actual point and distance (squared)
137 const labelList& indices,
140 scalar& nearestDistSqr,
145 //- Calculates nearest (to line) point in shape.
146 // Returns point and distance (squared)
149 const labelList& indices,
150 const linePointRef& ln,
152 treeBoundBox& tightest,
158 //- Calculate intersection of shape with ray. Sets result
170 "treeDataEdge::intersects(const label, const point&,"
171 "const point&, point&)"
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace Foam
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 // ************************************************************************* //