42 Foam::scalar Foam::treeDataTriSurface::nearestCoords
59 const scalar
d = E0 & D;
60 const scalar
e = E1 & D;
63 const scalar
det = a*c - b*
b;
79 s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
85 t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
92 t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
99 s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
104 const scalar invDet = 1/
det;
114 const scalar tmp0 = b +
d;
115 const scalar tmp1 = c +
e;
119 const scalar numer = tmp1 - tmp0;
120 const scalar denom = a-2*b+c;
121 s = (numer >= denom ? 1 : numer/denom);
128 t = (tmp1 <= 0 ? 1 : (e >= 0 ? 0 : - e/c));
134 const scalar tmp0 = b +
d;
135 const scalar tmp1 = c +
e;
139 const scalar numer = tmp1 - tmp0;
140 const scalar denom = a-2*b+c;
141 s = (numer >= denom ? 1 : numer/denom);
148 s = (tmp1 <= 0 ? 1 : (d >= 0 ? 0 : - d/a));
154 const scalar numer = c+e-(b+
d);
161 const scalar denom = a-2*b+c;
162 s = (numer >= denom ? 1 : numer/denom);
174 const scalar
f = D & D;
175 return Foam::mag(a*s*s + 2*b*s*t + c*t*t + 2*d*s + 2*e*t + f);
198 centres[triI] = surface_[triI].centre(points);
227 <<
"treeBb:" << treeBb
228 <<
" sample:" << sample
274 const point& p0 = points[f[0]];
275 const point& p1 = points[f[1]];
276 const point& p2 = points[f[2]];
319 scalar& nearestDistSqr,
328 label index = indices[i];
332 const point& p0 = points[f[0]];
333 const point& p1 = points[f[1]];
334 const point& p2 = points[f[2]];
370 scalar distSqr = nearestCoords
384 if (distSqr < nearestDistSqr)
386 nearestDistSqr = distSqr;
388 nearestPoint = base + s*E0 + t*E1;
410 "treeDataTriSurface::findNearest(const labelList&"
411 ", const linePointRef&, treeBoundBox&, label&, point&, point&) const"
421 point& intersectionPoint
430 triBb.
min() =
min(triBb.
min(), points[f[1]]);
431 triBb.
max() =
max(triBb.
max(), points[f[1]]);
432 triBb.
min() =
min(triBb.
min(), points[f[2]]);
433 triBb.
max() =
max(triBb.
max(), points[f[2]]);
438 if ((startBits & endBits) != 0)
444 const triPointRef tri(points[f[0]], points[f[1]], points[f[2]]);
446 const vector dir(end - start);
462 intersectionPoint = inter.
hitPoint();