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