MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / getViewerPose

Method getViewerPose

visualization/src/pcl_visualizer.cpp:2024–2058  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

2022
2023/////////////////////////////////////////////////////////////////////////////////////////////
2024Eigen::Affine3f
2025pcl::visualization::PCLVisualizer::getViewerPose (int viewport)
2026{
2027 Eigen::Affine3f ret (Eigen::Affine3f::Identity ());
2028
2029 rens_->InitTraversal ();
2030 vtkRenderer* renderer = nullptr;
2031 if (viewport == 0)
2032 viewport = 1;
2033 int viewport_i = 1;
2034 while ((renderer = rens_->GetNextItem ()))
2035 {
2036 if (viewport_i == viewport)
2037 {
2038 vtkCamera& camera = *renderer->GetActiveCamera ();
2039 Eigen::Vector3d pos, x_axis, y_axis, z_axis;
2040 camera.GetPosition (pos[0], pos[1], pos[2]);
2041 camera.GetViewUp (y_axis[0], y_axis[1], y_axis[2]);
2042 camera.GetFocalPoint (z_axis[0], z_axis[1], z_axis[2]);
2043
2044 z_axis = (z_axis - pos).normalized ();
2045 x_axis = y_axis.cross (z_axis).normalized ();
2046
2047 ret.translation () = pos.cast<float> ();
2048 ret.linear ().col (0) << x_axis.cast<float> ();
2049 ret.linear ().col (1) << y_axis.cast<float> ();
2050 ret.linear ().col (2) << z_axis.cast<float> ();
2051
2052 return ret;
2053 }
2054 viewport_i ++;
2055 }
2056
2057 return ret;
2058}
2059
2060/////////////////////////////////////////////////////////////////////////////////////////////
2061void

Callers 7

getViewerPoseFunction · 0.80
getViewerPoseFunction · 0.80
getViewerPoseFunction · 0.80
getViewerPoseFunction · 0.80
TESTFunction · 0.80
mainFunction · 0.80
simulate_callbackFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64