-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpclviewer.cpp
More file actions
74 lines (66 loc) · 2.25 KB
/
pclviewer.cpp
File metadata and controls
74 lines (66 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "pclviewer.h"
#include <stdlib.h>
#include <vtkRenderWindow.h>
PCLViewer::PCLViewer(QWidget *parent)
:QVTKWidget(parent)
{
qDebug("Initializing PCLViewer");
viewer.reset(new pcl::visualization::PCLVisualizer("viewer",false));
// qDebug("Setting Render Window");
// SetRenderWindow(viewer->getRenderWindow());
qDebug("Setup interactor");
//viewer->setupInteractor(GetInteractor(), GetRenderWindow());
// ------------------------------------
// -----Create example point cloud-----
// ------------------------------------
// pcl::PointCloud<pcl::PointXYZ>::Ptr basic_cloud_ptr (new pcl::PointCloud<pcl::PointXYZ>);
// pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGB>);
// We're going to make an ellipse extruded along the z-axis. The colour for
// the XYZRGB cloud will gradually go from red to green to blue.
// uint8_t r(255), g(15), b(15);
// for (float z(-1.0); z <= 1.0; z += 0.05)
// {
// for (float angle(0.0); angle <= 360.0; angle += 5.0)
// {
// pcl::PointXYZ basic_point;
// basic_point.x = 0.5 * cosf((3.141/180.0)*angle);
// basic_point.y = sinf((3.141/180.0)*angle);
// basic_point.z = z;
// basic_cloud_ptr->points.push_back(basic_point);
// pcl::PointXYZRGB point;
// point.x = basic_point.x;
// point.y = basic_point.y;
// point.z = basic_point.z;
// point.r = 128;
// point.g = 128;
// point.b = 128;
// point_cloud_ptr->points.push_back(point);
// }
// if (z < 0.0)
// {
// r -= 12;
// g += 12;
// }
// else
// {
// g -= 12;
// b += 12;
// }
// }
// basic_cloud_ptr->width = (int) basic_cloud_ptr->points.size ();
// basic_cloud_ptr->height = 1;
// point_cloud_ptr->width = (int) point_cloud_ptr->points.size ();
// point_cloud_ptr->height = 1;
// viewer->addPointCloud(point_cloud_ptr, "cloud");
// viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "cloud");
qDebug("Updating QVTKWidget");
//update();
qDebug("Done updating");
}
QSize PCLViewer::sizeHint() const{
return QSize(50,50);
}
void PCLViewer::setRender(){
qDebug("Setting Render Window");
SetRenderWindow(viewer->getRenderWindow());
}