本文整理汇总了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");
}
}