46 #include <pcl/visualization/common/common.h>
47 #include <pcl/point_types.h>
48 #include <pcl/correspondence.h>
49 #include <pcl/point_cloud.h>
50 #include <pcl/common/io.h>
52 class vtkRenderWindow;
53 class vtkRenderWindowInteractor;
58 #include <vtkSmartPointer.h>
59 #include <vtkCommand.h>
64 namespace visualization
79 using Ptr = shared_ptr<PCLPlotter>;
93 PCLPlotter (
char const * name =
"PCL Plotter");
107 addPlotData (
double const *array_X,
108 double const *array_Y,
110 char const * name =
"Y Axis",
111 int type = vtkChart::LINE ,
112 char const *color=
nullptr);
122 addPlotData (std::vector<double>
const &array_x,
123 std::vector<double>
const &array_y,
124 char const * name =
"Y Axis",
125 int type = vtkChart::LINE,
126 std::vector<char>
const &color = std::vector<char> ());
135 addPlotData (std::vector<std::pair<double, double> >
const &plot_data,
136 char const * name =
"Y Axis",
137 int type = vtkChart::LINE,
138 std::vector<char>
const &color = std::vector<char>());
151 double x_min,
double x_max,
152 char const *name =
"Y Axis",
153 int num_points = 100,
154 int type = vtkChart::LINE,
155 std::vector<char>
const &color = std::vector<char>());
168 double x_min,
double x_max,
169 char const *name =
"Y Axis",
170 int num_points = 100,
171 int type = vtkChart::LINE,
172 std::vector<char>
const &color = std::vector<char>());
184 addPlotData (
double (*
function)(
double),
185 double x_min,
double x_max,
186 char const *name =
"Y Axis",
187 int num_points = 100,
188 int type = vtkChart::LINE,
189 std::vector<char>
const &color = std::vector<char>());
196 addPlotData (
char const * filename,
197 int type = vtkChart::LINE);
206 addHistogramData (std::vector<double>
const & data,
207 int const nbins = 10,
208 char const * name =
"Histogram",
209 std::vector<char>
const &color = std::vector<char>());
219 template <
typename Po
intT>
bool
222 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
233 const std::string &field_name,
234 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
244 template <
typename Po
intT>
bool
246 const std::string &field_name,
248 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
260 const std::string &field_name,
262 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
272 spinOnce (
const int spin_time = 1);
286 setColorScheme (
int scheme);
300 setBackgroundColor (
const double r,
const double g,
const double b);
306 setBackgroundColor (
const double color[3]);
312 getBackgroundColor ();
319 setXRange (
double min,
double max);
326 setYRange (
double min,
double max);
332 setTitle (
const char *title);
338 setXTitle (
const char *title);
344 setYTitle (
const char *title);
350 setShowLegend (
bool flag);
357 setWindowSize (
int w,
int h);
364 setWindowPosition (
int x,
int y);
370 setWindowName (
const std::string &name);
376 getWindowSize ()
const;
408 int win_width_, win_height_;
410 double bkg_color_[3];
411 std::string win_name_;
414 struct ExitMainLoopTimerCallback :
public vtkCommand
416 static ExitMainLoopTimerCallback* New ()
418 return (
new ExitMainLoopTimerCallback);
421 Execute (vtkObject*,
unsigned long event_id,
void* call_data)
override;
424 vtkRenderWindowInteractor *interactor;
427 struct ExitCallback :
public vtkCommand
429 static ExitCallback* New ()
431 return new ExitCallback;
434 Execute (vtkObject*,
unsigned long event_id,
void*)
override;
452 compute (PolynomialFunction
const & p_function,
double val);
459 compute (RationalFunction
const & r_function,
double val);
468 computeHistogram (std::vector<double>
const & data,
int const nbins, std::vector<std::pair<double, double> > &histogram);
473 #include <pcl/visualization/impl/pcl_plotter.hpp>
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.