本文整理汇总了C++中ZSwcTree::boundBox方法的典型用法代码示例。如果您正苦于以下问题:C++ ZSwcTree::boundBox方法的具体用法?C++ ZSwcTree::boundBox怎么用?C++ ZSwcTree::boundBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZSwcTree
的用法示例。
在下文中一共展示了ZSwcTree::boundBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sqrt
std::vector<ZEllipsoid> ZSwcRangeAnalyzer::computeLayerRange(const ZSwcTree &tree)
{
std::vector<ZEllipsoid> range;
ZCuboid treeBound = tree.boundBox();
double zStart = treeBound.firstCorner().z();
double zEnd = treeBound.lastCorner().z();
ZSwcNodeZRangeSelector selector;
for (double z = zStart; z <= zEnd; z += m_zStep) {
selector.setZRange(z - m_zMargin, z + m_zMargin);
std::vector<Swc_Tree_Node*> nodeSet = selector.selectFrom(tree);
if (!nodeSet.empty()) {
ZCuboid bound = SwcTreeNode::boundBox(nodeSet.begin(), nodeSet.end());
ZEllipsoid ellipsoid;
ellipsoid.setCenter(bound.center());
double rxy = sqrt(bound.width() * bound.width() +
bound.height() * bound.height()) / 2.0;
ellipsoid.setSize(rxy, rxy, bound.depth() / 2.0);
range.push_back(ellipsoid);
}
}
return range;
}
示例2:
std::vector<ZPoint> ZSwcRangeAnalyzer::computerLayerCentroid(const ZSwcTree &tree)
{
std::vector<ZPoint> centroidArray;
ZCuboid treeBound = tree.boundBox();
double zStart = treeBound.firstCorner().z();
double zEnd = treeBound.lastCorner().z();
ZSwcNodeZRangeSelector selector;
for (double z = zStart; z <= zEnd; z += m_zStep) {
selector.setZRange(z - m_zMargin, z + m_zMargin);
std::vector<Swc_Tree_Node*> nodeSet = selector.selectFrom(tree);
if (!nodeSet.empty()) {
centroidArray.push_back(
SwcTreeNode::centroid(nodeSet.begin(), nodeSet.end()));
}
}
return centroidArray;
}