本文整理汇总了C++中treeBoundBox::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ treeBoundBox::contains方法的具体用法?C++ treeBoundBox::contains怎么用?C++ treeBoundBox::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treeBoundBox
的用法示例。
在下文中一共展示了treeBoundBox::contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Check if any point on shape is inside cubeBb.
bool Foam::treeDataPoint::overlaps
(
const label index,
const treeBoundBox& cubeBb
) const
{
return cubeBb.contains(points_[index]);
}
示例2:
bool Foam::treeDataPoint::overlaps
(
const label index,
const treeBoundBox& cubeBb
) const
{
label pointi = (useSubset_ ? pointLabels_[index] : index);
return cubeBb.contains(points_[pointi]);
}
示例3: magSqr
void Foam::treeDataPoint::findNearestOp::operator()
(
const labelUList& indices,
const linePointRef& ln,
treeBoundBox& tightest,
label& minIndex,
point& linePoint,
point& nearestPoint
) const
{
const treeDataPoint& shape = tree_.shapes();
// Best so far
scalar nearestDistSqr = GREAT;
if (minIndex >= 0)
{
nearestDistSqr = magSqr(linePoint - nearestPoint);
}
forAll(indices, i)
{
const label index = indices[i];
label pointi =
(
shape.useSubset()
? shape.pointLabels()[index]
: index
);
const point& shapePt = shape.points()[pointi];
if (tightest.contains(shapePt))
{
// Nearest point on line
pointHit pHit = ln.nearestDist(shapePt);
scalar distSqr = sqr(pHit.distance());
if (distSqr < nearestDistSqr)
{
nearestDistSqr = distSqr;
minIndex = index;
linePoint = pHit.rawPoint();
nearestPoint = shapePt;
{
point& minPt = tightest.min();
minPt = min(ln.start(), ln.end());
minPt.x() -= pHit.distance();
minPt.y() -= pHit.distance();
minPt.z() -= pHit.distance();
}
{
point& maxPt = tightest.max();
maxPt = max(ln.start(), ln.end());
maxPt.x() += pHit.distance();
maxPt.y() += pHit.distance();
maxPt.z() += pHit.distance();
}
}
}
}
}
示例4: space
const treeLeaf<Type>* treeNode<Type>::findLeafLineOctant
(
const int level,
const Type& shapes,
const label octant,
const vector& direction,
point& start,
const point& end
) const
{
static const char* functionName =
"treeNode<Type>::findLeafLineOctant"
"(const int, const Type&, const label, const vector&,"
" point&, const point&)";
if (debug & 2)
{
space(Pout, 2*level);
Pout<< "findLeafLineOctant : bb:" << this->bb()
<< " start:" << start
<< " end:" << end
<< " mid:" << mid()
<< " Searching octant:" << octant
<< endl;
}
if (subNodes()[octant])
{
if (isNode(octant))
{
// Node: recurse into subnodes
const treeNode<Type>* subNodePtr = getNodePtr(octant);
if (subNodePtr->bb().contains(direction, start))
{
// Search on lower level
const treeLeaf<Type>* subLeafPtr =
subNodePtr->findLeafLine
(
level + 1,
shapes,
start,
end
);
if (debug & 2)
{
space(Pout, 2*level);
Pout<< "findLeafLineOctant : bb:" << this->bb()
<< " returning from sub treeNode"
<< " with start:" << start << " subLeaf:"
<< long(subLeafPtr) << endl;
}
return subLeafPtr;
}
else
{
FatalErrorIn(functionName)
<< "Sub node " << subNodePtr->bb()
<< " at octant " << octant
<< " does not contain start " << start
<< abort(FatalError);
}
}
else
{
// Leaf
const treeLeaf<Type>* subLeafPtr = getLeafPtr(octant);
if (subLeafPtr->bb().contains(direction, start))
{
// Step to end of subleaf bb
point tmp;
if
(
!subLeafPtr->bb().intersects
(
end,
start,
tmp
)
)
{
FatalErrorIn(functionName)
<< "Sub leaf contains start " << start
<< " but line does not intersect its bb "
<< subLeafPtr->bb()
<< abort(FatalError);
}
start = tmp;
if (debug & 2)
{
space(Pout, 2*level);
Pout<< "findLeafLineOctant : returning from intersecting"
<< " treeLeaf " << subLeafPtr->bb()
<< " with start:" << start << " subLeaf:"
<< long(subLeafPtr) << endl;
}
//.........这里部分代码省略.........
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:101,代码来源:treeNode.C