Skip to content

Commit

Permalink
[OCTREE] Save the point size setting between different depth.
Browse files Browse the repository at this point in the history
  • Loading branch information
frozar committed Sep 7, 2017
1 parent 23ad9d2 commit c361bdc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/octree_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class OctreeViewer
wireframe (true),
show_cubes_ (true),
show_centroids_ (false),
show_original_points_ (false)
show_original_points_ (false),
point_size_ (1.0)
{

//try to load the cloud
Expand Down Expand Up @@ -130,6 +131,7 @@ class OctreeViewer
//bool to decide what should be display
bool wireframe;
bool show_cubes_, show_centroids_, show_original_points_;
float point_size_;
//========================================================

/* \brief Callback to interact with the keyboard
Expand Down Expand Up @@ -173,6 +175,16 @@ class OctreeViewer
wireframe = false;
update ();
}
else if ((event.getKeyCode () == '-') && event.keyDown ())
{
point_size_ = std::max(1.0f, point_size_ * (1 / 2.0f));
update ();
}
else if ((event.getKeyCode () == '+') && event.keyDown ())
{
point_size_ *= 2.0f;
update ();
}
}

/* \brief Graphic loop for the viewer
Expand Down Expand Up @@ -265,13 +277,15 @@ class OctreeViewer
//show centroid points
pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZ> color_handler (cloudVoxel, "x");
viz.addPointCloud (cloudVoxel, color_handler, "cloud_centroid");
viz.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, point_size_, "cloud_centroid");
}

if (show_original_points_)
{
//show origin point cloud
pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZ> color_handler (cloud, "z");
viz.addPointCloud (cloud, color_handler, "cloud");
viz.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, point_size_, "cloud");
}
}

Expand Down

0 comments on commit c361bdc

Please sign in to comment.