4 double radius,
double extent)
6 pcl::ModelCoefficients cylinder_coeff;
7 cylinder_coeff.values.resize(7);
8 cylinder_coeff.values[0] = pt_on_axis.x();
9 cylinder_coeff.values[1] = pt_on_axis.y();
10 cylinder_coeff.values[2] = pt_on_axis.z();
11 cylinder_coeff.values[3] = axis_direction.x() * extent;
12 cylinder_coeff.values[4] = axis_direction.y() * extent;
13 cylinder_coeff.values[5] = axis_direction.z() * extent;
14 cylinder_coeff.values[6] = radius;
15 return cylinder_coeff;
19 std::string handle_index,
double r,
double g,
double b)
22 pcl::visualization::PCLVisualizer
> *>(viewer_void);
24 for (std::size_t i = 0; i < shells.size(); i++)
26 std::string
id =
"cylinder" + handle_index + boost::lexical_cast < std::string > (i);
28 createCylinder(shells[i].getCentroid(), shells[i].getCurvatureAxis(), shells[i].getRadius(),
29 shells[i].getExtent()),
31 viewer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, r, g, b,
id);
32 viewer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_REPRESENTATION,
33 pcl::visualization::PCL_VISUALIZER_REPRESENTATION_SURFACE,
id);
34 viewer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, 0.4,
id);
39 Eigen::MatrixXd samples,
double target_radius)
42 viewer->setBackgroundColor(0, 0, 0);
43 pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGBA> rgb(cloud);
44 viewer->addPointCloud < pcl::PointXYZRGBA > (cloud, rgb,
"sample cloud");
45 viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3,
"sample cloud");
49 for (std::size_t i = 0; i < samples.cols(); i++)
52 center.x = samples(0, i);
53 center.y = samples(1, i);
54 center.z = samples(2, i);
55 std::string
id =
"sphere" + boost::lexical_cast < std::string > (i);
56 viewer->addSphere(center, target_radius * 0.6,
id);
57 viewer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 1.0, 0.0, 0.0,
id);
void createViewer(PointCloud::ConstPtr cloud, std::vector< CylindricalShell > shells, Eigen::MatrixXd samples, double target_radius)
boost::shared_ptr< pcl::visualization::PCLVisualizer > viewer
pcl::ModelCoefficients createCylinder(Eigen::Vector3d pt_on_axis, Eigen::Vector3d axis_direction, double radius, double extent)
void addCylinders(const std::vector< CylindricalShell > &shells, void *viewer_void, std::string handle_index="", double r=0.0, double g=1.0, double b=1.0)