mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
boundbox intersect renaming
This commit is contained in:
@ -504,7 +504,7 @@ int main(int argc, char *argv[])
|
||||
!bbsTargetSet[procITarget]
|
||||
|| (
|
||||
bbsTargetSet[procITarget]
|
||||
&& bbsTarget[procITarget].intersects(bbSource)
|
||||
&& bbsTarget[procITarget].overlaps(bbSource)
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -533,7 +533,7 @@ int main(int argc, char *argv[])
|
||||
bbsTarget[procITarget] = meshTarget.bounds();
|
||||
bbsTargetSet[procITarget] = true;
|
||||
|
||||
if (bbsTarget[procITarget].intersects(bbSource))
|
||||
if (bbsTarget[procITarget].overlaps(bbSource))
|
||||
{
|
||||
if (consistent)
|
||||
{
|
||||
|
||||
@ -118,7 +118,7 @@ public:
|
||||
// Query
|
||||
|
||||
//- Intersects other boundingbox?
|
||||
bool intersects(const boundBox& bb) const
|
||||
bool overlaps(const boundBox& bb) const
|
||||
{
|
||||
if
|
||||
(
|
||||
|
||||
@ -399,7 +399,7 @@ bool Foam::octreeDataFaceList::overlaps
|
||||
const treeBoundBox& sampleBb
|
||||
) const
|
||||
{
|
||||
return sampleBb.intersects(allBb_[index]);
|
||||
return sampleBb.overlaps(allBb_[index]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ namespace Foam
|
||||
// Does bb intersect a sphere around sample? Or is any corner point of bb
|
||||
// closer than nearestDistSqr to sample.
|
||||
template <class Type>
|
||||
bool indexedOctree<Type>::intersects
|
||||
bool indexedOctree<Type>::overlaps
|
||||
(
|
||||
const point& p0,
|
||||
const point& p1,
|
||||
@ -84,7 +84,7 @@ bool indexedOctree<Type>::intersects
|
||||
// Does bb intersect a sphere around sample? Or is any corner point of bb
|
||||
// closer than nearestDistSqr to sample.
|
||||
template <class Type>
|
||||
bool indexedOctree<Type>::intersects
|
||||
bool indexedOctree<Type>::overlaps
|
||||
(
|
||||
const treeBoundBox& parentBb,
|
||||
const direction octant,
|
||||
@ -94,7 +94,7 @@ bool indexedOctree<Type>::intersects
|
||||
{
|
||||
//- Speeded up version of
|
||||
// treeBoundBox subBb(parentBb.subBbox(mid, octant))
|
||||
// intersects
|
||||
// overlaps
|
||||
// (
|
||||
// subBb.min(),
|
||||
// subBb.max(),
|
||||
@ -136,7 +136,7 @@ bool indexedOctree<Type>::intersects
|
||||
|
||||
const point mid(0.5*(min+max));
|
||||
|
||||
return intersects(mid, other, nearestDistSqr, sample);
|
||||
return overlaps(mid, other, nearestDistSqr, sample);
|
||||
}
|
||||
|
||||
|
||||
@ -567,7 +567,7 @@ void indexedOctree<Type>::findNearest
|
||||
|
||||
const treeBoundBox& subBb = nodes_[subNodeI].bb_;
|
||||
|
||||
if (intersects(subBb.min(), subBb.max(), nearestDistSqr, sample))
|
||||
if (overlaps(subBb.min(), subBb.max(), nearestDistSqr, sample))
|
||||
{
|
||||
findNearest
|
||||
(
|
||||
@ -584,7 +584,7 @@ void indexedOctree<Type>::findNearest
|
||||
{
|
||||
if
|
||||
(
|
||||
intersects
|
||||
overlaps
|
||||
(
|
||||
nod.bb_,
|
||||
octant,
|
||||
@ -639,7 +639,7 @@ void indexedOctree<Type>::findNearest
|
||||
{
|
||||
const treeBoundBox& subBb = nodes_[getNode(index)].bb_;
|
||||
|
||||
if (subBb.intersects(tightest))
|
||||
if (subBb.overlaps(tightest))
|
||||
{
|
||||
findNearest
|
||||
(
|
||||
@ -657,7 +657,7 @@ void indexedOctree<Type>::findNearest
|
||||
{
|
||||
const treeBoundBox subBb(nodeBb.subBbox(octant));
|
||||
|
||||
if (subBb.intersects(tightest))
|
||||
if (subBb.overlaps(tightest))
|
||||
{
|
||||
shapes_.findNearest
|
||||
(
|
||||
@ -1121,7 +1121,7 @@ void indexedOctree<Type>::findBox
|
||||
{
|
||||
const treeBoundBox& subBb = nodes_[getNode(index)].bb_;
|
||||
|
||||
if (subBb.intersects(searchBox))
|
||||
if (subBb.overlaps(searchBox))
|
||||
{
|
||||
findBox(getNode(index), searchBox, elements);
|
||||
}
|
||||
@ -1130,7 +1130,7 @@ void indexedOctree<Type>::findBox
|
||||
{
|
||||
const treeBoundBox subBb(nodeBb.subBbox(octant));
|
||||
|
||||
if (subBb.intersects(searchBox))
|
||||
if (subBb.overlaps(searchBox))
|
||||
{
|
||||
const labelList& indices = contents_[getContent(index)];
|
||||
|
||||
|
||||
@ -36,9 +36,9 @@ SourceFiles
|
||||
#ifndef indexedOctree_H
|
||||
#define indexedOctree_H
|
||||
|
||||
#include "treeBoundBox.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "FixedList.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "Ostream.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "labelBits.H"
|
||||
@ -146,7 +146,7 @@ private:
|
||||
|
||||
//- Like above but now bb is implicitly provided as parent bb + mid
|
||||
// + octant
|
||||
static bool intersects
|
||||
static bool overlaps
|
||||
(
|
||||
const treeBoundBox& parentBb,
|
||||
const direction octant,
|
||||
@ -497,7 +497,7 @@ public:
|
||||
|
||||
//- Helper: does bb intersect a sphere around sample? Or is any
|
||||
// corner point of bb closer than nearestDistSqr to sample.
|
||||
static bool intersects
|
||||
static bool overlaps
|
||||
(
|
||||
const point& bbMin,
|
||||
const point& bbMax,
|
||||
|
||||
@ -137,11 +137,11 @@ bool Foam::treeDataCell::overlaps
|
||||
{
|
||||
if (cacheBb_)
|
||||
{
|
||||
return cubeBb.intersects(bbs_[index]);
|
||||
return cubeBb.overlaps(bbs_[index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return cubeBb.intersects(calcCellBb(cellLabels_[index]));
|
||||
return cubeBb.overlaps(calcCellBb(cellLabels_[index]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -110,11 +110,11 @@ bool Foam::treeDataEdge::overlaps
|
||||
{
|
||||
if (cacheBb_)
|
||||
{
|
||||
return cubeBb.intersects(bbs_[index]);
|
||||
return cubeBb.overlaps(bbs_[index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return cubeBb.intersects(calcBb(edgeLabels_[index]));
|
||||
return cubeBb.overlaps(calcBb(edgeLabels_[index]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -412,14 +412,14 @@ bool Foam::treeDataFace::overlaps
|
||||
// 1. Quick rejection: bb does not intersect face bb at all
|
||||
if (cacheBb_)
|
||||
{
|
||||
if (!cubeBb.intersects(bbs_[index]))
|
||||
if (!cubeBb.overlaps(bbs_[index]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cubeBb.intersects(calcBb(faceLabels_[index])))
|
||||
if (!cubeBb.overlaps(calcBb(faceLabels_[index])))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -284,13 +284,13 @@ bool Foam::treeDataTriSurface::overlaps
|
||||
triBb.max() = max(triBb.max(), p2);
|
||||
|
||||
//- For testing: robust one
|
||||
//return cubeBb.intersects(triBb);
|
||||
//return cubeBb.overlaps(triBb);
|
||||
|
||||
//- Exact test of triangle intersecting bb
|
||||
|
||||
// Quick rejection. If whole bounding box of tri is outside cubeBb then
|
||||
// there will be no intersection.
|
||||
if (!cubeBb.intersects(triBb))
|
||||
if (!cubeBb.overlaps(triBb))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ bool Foam::octreeDataCell::overlaps
|
||||
const treeBoundBox& cubeBb
|
||||
) const
|
||||
{
|
||||
return cubeBb.intersects(bbs_[index]);
|
||||
return cubeBb.overlaps(bbs_[index]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ bool Foam::octreeDataEdges::overlaps
|
||||
const treeBoundBox& sampleBb
|
||||
) const
|
||||
{
|
||||
return sampleBb.intersects(allBb_[index]);
|
||||
return sampleBb.overlaps(allBb_[index]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -507,12 +507,12 @@ bool Foam::octreeDataFace::overlaps
|
||||
const treeBoundBox& sampleBb
|
||||
) const
|
||||
{
|
||||
//return sampleBb.intersects(allBb_[index]);
|
||||
//return sampleBb.overlaps(allBb_[index]);
|
||||
|
||||
//- Exact test of face intersecting bb
|
||||
|
||||
// 1. Quick rejection: bb does not intersect face bb at all
|
||||
if (!sampleBb.intersects(allBb_[index]))
|
||||
if (!sampleBb.overlaps(allBb_[index]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -297,6 +297,45 @@ Foam::treeBoundBox Foam::treeBoundBox::subBbox
|
||||
}
|
||||
|
||||
|
||||
bool Foam::treeBoundBox::overlaps
|
||||
(
|
||||
const point& centre,
|
||||
const scalar radiusSqr
|
||||
) const
|
||||
{
|
||||
// Find out where centre is in relation to bb.
|
||||
// Find nearest point on bb.
|
||||
scalar distSqr = 0;
|
||||
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
{
|
||||
scalar d0 = min()[dir] - centre[dir];
|
||||
scalar d1 = max()[dir] - centre[dir];
|
||||
|
||||
if ((d0 > 0) != (d1 > 0))
|
||||
{
|
||||
// centre inside both extrema. This component does not add any
|
||||
// distance.
|
||||
}
|
||||
else if (Foam::mag(d0) < Foam::mag(d1))
|
||||
{
|
||||
distSqr += d0*d0;
|
||||
}
|
||||
else
|
||||
{
|
||||
distSqr += d1*d1;
|
||||
}
|
||||
|
||||
if (distSqr > radiusSqr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// line intersection. Returns true if line (start to end) inside
|
||||
// bb or intersects bb. Sets pt to intersection.
|
||||
//
|
||||
|
||||
@ -263,8 +263,11 @@ public:
|
||||
FixedList<direction, 8>& octantOrder
|
||||
) const;
|
||||
|
||||
//- Intersects other boundingbox?
|
||||
inline bool intersects(const treeBoundBox&) const;
|
||||
//- Overlaps other boundingbox?
|
||||
inline bool overlaps(const treeBoundBox&) const;
|
||||
|
||||
//- Overlaps boundingSphere (centre + sqr(radius))?
|
||||
bool overlaps(const point&, const scalar radiusSqr) const;
|
||||
|
||||
//- Intersects segment; set point to intersection position,
|
||||
// return true if intersection found.
|
||||
|
||||
@ -24,9 +24,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "point.H"
|
||||
#include "Random.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -414,9 +412,9 @@ inline void treeBoundBox::searchOrder
|
||||
|
||||
// true if bb's intersect or overlap.
|
||||
// Note: <= to make sure we catch all.
|
||||
inline bool treeBoundBox::intersects(const treeBoundBox& bb) const
|
||||
inline bool treeBoundBox::overlaps(const treeBoundBox& bb) const
|
||||
{
|
||||
return boundBox::intersects(bb);
|
||||
return boundBox::overlaps(bb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -798,7 +798,7 @@ bool treeNode<Type>::findTightest
|
||||
// Node: recurse into subnodes
|
||||
const treeNode<Type>* subNodePtr = getNodePtr(octant);
|
||||
|
||||
if (subNodePtr->bb().intersects(tightest))
|
||||
if (subNodePtr->bb().overlaps(tightest))
|
||||
{
|
||||
// there might be a better fit inside this subNode
|
||||
changed |=
|
||||
@ -815,7 +815,7 @@ bool treeNode<Type>::findTightest
|
||||
// Leaf: let leaf::find handle this
|
||||
const treeLeaf<Type>* subLeafPtr = getLeafPtr(octant);
|
||||
|
||||
if (subLeafPtr->bb().intersects(tightest))
|
||||
if (subLeafPtr->bb().overlaps(tightest))
|
||||
{
|
||||
// there might be a better fit inside this subLeaf
|
||||
changed |=
|
||||
@ -884,7 +884,7 @@ bool treeNode<Type>::findNearest
|
||||
// Node
|
||||
const treeNode<Type>* subNodePtr = getNodePtr(octant);
|
||||
|
||||
if (subNodePtr->bb().intersects(tightest))
|
||||
if (subNodePtr->bb().overlaps(tightest))
|
||||
{
|
||||
// there might be a better fit inside this subNode
|
||||
changed |=
|
||||
@ -903,7 +903,7 @@ bool treeNode<Type>::findNearest
|
||||
// Leaf: let leaf::find handle this
|
||||
const treeLeaf<Type>* subLeafPtr = getLeafPtr(octant);
|
||||
|
||||
if (subLeafPtr->bb().intersects(tightest))
|
||||
if (subLeafPtr->bb().overlaps(tightest))
|
||||
{
|
||||
// there might be a better fit inside this subNode
|
||||
changed |=
|
||||
@ -975,7 +975,7 @@ bool treeNode<Type>::findNearest
|
||||
// Node
|
||||
const treeNode<Type>* subNodePtr = getNodePtr(octant);
|
||||
|
||||
if (subNodePtr->bb().intersects(tightest))
|
||||
if (subNodePtr->bb().overlaps(tightest))
|
||||
{
|
||||
// there might be a better fit inside this subNode
|
||||
changed |=
|
||||
@ -995,7 +995,7 @@ bool treeNode<Type>::findNearest
|
||||
// Leaf: let leaf::find handle this
|
||||
const treeLeaf<Type>* subLeafPtr = getLeafPtr(octant);
|
||||
|
||||
if (subLeafPtr->bb().intersects(tightest))
|
||||
if (subLeafPtr->bb().overlaps(tightest))
|
||||
{
|
||||
// there might be a better fit inside this subNode
|
||||
changed |=
|
||||
@ -1060,7 +1060,7 @@ bool treeNode<Type>::findBox
|
||||
// Node
|
||||
const treeNode<Type>* subNodePtr = getNodePtr(octant);
|
||||
|
||||
if (subNodePtr->bb().intersects(box))
|
||||
if (subNodePtr->bb().overlaps(box))
|
||||
{
|
||||
// Visit sub node.
|
||||
changed |= subNodePtr->findBox(shapes, box, elements);
|
||||
@ -1071,7 +1071,7 @@ bool treeNode<Type>::findBox
|
||||
// Leaf: let leaf::find handle this
|
||||
const treeLeaf<Type>* subLeafPtr = getLeafPtr(octant);
|
||||
|
||||
if (subLeafPtr->bb().intersects(box))
|
||||
if (subLeafPtr->bb().overlaps(box))
|
||||
{
|
||||
// Visit sub leaf.
|
||||
changed |= subLeafPtr->findBox(shapes, box, elements);
|
||||
|
||||
@ -385,12 +385,12 @@ bool Foam::octreeDataTriSurface::overlaps
|
||||
const treeBoundBox& cubeBb
|
||||
) const
|
||||
{
|
||||
//return cubeBb.intersects(allBb_[index]);
|
||||
//return cubeBb.overlaps(allBb_[index]);
|
||||
|
||||
//- Exact test of triangle intersecting bb
|
||||
|
||||
// Quick rejection.
|
||||
if (!cubeBb.intersects(allBb_[index]))
|
||||
if (!cubeBb.overlaps(allBb_[index]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ bool Foam::treeLeaf<Foam::octreeDataTriSurface>::findNearest
|
||||
label faceI = indices_[i];
|
||||
|
||||
// Quick rejection test.
|
||||
if (tightest.intersects(allBb[faceI]))
|
||||
if (tightest.overlaps(allBb[faceI]))
|
||||
{
|
||||
// Full calculation
|
||||
scalar dist = shapes.calcNearest(faceI, sample, nearest);
|
||||
|
||||
Reference in New Issue
Block a user