Encapsulates data for (indexedOc)tree searches on triSurface. More...
Public Member Functions | |
ClassName ("treeDataTriSurface") | |
treeDataTriSurface (const triSurface &) | |
Construct from triSurface. Holds reference. More... | |
const triSurface & | surface () const |
label | size () const |
pointField | points () const |
Get representative point cloud for all shapes inside. More... | |
label | getVolumeType (const indexedOctree< treeDataTriSurface > &, const point &) const |
Get type (inside, outside, mixed, unknown) of point. More... | |
bool | overlaps (const label index, const treeBoundBox &sampleBb) const |
Does (bb of) shape at index overlap bb. More... | |
void | findNearest (const labelList &indices, const point &sample, scalar &nearestDistSqr, label &nearestIndex, point &nearestPoint) const |
Calculates nearest (to sample) point in shape. More... | |
void | findNearest (const labelList &indices, const linePointRef &ln, treeBoundBox &tightest, label &minIndex, point &linePoint, point &nearestPoint) const |
Calculates nearest (to line) point in shape. More... | |
bool | intersects (const label index, const point &start, const point &end, point &result) const |
Calculate intersection of triangle with ray. Sets result. More... | |
Static Private Member Functions | |
static scalar | nearestCoords (const point &base, const point &E0, const point &E1, const scalar a, const scalar b, const scalar c, const point &P, scalar &s, scalar &t) |
fast triangle nearest point calculation. Returns point in E0, E1 More... | |
Private Attributes | |
const triSurface & | surface_ |
Encapsulates data for (indexedOc)tree searches on triSurface.
Encapsulates data for (indexedOc)tree searches on a triSurface.
Definition at line 53 of file treeDataTriSurface.H.
treeDataTriSurface | ( | const triSurface & | surface | ) |
Construct from triSurface. Holds reference.
Definition at line 182 of file treeDataTriSurface.C.
|
staticprivate |
fast triangle nearest point calculation. Returns point in E0, E1
coordinate system: base + s*E0 + t*E1
Definition at line 43 of file treeDataTriSurface.C.
References Foam::constant::physicoChemical::b, Foam::constant::universal::c, Foam::det(), Foam::constant::electromagnetic::e, f(), Foam::mag(), and s().
ClassName | ( | "treeDataTriSurface" | ) |
|
inline |
Definition at line 93 of file treeDataTriSurface.H.
References treeDataTriSurface::surface_.
|
inline |
Definition at line 98 of file treeDataTriSurface.H.
References List::size(), and treeDataTriSurface::surface_.
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.
Get type of sample (inside/outside/mixed) w.r.t. surface.
with respect to a surface. Only makes sense for closed surfaces.
Definition at line 206 of file treeDataTriSurface.C.
References Foam::abort(), indexedOctree::bb(), Foam::FatalError, FatalErrorIn, indexedOctree::findNearest(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), triSurfaceTools::INSIDE, Foam::magSqr(), Foam::max(), triSurfaceTools::OUTSIDE, 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(), boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), treeBoundBox::overlaps(), and points.
void findNearest | ( | const labelList & | indices, |
const point & | sample, | ||
scalar & | nearestDistSqr, | ||
label & | nearestIndex, | ||
point & | nearestPoint | ||
) | const |
Calculates nearest (to sample) point in shape.
Returns actual point and distance (squared)
Definition at line 315 of file treeDataTriSurface.C.
References Foam::constant::physicoChemical::b, Foam::constant::universal::c, f(), forAll, points, and s().
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::distance(), f(), intersection::HALF_RAY, PointHit::hit(), PointHit::hitPoint(), boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), points, and treeBoundBox::posBits().
|
private |
Definition at line 57 of file treeDataTriSurface.H.
Referenced by treeDataTriSurface::size(), and treeDataTriSurface::surface().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.