Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "octreeDataPoint.H"
00027
00028 #include <OpenFOAM/labelList.H>
00029 #include "treeBoundBox.H"
00030 #include "octree.H"
00031 #include <OpenFOAM/linePointRef.H>
00032 #include <OpenFOAM/pointHit.H>
00033
00034
00035
00036
00037 Foam::octreeDataPoint::octreeDataPoint(const pointField& points)
00038 :
00039 points_(points)
00040 {}
00041
00042
00043
00044
00045
00046 Foam::label Foam::octreeDataPoint::getSampleType
00047 (
00048 const octree<octreeDataPoint>&,
00049 const point&
00050 ) const
00051 {
00052 return octree<octreeDataPoint>::UNKNOWN;
00053 }
00054
00055
00056 bool Foam::octreeDataPoint::overlaps
00057 (
00058 const label index,
00059 const treeBoundBox& sampleBb
00060 ) const
00061 {
00062 return sampleBb.contains(points_[index]);
00063 }
00064
00065
00066 bool Foam::octreeDataPoint::contains
00067 (
00068 const label,
00069 const point&
00070 ) const
00071 {
00072 notImplemented
00073 (
00074 "octreeDataPoint::contains(const label, const point&)"
00075 );
00076
00077 return false;
00078 }
00079
00080
00081 bool Foam::octreeDataPoint::intersects
00082 (
00083 const label,
00084 const point&,
00085 const point&,
00086 point&
00087 ) const
00088 {
00089 notImplemented
00090 (
00091 "octreeDataPoint::intersects(const label, const point&,"
00092 "const point&, point&)"
00093 );
00094
00095 return false;
00096 }
00097
00098
00099 bool Foam::octreeDataPoint::findTightest
00100 (
00101 const label,
00102 const point&,
00103 treeBoundBox&
00104 ) const
00105 {
00106 notImplemented
00107 (
00108 "octreeDataPoint::findTightest(const label, const point&,"
00109 "treeBoundBox&)"
00110 );
00111
00112 return false;
00113 }
00114
00115
00116 Foam::scalar Foam::octreeDataPoint::calcSign
00117 (
00118 const label,
00119 const point&,
00120 vector& n
00121 ) const
00122 {
00123 n = vector::zero;
00124
00125 return 1;
00126 }
00127
00128
00129
00130 inline Foam::scalar Foam::octreeDataPoint::calcNearest
00131 (
00132 const label index,
00133 const point& sample,
00134 point& nearest
00135 ) const
00136 {
00137 nearest = points_[index];
00138 return magSqr(points_[index] - sample);
00139 }
00140
00141
00142 void Foam::octreeDataPoint::write
00143 (
00144 Ostream& os,
00145 const label index
00146 ) const
00147 {
00148 if ((index < 0) || (index > points().size()))
00149 {
00150 FatalErrorIn("octreeDataPoint::write(Ostream&, const label)")
00151 << "Index " << index << " outside 0.." << points().size()
00152 << abort(FatalError);
00153 }
00154 os << ' ' << points()[index];
00155 }
00156
00157
00158
00159 Foam::scalar Foam::octreeDataPoint::calcNearest
00160 (
00161 const label index,
00162 const linePointRef& ln,
00163 point& linePt,
00164 point& shapePt
00165 ) const
00166 {
00167
00168 shapePt = points_[index];
00169
00170
00171 pointHit pHit = ln.nearestDist(shapePt);
00172
00173 linePt = pHit.rawPoint();
00174
00175 return pHit.distance();
00176 }
00177
00178
00179
00180
00181 Foam::Ostream& Foam::operator<<
00182 (
00183 Foam::Ostream& os,
00184 const Foam::octreeDataPoint& ocPts
00185 )
00186 {
00187 return os << ocPts.points();
00188 }
00189
00190
00191