////////////////////////////////////////////////////////////////////////////////////////
| 2022 | |
| 2023 | ///////////////////////////////////////////////////////////////////////////////////////////// |
| 2024 | Eigen::Affine3f |
| 2025 | pcl::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 | ///////////////////////////////////////////////////////////////////////////////////////////// |
| 2061 | void |
no outgoing calls