34 template<
class PatchType>
43 for (
label fp = 1; fp <
f.size(); fp++)
47 bb.min() =
min(bb.min(),
p);
48 bb.max() =
max(bb.max(),
p);
54 template<
class PatchType>
59 bbs_.setSize(patch_.size());
63 bbs_[i] = calcBb(patch_.points(), patch_[i]);
72 template<
class PatchType>
76 const PatchType& patch,
77 const scalar planarTol
88 template<
class PatchType>
98 template<
class PatchType>
108 template<
class PatchType>
116 shapeMask_(shapeMask)
120 template<
class PatchType>
135 template<
class PatchType>
142 cc[i] = patch_[i].centre(patch_.points());
149 template<
class PatchType>
170 if (info.
index() == -1)
173 <<
"Could not find " << sample <<
" in octree."
182 Pout<<
"getSampleType : sample:" << sample
183 <<
" nearest face:" << facei;
187 const typename PatchType::FaceType&
f = patch_.localFaces()[facei];
206 Pout<<
" -> face hit:" << curPt
207 <<
" comparing to face normal " << area <<
endl;
218 Pout<<
" -> face miss:" << curPt;
226 const scalar typDimSqr =
mag(area) + vSmall;
240 patch_.pointNormals()[
f[fp]],
248 if ((
magSqr(fc - curPt)/typDimSqr) < planarTol_)
255 Pout<<
" -> centre hit:" << fc
256 <<
" distance:" <<
magSqr(fc - curPt)/typDimSqr <<
endl;
272 const labelList& fEdges = patch_.faceEdges()[facei];
276 label edgeI = fEdges[fEdgeI];
277 const edge&
e = patch_.edges()[edgeI];
287 const labelList& eFaces = patch_.edgeFaces()[edgeI];
293 edgeNormal += patch_.faceNormals()[eFaces[i]];
299 <<
" comparing to edge normal:" << edgeNormal
324 ).nearestDist(sample);
336 nLeft /=
mag(nLeft) + vSmall;
339 nRight /=
mag(nRight) + vSmall;
343 Pout<<
" -> internal edge hit point:" << edgeHit.
rawPoint()
344 <<
" comparing to edge normal "
345 << 0.5*(nLeft + nRight)
353 0.5*(nLeft + nRight),
361 Pout<<
"Did not find sample " << sample
362 <<
" anywhere related to nearest face " << facei <<
endl
367 Pout<<
" vertex:" <<
f[fp] <<
" coord:" <<
points[
f[fp]]
382 template<
class PatchType>
399 if (!cubeBb.
overlaps(calcBb(patch_.points(), patch_[index])))
409 const typename PatchType::FaceType&
f = patch_[index];
454 template<
class PatchType>
459 const scalar radiusSqr
465 if (!bbs_[index].
overlaps(centre, radiusSqr))
472 if (!calcBb(patch_.points(), patch_[index]).
overlaps(centre, radiusSqr))
479 const face&
f = patch_[index];
494 template<
class PatchType>
500 scalar& nearestDistSqr,
512 const label index = indices[i];
513 const typename PatchType::FaceType&
f =
patch[index];
518 if (distSqr < nearestDistSqr)
520 nearestDistSqr = distSqr;
528 template<
class PatchType>
544 template<
class PatchType>
550 point& intersectionPoint
557 template<
class PatchType>
563 point& intersectionPoint
566 if (!shapeMask_.empty() &&
findIndex(shapeMask_, index) != -1)
575 template<
class PatchType>
581 point& intersectionPoint
584 if (edgeIndex_ == -1)
587 <<
"EdgeID not set. Please set edgeID to the index of"
588 <<
" the edge you are testing"
595 const typename PatchType::FaceType&
f =
patch.localFaces()[index];
609 template<
class PatchType>
616 point& intersectionPoint
623 const typename PatchType::FaceType&
f =
patch[index];
637 const vector dir(end - start);
660 inter =
f.intersection
675 intersectionPoint = inter.
hitPoint();
#define forAll(list, i)
Loop across all elements in list.
const Point & hitPoint() const
Return hit point.
scalar distance() const
Return distance to hit.
const Point & rawPoint() const
Return point with no checking.
bool hit() const
Is there a hit.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const
Return index.
bool containsAny(const UList< point > &) const
Contains any of the points? (inside or on edge)
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
Non-pointer based hierarchical recursive searching.
static volumeType getSide(const vector &outsideNormal, const vector &vec)
Helper function to return the side. Returns outside if.
Standard boundBox + extra functionality for use in octree.
bool overlaps(const boundBox &) const
Overlaps other bounding box?
direction posBits(const point &) const
Position of point relative to bounding box.
findAllIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree, DynamicList< label > &shapeMask)
findIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree)
findNearestOp(const indexedOctree< treeDataPrimitivePatch > &tree)
findSelfIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree, const label edgeID)
Encapsulation of data needed to search on PrimitivePatches.
bool overlaps(const label index, const treeBoundBox &sampleBb) const
Does shape at index overlap bb.
static bool findIntersection(const indexedOctree< treeDataPrimitivePatch< PatchType >> &tree, const label index, const point &start, const point &end, point &intersectionPoint)
Helper: find intersection of line with shapes.
const PatchType & patch() const
Return access to the underlying patch.
treeDataPrimitivePatch(const bool cacheBb, const PatchType &, const scalar planarTol)
Construct from patch.
volumeType getVolumeType(const indexedOctree< treeDataPrimitivePatch< PatchType >> &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
pointField shapePoints() const
Get representative point cloud for all shapes inside.
static bool intersectBb(const point &p0, const point &p1, const point &p2, const treeBoundBox &cubeBb)
Does triangle intersect bounding box.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
line< point, const point & > linePointRef
Line using referred points.
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
triangle< point, const point & > triPointRef
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.