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
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef octreeDataTriSurface_H
00037 #define octreeDataTriSurface_H
00038
00039 #include "treeBoundBoxList.H"
00040 #include "labelList.H"
00041 #include "point.H"
00042 #include "triSurface.H"
00043 #include "linePointRef.H"
00044
00045
00046
00047 namespace Foam
00048 {
00049
00050
00051 template<class Type> class octree;
00052
00053
00054
00055
00056
00057 class octreeDataTriSurface
00058 {
00059
00060
00061
00062 static scalar tol;
00063
00064
00065
00066 const triSurface& surface_;
00067
00068 const treeBoundBoxList allBb_;
00069
00070
00071
00072 pointField base_;
00073 pointField E0_;
00074 pointField E1_;
00075 scalarList a_;
00076 scalarList b_;
00077 scalarList c_;
00078
00079
00080
00081
00082
00083
00084 static void nearestCoords
00085 (
00086 const point& base,
00087 const point& E0,
00088 const point& E1,
00089 const scalar a,
00090 const scalar b,
00091 const scalar c,
00092 const point& P,
00093 scalar& s,
00094 scalar& t
00095 );
00096
00097
00098 static treeBoundBoxList calcBb(const triSurface&);
00099
00100
00101
00102
00103 point nearestPoint(const label index, const point& P) const;
00104
00105 public:
00106
00107
00108 ClassName("octreeDataTriSurface");
00109
00110
00111
00112
00113
00114
00115 octreeDataTriSurface(const triSurface&);
00116
00117
00118
00119 octreeDataTriSurface(const triSurface&, const treeBoundBoxList&);
00120
00121
00122
00123
00124
00125
00126 const triSurface& surface() const
00127 {
00128 return surface_;
00129 }
00130
00131 const treeBoundBoxList& allBb() const
00132 {
00133 return allBb_;
00134 }
00135
00136 label size() const
00137 {
00138 return allBb_.size();
00139 }
00140
00141
00142
00143
00144 label getSampleType
00145 (
00146 const octree<octreeDataTriSurface>&,
00147 const point&
00148 ) const;
00149
00150
00151 bool overlaps
00152 (
00153 const label index,
00154 const treeBoundBox& sampleBb
00155 ) const;
00156
00157
00158 bool contains
00159 (
00160 const label index,
00161 const point& sample
00162 ) const;
00163
00164
00165
00166 bool intersects
00167 (
00168 const label index,
00169 const point& start,
00170 const point& end,
00171 point& intersectionPoint
00172 ) const;
00173
00174
00175
00176
00177 bool findTightest
00178 (
00179 const label index,
00180 const point& sample,
00181 treeBoundBox& tightest
00182 ) const;
00183
00184
00185
00186
00187 scalar calcSign
00188 (
00189 const label index,
00190 const point& sample,
00191 vector& n
00192 ) const;
00193
00194
00195
00196 scalar calcNearest
00197 (
00198 const label index,
00199 const point& sample,
00200 point& nearest
00201 ) const;
00202
00203
00204
00205 scalar calcNearest
00206 (
00207 const label index,
00208 const linePointRef& ln,
00209 point& linePt,
00210 point& shapePt
00211 ) const;
00212
00213
00214
00215
00216
00217 void write(Ostream& os, const label index) const;
00218
00219
00220
00221
00222 friend Istream& operator>>(Istream&, octreeDataTriSurface&);
00223 friend Ostream& operator<<(Ostream&, const octreeDataTriSurface&);
00224 };
00225
00226
00227
00228
00229 }
00230
00231
00232
00233
00234 #endif
00235
00236