1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Holds (reference to) pointField. Encapsulation of data needed for
31 Used for searching for nearest point. No bounding boxes around points.
32 Only overlaps and calcNearest are implemented, rest makes little sense.
37 \*---------------------------------------------------------------------------*/
39 #ifndef treeDataPoint_H
40 #define treeDataPoint_H
42 #include "pointField.H"
43 #include "treeBoundBox.H"
44 #include "linePointRef.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of classes
52 template<class Type> class indexedOctree;
54 /*---------------------------------------------------------------------------*\
55 Class treeDataPoint Declaration
56 \*---------------------------------------------------------------------------*/
62 const pointField& points_;
66 // Declare name of the class and its debug switch
67 ClassName("treeDataPoint");
72 //- Construct from components. Holds reference to points!
73 treeDataPoint(const pointField& points);
82 return points_.size();
85 //- Get representative point cloud for all shapes inside
86 // (one point per shape)
87 pointField points() const;
92 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
93 // Only makes sense for closed surfaces.
96 const indexedOctree<treeDataPoint>&,
100 //- Does (bb of) shape at index overlap bb
104 const treeBoundBox& sampleBb
107 //- Calculates nearest (to sample) point in shape.
108 // Returns actual point and distance (squared)
111 const labelList& indices,
114 scalar& nearestDistSqr,
119 //- Calculates nearest (to line) point in shape.
120 // Returns point and distance (squared)
123 const labelList& indices,
124 const linePointRef& ln,
126 treeBoundBox& tightest,
132 //- Calculate intersection of shape with ray. Sets result
144 "treeDataPoint::intersects(const label, const point&,"
145 "const point&, point&)"
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 // ************************************************************************* //