Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added updateCoordinateSystemPose(..) to PCLVisualizer. #569

Merged
merged 1 commit into from
Mar 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions visualization/include/pcl/visualization/pcl_visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,18 @@ namespace pcl
bool
updateShapePose (const std::string &id, const Eigen::Affine3f& pose);

/** \brief Set the pose of an existing coordinate system.
*
* Returns false if the coordinate system doesn't exist, true if the pose was successfully
* updated.
*
* \param[in] id the point cloud object id (i.e., given on \a addCoordinateSystem etc.)
* \param[in] pose the new pose
* \return false if no coordinate system with the specified ID was found
*/
bool
updateCoordinateSystemPose (const std::string &id, const Eigen::Affine3f& pose);

/** \brief Set the pose of an existing point cloud.
*
* Returns false if the point cloud doesn't exist, true if the pose was successfully
Expand Down
23 changes: 23 additions & 0 deletions visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,29 @@ pcl::visualization::PCLVisualizer::updateShapePose (const std::string &id, const
return (true);
}

/////////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::visualization::PCLVisualizer::updateCoordinateSystemPose (const std::string &id, const Eigen::Affine3f& pose)
{
ShapeActorMap::iterator am_it = coordinate_actor_map_->find (id);

vtkLODActor* actor;

if (am_it == coordinate_actor_map_->end ())
return (false);
else
actor = vtkLODActor::SafeDownCast (am_it->second);

vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New ();

convertToVtkMatrix (pose.matrix (), matrix);

actor->SetUserMatrix (matrix);
actor->Modified ();

return (true);
}

/////////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::visualization::PCLVisualizer::updatePointCloudPose (const std::string &id, const Eigen::Affine3f& pose)
Expand Down