diff --git a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp index 26e414cf..d2f53c8b 100644 --- a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp +++ b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp @@ -1094,6 +1094,8 @@ int index_loop_closure_source = 0; int index_loop_closure_target = 0; int index_begin = 0; int index_end = 0; +//! Manual loop closure draws the trajectory only from index_begin to index_end (LIO segments editor) +bool loop_closure_trajectory_in_range = false; ColorScheme csPointCloud = CS_GRAD_INTENS; ColorScheme csTrajectory = CS_SOLID; @@ -2381,6 +2383,13 @@ void loop_closure_gui() const auto point_cloud_upper = session.point_clouds_container.point_clouds.size() - 1; ImGui::Checkbox("Render source as red target as blue", &session.pose_graph_loop_closure.render_source_as_red_target_as_blue); + ImGui::Checkbox("Show trajectory only in index range", &loop_closure_trajectory_in_range); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip( + "Draw the green trajectory only from 'index from' to 'index to' of the LIO segments editor (now %d - %d).\n" + "Display only: loop closure and ICP still use all scans.", + index_begin, + index_end); ImGui::Text("Num edge extended:"); @@ -4272,11 +4281,20 @@ void renderLoopClosure( // Pose-sequence trail across the whole session, as a chain of thick // green cylinders (sphere at each joint), sized relative to the current // zoom (app_state.camera.euler.translate.z) so it stays visible next to the point cloud. + // Only the LIO segments editor's index range when that is chosen and a range is set. + size_t trail_begin = 0; + size_t trail_end = pointClouds.size() - 1; + if (loop_closure_trajectory_in_range && index_end > index_begin && static_cast(index_begin) < pointClouds.size()) + { + trail_begin = static_cast(index_begin); + trail_end = std::min(static_cast(index_end), pointClouds.size() - 1); + } const float tubeRadius = std::max(0.005f, fabsf(app_state.camera.euler.translate.z) * 0.001f); bool first = true; Vector3 prev{}; - for (const auto& pc : pointClouds) + for (size_t i = trail_begin; i <= trail_end; ++i) { + const auto& pc = pointClouds[i]; Vector3 p = Vector3{ static_cast(pc.m_pose.translation().x()), static_cast(pc.m_pose.translation().y()), static_cast(pc.m_pose.translation().z()) };