45 #include <pcl/visualization/common/common.h>
46 #include <pcl/point_types.h>
47 #include <pcl/correspondence.h>
48 #include <pcl/point_cloud.h>
49 #include <pcl/common/io.h>
51 #include <vtkContextView.h>
52 #include <vtkChartXY.h>
53 #include <vtkColorSeries.h>
54 #include <vtkSmartPointer.h>
55 #include <vtkCommand.h>
58 class vtkRenderWindow;
59 class vtkRenderWindowInteractor;
63 namespace visualization
78 using Ptr = shared_ptr<PCLPlotter>;
92 PCLPlotter (
char const * name =
"PCL Plotter");
106 addPlotData (
double const *array_X,
107 double const *array_Y,
109 char const * name =
"Y Axis",
110 int type = vtkChart::LINE ,
111 char const *color=
nullptr);
121 addPlotData (std::vector<double>
const &array_x,
122 std::vector<double>
const &array_y,
123 char const * name =
"Y Axis",
124 int type = vtkChart::LINE,
125 std::vector<char>
const &color = std::vector<char> ());
134 addPlotData (std::vector<std::pair<double, double> >
const &plot_data,
135 char const * name =
"Y Axis",
136 int type = vtkChart::LINE,
137 std::vector<char>
const &color = std::vector<char>());
150 double x_min,
double x_max,
151 char const *name =
"Y Axis",
152 int num_points = 100,
153 int type = vtkChart::LINE,
154 std::vector<char>
const &color = std::vector<char>());
167 double x_min,
double x_max,
168 char const *name =
"Y Axis",
169 int num_points = 100,
170 int type = vtkChart::LINE,
171 std::vector<char>
const &color = std::vector<char>());
183 addPlotData (
double (*
function)(
double),
184 double x_min,
double x_max,
185 char const *name =
"Y Axis",
186 int num_points = 100,
187 int type = vtkChart::LINE,
188 std::vector<char>
const &color = std::vector<char>());
195 addPlotData (
char const * filename,
196 int type = vtkChart::LINE);
205 addHistogramData (std::vector<double>
const & data,
206 int const nbins = 10,
207 char const * name =
"Histogram",
208 std::vector<char>
const &color = std::vector<char>());
218 template <
typename Po
intT>
bool
221 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
232 const std::string &field_name,
233 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
243 template <
typename Po
intT>
bool
245 const std::string &field_name,
247 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
259 const std::string &field_name,
261 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
271 spinOnce (
const int spin_time = 1);
285 setColorScheme (
int scheme);
299 setBackgroundColor (
const double r,
const double g,
const double b);
305 setBackgroundColor (
const double color[3]);
311 getBackgroundColor ();
318 setXRange (
double min,
double max);
325 setYRange (
double min,
double max);
331 setTitle (
const char *title);
337 setXTitle (
const char *title);
343 setYTitle (
const char *title);
349 setShowLegend (
bool flag);
356 setWindowSize (
int w,
int h);
363 setWindowPosition (
int x,
int y);
369 setWindowName (
const std::string &name);
375 getWindowSize ()
const;
407 int win_width_, win_height_;
409 double bkg_color_[3];
410 std::string win_name_;
413 struct ExitMainLoopTimerCallback :
public vtkCommand
415 static ExitMainLoopTimerCallback* New ()
417 return (
new ExitMainLoopTimerCallback);
420 Execute (vtkObject*,
unsigned long event_id,
void* call_data)
override;
423 vtkRenderWindowInteractor *interactor;
426 struct ExitCallback :
public vtkCommand
428 static ExitCallback* New ()
430 return new ExitCallback;
433 Execute (vtkObject*,
unsigned long event_id,
void*)
override;
451 compute (PolynomialFunction
const & p_function,
double val);
458 compute (RationalFunction
const & r_function,
double val);
467 computeHistogram (std::vector<double>
const & data,
int const nbins, std::vector<std::pair<double, double> > &histogram);
472 #include <pcl/visualization/impl/pcl_plotter.hpp>
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
shared_ptr< const PCLPlotter > ConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points. ...
std::vector< double > PolynomialFunction
A representation of polynomial function.
shared_ptr< PCLPlotter > Ptr
std::pair< PolynomialFunction, PolynomialFunction > RationalFunction
A representation of rational function, defined as the ratio of two polynomial functions.