mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Add extra octree functionality
+ Make intersection and nearest functions functors. This makes adding different intersection and nearest routines easier. + treeDataPrimitivePatch takes its tolerance as a constructor argument + Make treeDataTriSurface a typedef of treeDataPrimitivePatch
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -576,6 +576,7 @@ Foam::indexedOctree<Type>::getSide
|
||||
|
||||
// Find nearest point starting from nodeI
|
||||
template <class Type>
|
||||
template <class FindNearestOp>
|
||||
void Foam::indexedOctree<Type>::findNearest
|
||||
(
|
||||
const label nodeI,
|
||||
@ -583,7 +584,9 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
|
||||
scalar& nearestDistSqr,
|
||||
label& nearestShapeI,
|
||||
point& nearestPoint
|
||||
point& nearestPoint,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
@ -614,7 +617,9 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
|
||||
nearestDistSqr,
|
||||
nearestShapeI,
|
||||
nearestPoint
|
||||
nearestPoint,
|
||||
|
||||
fnOp
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -631,7 +636,7 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
)
|
||||
)
|
||||
{
|
||||
shapes_.findNearest
|
||||
fnOp
|
||||
(
|
||||
contents_[getContent(index)],
|
||||
sample,
|
||||
@ -648,6 +653,7 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
|
||||
// Find nearest point to line.
|
||||
template <class Type>
|
||||
template <class FindNearestOp>
|
||||
void Foam::indexedOctree<Type>::findNearest
|
||||
(
|
||||
const label nodeI,
|
||||
@ -656,7 +662,9 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
treeBoundBox& tightest,
|
||||
label& nearestShapeI,
|
||||
point& linePoint,
|
||||
point& nearestPoint
|
||||
point& nearestPoint,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
@ -687,7 +695,9 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
tightest,
|
||||
nearestShapeI,
|
||||
linePoint,
|
||||
nearestPoint
|
||||
nearestPoint,
|
||||
|
||||
fnOp
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -697,7 +707,7 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
|
||||
if (subBb.overlaps(tightest))
|
||||
{
|
||||
shapes_.findNearest
|
||||
fnOp
|
||||
(
|
||||
contents_[getContent(index)],
|
||||
ln,
|
||||
@ -1620,6 +1630,7 @@ Foam::word Foam::indexedOctree<Type>::faceString
|
||||
// hitInfo.point = coordinate of intersection of ray with bounding box
|
||||
// hitBits = posbits of point on bounding box
|
||||
template <class Type>
|
||||
template <class FindIntersectOp>
|
||||
void Foam::indexedOctree<Type>::traverseNode
|
||||
(
|
||||
const bool findAny,
|
||||
@ -1632,7 +1643,9 @@ void Foam::indexedOctree<Type>::traverseNode
|
||||
const direction octant,
|
||||
|
||||
pointIndexHit& hitInfo,
|
||||
direction& hitBits
|
||||
direction& hitBits,
|
||||
|
||||
const FindIntersectOp& fiOp
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
@ -1667,7 +1680,7 @@ void Foam::indexedOctree<Type>::traverseNode
|
||||
label shapeI = indices[elemI];
|
||||
|
||||
point pt;
|
||||
bool hit = shapes_.intersects(shapeI, start, end, pt);
|
||||
bool hit = fiOp(shapeI, start, end, pt);
|
||||
|
||||
// Note that intersection of shape might actually be
|
||||
// in a neighbouring box. For findAny this is not important.
|
||||
@ -1695,13 +1708,7 @@ void Foam::indexedOctree<Type>::traverseNode
|
||||
label shapeI = indices[elemI];
|
||||
|
||||
point pt;
|
||||
bool hit = shapes_.intersects
|
||||
(
|
||||
shapeI,
|
||||
start,
|
||||
nearestPoint,
|
||||
pt
|
||||
);
|
||||
bool hit = fiOp(shapeI, start, nearestPoint, pt);
|
||||
|
||||
// Note that intersection of shape might actually be
|
||||
// in a neighbouring box. Since we need to maintain strict
|
||||
@ -1774,7 +1781,9 @@ void Foam::indexedOctree<Type>::traverseNode
|
||||
octant,
|
||||
|
||||
hitInfo,
|
||||
hitBits
|
||||
hitBits,
|
||||
|
||||
fiOp
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1782,6 +1791,7 @@ void Foam::indexedOctree<Type>::traverseNode
|
||||
|
||||
// Find first intersection
|
||||
template <class Type>
|
||||
template <class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
(
|
||||
const bool findAny,
|
||||
@ -1789,6 +1799,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
const point& treeEnd,
|
||||
const label startNodeI,
|
||||
const direction startOctant,
|
||||
const FindIntersectOp& fiOp,
|
||||
const bool verbose
|
||||
) const
|
||||
{
|
||||
@ -1864,7 +1875,9 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
octant,
|
||||
|
||||
hitInfo,
|
||||
hitFaceID
|
||||
hitFaceID,
|
||||
|
||||
fiOp
|
||||
);
|
||||
|
||||
// Did we hit a triangle?
|
||||
@ -1948,7 +1961,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
treeEnd,
|
||||
startNodeI,
|
||||
startOctant,
|
||||
true //verbose
|
||||
fiOp,
|
||||
true //verbose,
|
||||
);
|
||||
}
|
||||
if (debug)
|
||||
@ -2007,11 +2021,13 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
|
||||
// Find first intersection
|
||||
template <class Type>
|
||||
template <class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
(
|
||||
const bool findAny,
|
||||
const point& start,
|
||||
const point& end
|
||||
const point& end,
|
||||
const FindIntersectOp& fiOp
|
||||
) const
|
||||
{
|
||||
pointIndexHit hitInfo;
|
||||
@ -2069,7 +2085,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
trackStart,
|
||||
trackEnd,
|
||||
parentNodeI,
|
||||
octant
|
||||
octant,
|
||||
fiOp
|
||||
);
|
||||
}
|
||||
|
||||
@ -2656,6 +2673,25 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
const point& sample,
|
||||
const scalar startDistSqr
|
||||
) const
|
||||
{
|
||||
return findNearest
|
||||
(
|
||||
sample,
|
||||
startDistSqr,
|
||||
typename Type::findNearestOp(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
template <class FindNearestOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
(
|
||||
const point& sample,
|
||||
const scalar startDistSqr,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const
|
||||
{
|
||||
scalar nearestDistSqr = startDistSqr;
|
||||
label nearestShapeI = -1;
|
||||
@ -2670,7 +2706,9 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
|
||||
nearestDistSqr,
|
||||
nearestShapeI,
|
||||
nearestPoint
|
||||
nearestPoint,
|
||||
|
||||
fnOp
|
||||
);
|
||||
}
|
||||
|
||||
@ -2685,6 +2723,27 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
treeBoundBox& tightest,
|
||||
point& linePoint
|
||||
) const
|
||||
{
|
||||
return findNearest
|
||||
(
|
||||
ln,
|
||||
tightest,
|
||||
linePoint,
|
||||
typename Type::findNearestOp(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
template <class FindNearestOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
(
|
||||
const linePointRef& ln,
|
||||
treeBoundBox& tightest,
|
||||
point& linePoint,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const
|
||||
{
|
||||
label nearestShapeI = -1;
|
||||
point nearestPoint = vector::zero;
|
||||
@ -2699,7 +2758,9 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
tightest,
|
||||
nearestShapeI,
|
||||
linePoint,
|
||||
nearestPoint
|
||||
nearestPoint,
|
||||
|
||||
fnOp
|
||||
);
|
||||
}
|
||||
|
||||
@ -2715,7 +2776,13 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
const point& end
|
||||
) const
|
||||
{
|
||||
return findLine(false, start, end);
|
||||
return findLine
|
||||
(
|
||||
false,
|
||||
start,
|
||||
end,
|
||||
typename Type::findIntersectOp(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2727,7 +2794,41 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
|
||||
const point& end
|
||||
) const
|
||||
{
|
||||
return findLine(true, start, end);
|
||||
return findLine
|
||||
(
|
||||
true,
|
||||
start,
|
||||
end,
|
||||
typename Type::findIntersectOp(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template <class Type>
|
||||
template <class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
(
|
||||
const point& start,
|
||||
const point& end,
|
||||
const FindIntersectOp& fiOp
|
||||
) const
|
||||
{
|
||||
return findLine(false, start, end, fiOp);
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template <class Type>
|
||||
template <class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
|
||||
(
|
||||
const point& start,
|
||||
const point& end,
|
||||
const FindIntersectOp& fiOp
|
||||
) const
|
||||
{
|
||||
return findLine(true, start, end, fiOp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -212,6 +212,7 @@ private:
|
||||
// Query
|
||||
|
||||
//- Find nearest point to line.
|
||||
template <class FindNearestOp>
|
||||
void findNearest
|
||||
(
|
||||
const label nodeI,
|
||||
@ -220,7 +221,9 @@ private:
|
||||
treeBoundBox& tightest,
|
||||
label& nearestShapeI,
|
||||
point& linePoint,
|
||||
point& nearestPoint
|
||||
point& nearestPoint,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const;
|
||||
|
||||
//- Return bbox of octant
|
||||
@ -294,6 +297,7 @@ private:
|
||||
// intersection point.
|
||||
// findAny=true : return any intersection
|
||||
// findAny=false: return nearest (to start) intersection
|
||||
template <class FindIntersectOp>
|
||||
void traverseNode
|
||||
(
|
||||
const bool findAny,
|
||||
@ -306,10 +310,13 @@ private:
|
||||
const direction octantI,
|
||||
|
||||
pointIndexHit& hitInfo,
|
||||
direction& faceID
|
||||
direction& faceID,
|
||||
|
||||
const FindIntersectOp& fiOp
|
||||
) const;
|
||||
|
||||
//- Find any or nearest intersection
|
||||
template <class FindIntersectOp>
|
||||
pointIndexHit findLine
|
||||
(
|
||||
const bool findAny,
|
||||
@ -317,6 +324,7 @@ private:
|
||||
const point& treeEnd,
|
||||
const label startNodeI,
|
||||
const direction startOctantI,
|
||||
const FindIntersectOp& fiOp,
|
||||
const bool verbose = false
|
||||
) const;
|
||||
|
||||
@ -328,11 +336,13 @@ private:
|
||||
// ) const;
|
||||
|
||||
//- Find any or nearest intersection of line between start and end.
|
||||
template <class FindIntersectOp>
|
||||
pointIndexHit findLine
|
||||
(
|
||||
const bool findAny,
|
||||
const point& start,
|
||||
const point& end
|
||||
const point& end,
|
||||
const FindIntersectOp& fiOp
|
||||
) const;
|
||||
|
||||
//- Find all elements intersecting box.
|
||||
@ -528,15 +538,24 @@ public:
|
||||
|
||||
// Queries
|
||||
|
||||
pointIndexHit findNearest
|
||||
(
|
||||
const point& sample,
|
||||
const scalar nearestDistSqr
|
||||
) const;
|
||||
|
||||
//- Calculate nearest point on nearest shape.
|
||||
// Returns
|
||||
// - bool : any point found nearer than nearestDistSqr
|
||||
// - label: index in shapes
|
||||
// - point: actual nearest point found
|
||||
template <class FindNearestOp>
|
||||
pointIndexHit findNearest
|
||||
(
|
||||
const point& sample,
|
||||
const scalar nearestDistSqr
|
||||
const scalar nearestDistSqr,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const;
|
||||
|
||||
// bool findAnyOverlap
|
||||
@ -553,6 +572,7 @@ public:
|
||||
// ) const;
|
||||
|
||||
//- Low level: calculate nearest starting from subnode.
|
||||
template <class FindNearestOp>
|
||||
void findNearest
|
||||
(
|
||||
const label nodeI,
|
||||
@ -560,7 +580,9 @@ public:
|
||||
|
||||
scalar& nearestDistSqr,
|
||||
label& nearestShapeI,
|
||||
point& nearestPoint
|
||||
point& nearestPoint,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const;
|
||||
|
||||
//- Find nearest to line.
|
||||
@ -577,6 +599,16 @@ public:
|
||||
point& linePoint
|
||||
) const;
|
||||
|
||||
template <class FindNearestOp>
|
||||
pointIndexHit findNearest
|
||||
(
|
||||
const linePointRef& ln,
|
||||
treeBoundBox& tightest,
|
||||
point& linePoint,
|
||||
|
||||
const FindNearestOp& fnOp
|
||||
) const;
|
||||
|
||||
//- Find nearest intersection of line between start and end.
|
||||
pointIndexHit findLine
|
||||
(
|
||||
@ -591,6 +623,24 @@ public:
|
||||
const point& end
|
||||
) const;
|
||||
|
||||
//- Find nearest intersection of line between start and end.
|
||||
template <class FindIntersectOp>
|
||||
pointIndexHit findLine
|
||||
(
|
||||
const point& start,
|
||||
const point& end,
|
||||
const FindIntersectOp& fiOp
|
||||
) const;
|
||||
|
||||
//- Find any intersection of line between start and end.
|
||||
template <class FindIntersectOp>
|
||||
pointIndexHit findLineAny
|
||||
(
|
||||
const point& start,
|
||||
const point& end,
|
||||
const FindIntersectOp& fiOp
|
||||
) const;
|
||||
|
||||
//- Find (in no particular order) indices of all shapes inside or
|
||||
// overlapping bounding box (i.e. all shapes not outside box)
|
||||
labelList findBox(const treeBoundBox& bb) const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -133,6 +133,24 @@ Foam::treeDataCell::treeDataCell
|
||||
}
|
||||
|
||||
|
||||
Foam::treeDataCell::findNearestOp::findNearestOp
|
||||
(
|
||||
const indexedOctree<treeDataCell>& tree
|
||||
)
|
||||
:
|
||||
tree_(tree)
|
||||
{}
|
||||
|
||||
|
||||
Foam::treeDataCell::findIntersectOp::findIntersectOp
|
||||
(
|
||||
const indexedOctree<treeDataCell>& tree
|
||||
)
|
||||
:
|
||||
tree_(tree)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointField Foam::treeDataCell::shapePoints() const
|
||||
@ -175,7 +193,7 @@ bool Foam::treeDataCell::contains
|
||||
}
|
||||
|
||||
|
||||
void Foam::treeDataCell::findNearest
|
||||
void Foam::treeDataCell::findNearestOp::operator()
|
||||
(
|
||||
const labelUList& indices,
|
||||
const point& sample,
|
||||
@ -185,23 +203,51 @@ void Foam::treeDataCell::findNearest
|
||||
point& nearestPoint
|
||||
) const
|
||||
{
|
||||
const treeDataCell& shape = tree_.shapes();
|
||||
|
||||
forAll(indices, i)
|
||||
{
|
||||
label index = indices[i];
|
||||
label cellI = cellLabels_[index];
|
||||
scalar distSqr = magSqr(sample - mesh_.cellCentres()[cellI]);
|
||||
label cellI = shape.cellLabels()[index];
|
||||
scalar distSqr = magSqr(sample - shape.mesh().cellCentres()[cellI]);
|
||||
|
||||
if (distSqr < nearestDistSqr)
|
||||
{
|
||||
nearestDistSqr = distSqr;
|
||||
minIndex = index;
|
||||
nearestPoint = mesh_.cellCentres()[cellI];
|
||||
nearestPoint = shape.mesh().cellCentres()[cellI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::treeDataCell::intersects
|
||||
void Foam::treeDataCell::findNearestOp::operator()
|
||||
(
|
||||
const labelUList& indices,
|
||||
const linePointRef& ln,
|
||||
|
||||
treeBoundBox& tightest,
|
||||
label& minIndex,
|
||||
point& linePoint,
|
||||
point& nearestPoint
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"treeDataCell::findNearestOp::operator()"
|
||||
"("
|
||||
" const labelUList&,"
|
||||
" const linePointRef&,"
|
||||
" treeBoundBox&,"
|
||||
" label&,"
|
||||
" point&,"
|
||||
" point&"
|
||||
") const"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::treeDataCell::findIntersectOp::operator()
|
||||
(
|
||||
const label index,
|
||||
const point& start,
|
||||
@ -209,10 +255,12 @@ bool Foam::treeDataCell::intersects
|
||||
point& intersectionPoint
|
||||
) const
|
||||
{
|
||||
const treeDataCell& shape = tree_.shapes();
|
||||
|
||||
// Do quick rejection test
|
||||
if (cacheBb_)
|
||||
if (shape.cacheBb_)
|
||||
{
|
||||
const treeBoundBox& cellBb = bbs_[index];
|
||||
const treeBoundBox& cellBb = shape.bbs_[index];
|
||||
|
||||
if ((cellBb.posBits(start) & cellBb.posBits(end)) != 0)
|
||||
{
|
||||
@ -222,7 +270,7 @@ bool Foam::treeDataCell::intersects
|
||||
}
|
||||
else
|
||||
{
|
||||
const treeBoundBox cellBb = calcCellBb(cellLabels_[index]);
|
||||
const treeBoundBox cellBb = shape.calcCellBb(shape.cellLabels_[index]);
|
||||
|
||||
if ((cellBb.posBits(start) & cellBb.posBits(end)) != 0)
|
||||
{
|
||||
@ -238,7 +286,7 @@ bool Foam::treeDataCell::intersects
|
||||
// Disable picking up intersections behind us.
|
||||
scalar oldTol = intersection::setPlanarTol(0.0);
|
||||
|
||||
const cell& cFaces = mesh_.cells()[cellLabels_[index]];
|
||||
const cell& cFaces = shape.mesh_.cells()[shape.cellLabels_[index]];
|
||||
|
||||
const vector dir(end - start);
|
||||
scalar minDistSqr = magSqr(dir);
|
||||
@ -246,13 +294,13 @@ bool Foam::treeDataCell::intersects
|
||||
|
||||
forAll(cFaces, i)
|
||||
{
|
||||
const face& f = mesh_.faces()[cFaces[i]];
|
||||
const face& f = shape.mesh_.faces()[cFaces[i]];
|
||||
|
||||
pointHit inter = f.ray
|
||||
(
|
||||
start,
|
||||
dir,
|
||||
mesh_.points(),
|
||||
shape.mesh_.points(),
|
||||
intersection::HALF_RAY
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -80,6 +80,56 @@ class treeDataCell
|
||||
|
||||
public:
|
||||
|
||||
|
||||
class findNearestOp
|
||||
{
|
||||
const indexedOctree<treeDataCell>& tree_;
|
||||
|
||||
public:
|
||||
|
||||
findNearestOp(const indexedOctree<treeDataCell>& tree);
|
||||
|
||||
void operator()
|
||||
(
|
||||
const labelUList& indices,
|
||||
const point& sample,
|
||||
|
||||
scalar& nearestDistSqr,
|
||||
label& minIndex,
|
||||
point& nearestPoint
|
||||
) const;
|
||||
|
||||
void operator()
|
||||
(
|
||||
const labelUList& indices,
|
||||
const linePointRef& ln,
|
||||
|
||||
treeBoundBox& tightest,
|
||||
label& minIndex,
|
||||
point& linePoint,
|
||||
point& nearestPoint
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
class findIntersectOp
|
||||
{
|
||||
const indexedOctree<treeDataCell>& tree_;
|
||||
|
||||
public:
|
||||
|
||||
findIntersectOp(const indexedOctree<treeDataCell>& tree);
|
||||
|
||||
bool operator()
|
||||
(
|
||||
const label index,
|
||||
const point& start,
|
||||
const point& end,
|
||||
point& intersectionPoint
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("treeDataCell");
|
||||
|
||||
@ -173,49 +223,6 @@ public:
|
||||
const label index,
|
||||
const point& sample
|
||||
) const;
|
||||
|
||||
//- Calculates nearest (to sample) point in shape.
|
||||
// Returns actual point and distance (squared)
|
||||
void findNearest
|
||||
(
|
||||
const labelUList& indices,
|
||||
const point& sample,
|
||||
|
||||
scalar& nearestDistSqr,
|
||||
label& nearestIndex,
|
||||
point& nearestPoint
|
||||
) const;
|
||||
|
||||
//- Calculates nearest (to line) point in shape.
|
||||
// Returns point and distance (squared)
|
||||
void findNearest
|
||||
(
|
||||
const labelUList& indices,
|
||||
const linePointRef& ln,
|
||||
|
||||
treeBoundBox& tightest,
|
||||
label& minIndex,
|
||||
point& linePoint,
|
||||
point& nearestPoint
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"treeDataCell::findNearest"
|
||||
"(const labelUList&, const linePointRef&, ..)"
|
||||
);
|
||||
}
|
||||
|
||||
//- Calculate intersection of shape with ray. Sets result
|
||||
// accordingly
|
||||
bool intersects
|
||||
(
|
||||
const label index,
|
||||
const point& start,
|
||||
const point& end,
|
||||
point& result
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user