octreeDataTriSurfaceTreeLeaf.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
00028
00029 #include "octreeDataTriSurfaceTreeLeaf.H"
00030 #include "octreeDataTriSurface.H"
00031
00032
00033
00034 template<>
00035 bool Foam::treeLeaf<Foam::octreeDataTriSurface>::findNearest
00036 (
00037 const octreeDataTriSurface& shapes,
00038 const point& sample,
00039 treeBoundBox& tightest,
00040 label& tightestI,
00041 scalar& tightestDist
00042 ) const
00043 {
00044
00045 const treeBoundBoxList& allBb = shapes.allBb();
00046 point& min = tightest.min();
00047 point& max = tightest.max();
00048
00049 point nearest;
00050
00051 bool changed = false;
00052 forAll(indices_, i)
00053 {
00054 label faceI = indices_[i];
00055
00056
00057 if (tightest.overlaps(allBb[faceI]))
00058 {
00059
00060 scalar dist = shapes.calcNearest(faceI, sample, nearest);
00061
00062 if (dist < tightestDist)
00063 {
00064
00065 min.x() = sample.x() - dist;
00066 min.y() = sample.y() - dist;
00067 min.z() = sample.z() - dist;
00068
00069 max.x() = sample.x() + dist;
00070 max.y() = sample.y() + dist;
00071 max.z() = sample.z() + dist;
00072
00073 tightestI = faceI;
00074 tightestDist = dist;
00075
00076 changed = true;
00077 }
00078 }
00079 }
00080 return changed;
00081 }
00082
00083
00084
Copyright © 2000-2009 OpenCFD Ltd