本文整理汇总了C++中treeBoundBox类的典型用法代码示例。如果您正苦于以下问题:C++ treeBoundBox类的具体用法?C++ treeBoundBox怎么用?C++ treeBoundBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了treeBoundBox类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sqr
bool Foam::treeLeaf<Foam::octreeDataPoint>::findNearest
(
const octreeDataPoint& shapes,
const point& sample,
treeBoundBox& tightest,
label& tightestI,
scalar& tightestDist
) const
{
// Some aliases
const pointField& points = shapes.points();
point& tMin = tightest.min();
point& tMax = tightest.max();
scalar minDist2 = sqr(tightestDist);
label minIndex = -1;
forAll(indices_, i)
{
label pointi = indices_[i];
scalar dist = magSqr(points[pointi] - sample);
if (dist < minDist2)
{
minDist2 = dist;
minIndex = pointi;
}
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-2.0.x,代码行数:28,代码来源:octreeDataPointTreeLeaf.C
示例2: mag
bool Foam::octreeDataBoundBox::findTightest
(
const label index,
const point& sample,
treeBoundBox& tightest
) const
{
// Get furthest away vertex
point myNear, myFar;
allBb_[index].calcExtremities(sample, myNear, myFar);
const point dist = myFar - sample;
scalar myFarDist = mag(dist);
point tightestNear, tightestFar;
tightest.calcExtremities(sample, tightestNear, tightestFar);
scalar tightestFarDist = mag(tightestFar - sample);
if (tightestFarDist < myFarDist)
{
// Keep current tightest.
return false;
}
else
{
// Construct bb around sample and myFar
const point dist2(fabs(dist.x()), fabs(dist.y()), fabs(dist.z()));
tightest.min() = sample - dist2;
tightest.max() = sample + dist2;
return true;
}
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:35,代码来源:octreeDataBoundBox.C
示例3:
bool Foam::octreeDataCell::overlaps
(
const label index,
const treeBoundBox& cubeBb
) const
{
return cubeBb.overlaps(bbs_[index]);
}
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:8,代码来源:octreeDataCell.C
示例4:
bool Foam::octreeDataBoundBox::overlaps
(
const label index,
const treeBoundBox& sampleBb
) const
{
return sampleBb.overlaps(allBb_[index]);
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:8,代码来源:octreeDataBoundBox.C
示例5:
// 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]);
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:9,代码来源:treeDataPoint.C
示例6:
bool Foam::treeDataPoint::overlaps
(
const label index,
const treeBoundBox& cubeBb
) const
{
label pointi = (useSubset_ ? pointLabels_[index] : index);
return cubeBb.contains(points_[pointi]);
}
开发者ID:EricAlex,项目名称:OpenFOAM-dev,代码行数:9,代码来源:treeDataPoint.C
示例7: treeNodeName
treeNode<Type>::treeNode(const treeBoundBox& bb)
:
treeElem<Type>(bb),
treeNodeName(),
mid_(bb.mid()),
subNodeTypes_(0),
volType_(0)
{
for(label octant=0; octant<8; octant++)
{
subNodes_[octant] = NULL;
setVolType(octant, octree<Type>::UNKNOWN);
}
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:14,代码来源:treeNode.C
示例8: dumpBox
void dumpBox(const treeBoundBox& bb, const fileName& fName)
{
OFstream str(fName);
Info<< "Dumping bounding box " << bb << " as lines to obj file "
<< str.name() << endl;
pointField boxPoints(bb.points());
forAll(boxPoints, i)
{
meshTools::writeOBJ(str, boxPoints[i]);
}
开发者ID:AmaneShino,项目名称:OpenFOAM-2.0.x,代码行数:14,代码来源:surfaceFeatureExtract.C
示例9: 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();
}
}
}
}
}
开发者ID:EricAlex,项目名称:OpenFOAM-dev,代码行数:63,代码来源:treeDataPoint.C
示例10: space
//.........这里部分代码省略.........
(
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;
}
return subLeafPtr;
}
else
{
FatalErrorIn(functionName)
<< "Sub leaf " << subLeafPtr->bb()
<< " at octant " << octant
<< " does not contain start " << start
<< abort(FatalError);
}
}
}
else
{
// Empty subNode. Transfer across.
const treeBoundBox emptyBb = this->bb().subBbox(mid(), octant);
if (emptyBb.contains(direction, start))
{
if (debug & 2)
{
space(Pout, 2*level);
Pout<< "findLeafLineOctant : Empty node. Octant:" << octant
<< " start:" << start
<< " bb:" << this->bb()
<< " emptyBb:" << emptyBb << endl;
}
// Update start by clipping to emptyBb
point tmp;
if
(
!emptyBb.intersects
(
end,
start,
tmp
)
)
{
FatalErrorIn(functionName)
<< "Empty node contains start " << start
<< " but line does not intersect its (calculated)"
<< " bb " << emptyBb
<< endl << "This might be due to truncation error"
<< abort(FatalError);
}
start = tmp;
if (debug & 2)
{
space(Pout, 2*level);
Pout<< "findLeafLineOctant : returning from intersecting with"
<< " empty " << emptyBb
<< " with start:" << start << " subLeaf:" << 0 << endl;
}
return NULL;
}
else
{
FatalErrorIn(functionName)
<< "Empty node " << emptyBb
<< " at octant " << octant
<< " does not contain start " << start
<< abort(FatalError);
}
}
FatalErrorIn(functionName)
<< "Octant " << octant << " of cube " << this->bb()
<< " does not contain start " << start
<< abort(FatalError);
return NULL;
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:101,代码来源:treeNode.C
示例11: origin
// Intersect triangle with bounding box. Return true if
// any of the faces of bb intersect triangle.
// Note: so returns false if triangle inside bb.
bool Foam::triangleFuncs::intersectBb
(
const point& p0,
const point& p1,
const point& p2,
const treeBoundBox& cubeBb
)
{
const vector p10 = p1 - p0;
const vector p20 = p2 - p0;
// cubeBb points; counted as if cell with vertex0 at cubeBb.min().
const point& min = cubeBb.min();
const point& max = cubeBb.max();
const point& cube0 = min;
const point cube1(min.x(), min.y(), max.z());
const point cube2(max.x(), min.y(), max.z());
const point cube3(max.x(), min.y(), min.z());
const point cube4(min.x(), max.y(), min.z());
const point cube5(min.x(), max.y(), max.z());
const point cube7(max.x(), max.y(), min.z());
//
// Intersect all 12 edges of cube with triangle
//
point pInter;
pointField origin(4);
// edges in x direction
origin[0] = cube0;
origin[1] = cube1;
origin[2] = cube5;
origin[3] = cube4;
scalar maxSx = max.x() - min.x();
if (intersectAxesBundle(p0, p10, p20, 0, origin, maxSx, pInter))
{
return true;
}
// edges in y direction
origin[0] = cube0;
origin[1] = cube1;
origin[2] = cube2;
origin[3] = cube3;
scalar maxSy = max.y() - min.y();
if (intersectAxesBundle(p0, p10, p20, 1, origin, maxSy, pInter))
{
return true;
}
// edges in z direction
origin[0] = cube0;
origin[1] = cube3;
origin[2] = cube7;
origin[3] = cube4;
scalar maxSz = max.z() - min.z();
if (intersectAxesBundle(p0, p10, p20, 2, origin, maxSz, pInter))
{
return true;
}
// Intersect triangle edges with bounding box
if (cubeBb.intersects(p0, p1, pInter))
{
return true;
}
if (cubeBb.intersects(p1, p2, pInter))
{
return true;
}
if (cubeBb.intersects(p2, p0, pInter))
{
return true;
}
return false;
}
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:89,代码来源:triangleFuncs.C
示例12: nearest
}
// All the info for nearest. Construct to miss
List<mappedPatchBase::nearInfo> nearest(this->size());
const polyPatch& pp = bm[patchi];
if (pp.size() > 0)
{
labelList bndFaces(pp.size());
forAll(bndFaces, i)
{
bndFaces[i] = pp.start() + i;
}
treeBoundBox overallBb(pp.points());
Random rndGen(123456);
overallBb = overallBb.extend(rndGen, 1e-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
const indexedOctree<treeDataFace> boundaryTree
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh,
bndFaces // patch faces only
),
overallBb, // overall search domain
8, // maxLevel
开发者ID:EricAlex,项目名称:OpenFOAM-dev,代码行数:31,代码来源:patchProbes.C
注:本文中的treeBoundBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论