38 #ifndef PCL_VISUALUALIZATION_PCL_PLOTTER_IMPL_H_
39 #define PCL_VISUALUALIZATION_PCL_PLOTTER_IMPL_H_
45 namespace visualization
48 template <
typename Po
intT>
bool
51 const std::string &
id,
int win_width,
int win_height)
53 std::vector<double> array_x(hsize), array_y(hsize);
56 for (
int i = 0; i < hsize; ++i)
59 array_y[i] = cloud[0].histogram[i];
62 this->
addPlotData(array_x, array_y,
id.c_str(), vtkChart::LINE);
68 template <
typename Po
intT>
bool
71 const std::string &field_name,
73 const std::string &
id,
int win_width,
int win_height)
75 if (index < 0 || index >= cloud.
size ())
77 PCL_ERROR (
"[addFeatureHistogram] Invalid point index (%d) given!\n", index);
82 std::vector<pcl::PCLPointField> fields;
84 int field_idx = pcl::getFieldIndex<PointT> (cloud, field_name, fields);
87 PCL_ERROR (
"[addFeatureHistogram] The specified field <%s> does not exist!\n", field_name.c_str ());
91 int hsize = fields[field_idx].count;
92 std::vector<double> array_x (hsize), array_y (hsize);
94 for (
int i = 0; i < hsize; ++i)
99 memcpy (&data,
reinterpret_cast<const char*
> (&cloud[index]) + fields[field_idx].offset + i *
sizeof (
float),
sizeof (
float));
103 this->
addPlotData(array_x, array_y,
id.c_str(), vtkChart::LINE);