Public Member Functions | Static Private Member Functions | Private Attributes
treeDataTriSurface Class Reference

Encapsulates data for (indexedOc)tree searches on triSurface. More...

Collaboration diagram for treeDataTriSurface:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("treeDataTriSurface")
 
 treeDataTriSurface (const triSurface &)
 Construct from triSurface. Holds reference. More...
 
const triSurfacesurface () 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 triSurfacesurface_
 

Detailed Description

Encapsulates data for (indexedOc)tree searches on triSurface.

Encapsulates data for (indexedOc)tree searches on a triSurface.

Source files

Source files

Definition at line 53 of file treeDataTriSurface.H.

Constructor & Destructor Documentation

◆ treeDataTriSurface()

treeDataTriSurface ( const triSurface surface)

Construct from triSurface. Holds reference.

Definition at line 182 of file treeDataTriSurface.C.

Member Function Documentation

◆ nearestCoords()

Foam::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 
)
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().

Here is the call graph for this function:

◆ ClassName()

ClassName ( "treeDataTriSurface"  )

◆ surface()

const triSurface& surface ( ) const
inline

Definition at line 93 of file treeDataTriSurface.H.

References treeDataTriSurface::surface_.

◆ size()

label size ( ) const
inline

Definition at line 98 of file treeDataTriSurface.H.

References List::size(), and treeDataTriSurface::surface_.

Here is the call graph for this function:

◆ points()

Foam::pointField points ( ) const

Get representative point cloud for all shapes inside.

(one point per shape)

Definition at line 190 of file treeDataTriSurface.C.

References forAll, and points.

◆ getVolumeType()

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.

Here is the call graph for this function:

◆ overlaps()

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.

Here is the call graph for this function:

◆ findNearest() [1/2]

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().

Here is the call graph for this function:

◆ findNearest() [2/2]

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.

◆ intersects()

bool intersects ( const label  index,
const point start,
const point end,
point result 
) const

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().

Here is the call graph for this function:

Field Documentation

◆ surface_

const triSurface& surface_
private

Definition at line 57 of file treeDataTriSurface.H.

Referenced by treeDataTriSurface::size(), and treeDataTriSurface::surface().


The documentation for this class was generated from the following files: