Encapsulates data for (indexedOc)tree searches on triSurface. More...
#include <meshTools/treeDataTriSurface.H>
Encapsulates data for (indexedOc)tree searches on triSurface.
Definition at line 54 of file treeDataTriSurface.H.
Public Member Functions | |
ClassName ("treeDataTriSurface") | |
treeDataTriSurface (const triSurface &) | |
Construct from triSurface. Holds reference.
| |
const triSurface & | surface () const |
label | size () const |
pointField | points () const |
Get representative point cloud for all shapes inside.
| |
label | getVolumeType (const indexedOctree< treeDataTriSurface > &, const point &) const |
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
| |
bool | overlaps (const label index, const treeBoundBox &sampleBb) const |
Does (bb of) shape at index overlap bb.
| |
void | findNearest (const labelList &indices, const point &sample, scalar &nearestDistSqr, label &nearestIndex, point &nearestPoint) const |
Calculates nearest (to sample) point in shape.
| |
void | findNearest (const labelList &indices, const linePointRef &ln, treeBoundBox &tightest, label &minIndex, point &linePoint, point &nearestPoint) const |
Calculates nearest (to line) point in shape.
| |
bool | intersects (const label index, const point &start, const point &end, point &result) const |
Calculate intersection of triangle with ray. Sets result.
|
treeDataTriSurface | ( | const triSurface & | surface ) |
Construct from triSurface. Holds reference.
Definition at line 182 of file treeDataTriSurface.C.
ClassName | ( | "treeDataTriSurface" | ) |
const triSurface& surface | ( | ) | const [inline]
|
Definition at line 94 of file treeDataTriSurface.H.
label size | ( | ) | const [inline]
|
Definition at line 99 of file treeDataTriSurface.H.
References List< T >::size().
Foam::pointField points | ( | ) | const |
Get representative point cloud for all shapes inside.
(one point per shape)
Definition at line 190 of file treeDataTriSurface.C.
Foam::label getVolumeType | ( | const indexedOctree< treeDataTriSurface > & | tree, |
const point & | sample | ||
) | const |
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
Get type of sample (inside/outside/mixed) w.r.t. surface.
Only makes sense for closed surfaces.
Definition at line 206 of file treeDataTriSurface.C.
References Foam::abort(), indexedOctree< Type >::bb(), Foam::FatalError, FatalErrorIn, PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), triSurfaceTools::INSIDE, Foam::magSqr(), Foam::max(), triSurfaceTools::OUTSIDE, indexedOctree< Type >::perturbTol(), boundBox::span(), Foam::sqr(), triSurfaceTools::surfaceSide(), and triSurfaceTools::UNKNOWN.
bool overlaps | ( | const label | index, |
const treeBoundBox & | sampleBb | ||
) | const |
Does (bb of) shape at index overlap bb.
For testing: robust one
return cubeBb.overlaps(triBb);
Exact test of triangle intersecting bb
Definition at line 265 of file treeDataTriSurface.C.
References treeBoundBox::contains(), f(), triangleFuncs::intersectBb(), Foam::max(), boundBox::max(), Foam::min(), boundBox::min(), treeBoundBox::overlaps(), and points.
void findNearest | ( | const labelList & | indices, |
const linePointRef & | ln, | ||
treeBoundBox & | tightest, | ||
label & | minIndex, | ||
point & | linePoint, | ||
point & | nearestPoint | ||
) | const |
Calculates nearest (to line) point in shape.
Returns point and distance (squared)
Definition at line 398 of file treeDataTriSurface.C.
References notImplemented.
Calculate intersection of triangle with ray. Sets result.
accordingly
Using exact intersections
pointHit info = f.tri(points).intersectionExact(start, end);
if (info.hit()) { intersectionPoint = info.hitPoint(); } return info.hit();
Definition at line 417 of file treeDataTriSurface.C.
References PointHit< Point >::distance(), f(), intersection::HALF_RAY, PointHit< Point >::hit(), PointHit< Point >::hitPoint(), triangle< Point, PointRef >::intersection(), Foam::max(), boundBox::max(), Foam::min(), boundBox::min(), points, and treeBoundBox::posBits().