Go to the documentation of this file.
27 #include "triSurface.H"
28 #include "PatchTools.H"
46 f.nearestPointClassify
54 if (nearType == triPointRef::POINT)
58 const label nearPointI =
f[nearLabel];
65 const label pointFaceI = pointFaces[pI];
67 if (pointFaceI != currHit.
index())
73 if (hit.
index() == pointFaceI)
81 else if (nearType == triPointRef::EDGE)
88 const label edgeI = fEdges[nearLabel];
94 const label edgeFaceI = edgeFaces[fI];
96 if (edgeFaceI != currHit.
index())
102 if (hit.
index() == edgeFaceI)
105 const vector currHitNormal =
108 const vector existingHitNormal =
109 surface().faceNormals()[edgeFaceI];
111 const label signCurrHit =
112 pos(currHitNormal & lineVec);
114 const label signExistingHit =
115 pos(existingHitNormal & lineVec);
117 if (signCurrHit == signExistingHit)
156 Info<<
" using intersection tolerance " << tolerance_ <<
endl;
162 Info<<
" using maximum tree depth " << maxTreeDepth_ <<
endl;
170 const scalar tolerance,
171 const label maxTreeDepth
175 tolerance_(tolerance),
176 maxTreeDepth_(maxTreeDepth),
200 if (treePtr_.empty())
213 <<
"Surface does not have compact point numbering."
214 <<
" Of " <<
surface().points().size()
216 <<
" are used. This might give problems in some routines."
226 bb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
227 bb.
max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
264 if (!tree().bb().contains(sample))
266 inside[sampleI] =
false;
270 inside[sampleI] =
true;
274 inside[sampleI] =
false;
318 const scalar nearestDistSqr = 0.25*
magSqr(span);
320 return tree().findNearest(pt, nearestDistSqr);
340 info[i] = octree.
findLine(start[i], end[i]);
408 vector lineVec = end[pointI] - start[pointI];
409 lineVec /=
mag(lineVec) + VSMALL;
Simple random number generator.
label index() const
Return index.
const point & max() const
Maximum describing the bounding box.
Encapsulates data for (indexedOc)tree searches on triSurface.
#define forAll(list, i)
Loop across all elements in list.
pointIndexHit nearest(const point &, const vector &span) const
Calculate nearest point on surface for single searchPoint. Returns.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Standard boundBox + extra functionality for use in octree.
bool hit() const
Is there a hit.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
triSurfaceSearch(const triSurfaceSearch &)
Disallow default bitwise copy construct.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &info) const
Calculate all intersections from start to end.
dimensioned< scalar > mag(const dimensioned< Type > &)
static scalar & perturbTol()
Get the perturbation tolerance.
scalarField samples(nIntervals, 0)
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Triangulated surface description with patch information.
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
pointIndexHit findLine(const bool findAny, const point &treeStart, const point &treeEnd, const label startNodeI, const direction startOctantI, const FindIntersectOp &fiOp, const bool verbose=false) const
Find any or nearest intersection.
const Point & hitPoint() const
Return hit point.
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
~triSurfaceSearch()
Destructor.
void clear()
Clear the addressed list, i.e. set the size to zero.
Non-pointer based hierarchical recursive searching.
const point & min() const
Minimum describing the bounding box.
void clearOut()
Clear storage.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const double e
Elementary charge.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
boolList calcInside(const pointField &searchPoints) const
Calculate for each searchPoint inside/outside status.
void setSize(const label)
Reset size of List.
treeDataPrimitivePatch< triSurface > treeDataTriSurface
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
Triangle with additional region number.
void findNearest(const label nodeI, const linePointRef &ln, treeBoundBox &tightest, label &nearestShapeI, point &linePoint, point &nearestPoint, const FindNearestOp &fnOp) const
Find nearest point to line.
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
bool checkUniqueHit(const pointIndexHit &currHit, const DynamicList< pointIndexHit, 1, 1 > &hits, const vector &lineVec) const
Check whether the current hit on the surface which lies on lineVec.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
cachedRandom rndGen(label(0), -1)
dimensionedScalar pos(const dimensionedScalar &ds)