当前位置: 首页>>代码示例>>C++>>正文


C++ PCLVisualizer::addSphere方法代码示例

本文整理汇总了C++中PCLVisualizer::addSphere方法的典型用法代码示例。如果您正苦于以下问题:C++ PCLVisualizer::addSphere方法的具体用法?C++ PCLVisualizer::addSphere怎么用?C++ PCLVisualizer::addSphere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PCLVisualizer的用法示例。


在下文中一共展示了PCLVisualizer::addSphere方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateViewer

void updateViewer (ORROctree& octree, PCLVisualizer& viz, std::vector<ORROctree::Node*>::iterator leaf)
{
    viz.removeAllShapes();

    const float *b = (*leaf)->getBounds (), *center = (*leaf)->getData ()->getPoint ();
    float radius = 0.1f*octree.getRoot ()->getRadius ();

    // Add the main leaf as a cube
    viz.addCube (b[0], b[1], b[2], b[3], b[4], b[5], 0.0, 0.0, 1.0, "main cube");

    // Get all full leaves intersecting a sphere with certain radius
    std::list<ORROctree::Node*> intersected_leaves;
    octree.getFullLeavesIntersectedBySphere(center, radius, intersected_leaves);

    char cube_id[128];
    int i = 0;

    // Show the cubes
    for ( std::list<ORROctree::Node*>::iterator it = intersected_leaves.begin () ; it != intersected_leaves.end () ; ++it )
    {
        sprintf(cube_id, "cube %i", ++i);
        b = (*it)->getBounds ();
        viz.addCube (b[0], b[1], b[2], b[3], b[4], b[5], 1.0, 1.0, 0.0, cube_id);
    }

    // Get a random full leaf on the sphere defined by 'center' and 'radius'
    ORROctree::Node *rand_leaf = octree.getRandomFullLeafOnSphere (center, radius);
    if ( rand_leaf )
    {
        pcl::ModelCoefficients sphere_coeffs;
        sphere_coeffs.values.resize (4);
        sphere_coeffs.values[0] = rand_leaf->getCenter ()[0];
        sphere_coeffs.values[1] = rand_leaf->getCenter ()[1];
        sphere_coeffs.values[2] = rand_leaf->getCenter ()[2];
        sphere_coeffs.values[3] = 0.5f*(b[1] - b[0]);
        viz.addSphere (sphere_coeffs, "random_full_leaf");
    }
}
开发者ID:,项目名称:,代码行数:38,代码来源:


注:本文中的PCLVisualizer::addSphere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。