From 837a76f6ffd2f3b223b585c47e3fe6f3625c0380 Mon Sep 17 00:00:00 2001 From: Ewing Kang Date: Mon, 20 Nov 2023 18:02:45 +0800 Subject: [PATCH 1/3] Fix the triggering in PickPointsInteractor when there are linesets presents Adds handling of LineSet that is similar to Mesh and PointCloud in SetPickableGeometry() --- .../gui/PickPointsInteractor.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cpp/open3d/visualization/gui/PickPointsInteractor.cpp b/cpp/open3d/visualization/gui/PickPointsInteractor.cpp index 8910c64f264..7637894e04f 100644 --- a/cpp/open3d/visualization/gui/PickPointsInteractor.cpp +++ b/cpp/open3d/visualization/gui/PickPointsInteractor.cpp @@ -13,8 +13,10 @@ #include "open3d/geometry/Image.h" #include "open3d/geometry/PointCloud.h" #include "open3d/geometry/TriangleMesh.h" +#include "open3d/geometry/LineSet.h" #include "open3d/t/geometry/PointCloud.h" #include "open3d/t/geometry/TriangleMesh.h" +#include "open3d/t/geometry/LineSet.h" #include "open3d/utility/Logging.h" #include "open3d/visualization/gui/Events.h" #include "open3d/visualization/rendering/MaterialRecord.h" @@ -161,15 +163,28 @@ void PickPointsInteractor::SetPickableGeometry( auto mesh = dynamic_cast(pg.geometry); auto tmesh = dynamic_cast(pg.tgeometry); + auto lineset = dynamic_cast(pg.geometry); + auto tlineset = + dynamic_cast(pg.tgeometry); if (cloud) { points_.insert(points_.end(), cloud->points_.begin(), cloud->points_.end()); } else if (mesh) { points_.insert(points_.end(), mesh->vertices_.begin(), mesh->vertices_.end()); - } else if (tcloud || tmesh) { - const auto &tpoints = (tcloud ? tcloud->GetPointPositions() - : tmesh->GetVertexPositions()); + } else if (lineset) { + points_.insert(points_.end(), cloud->points_.begin(), + lineset->points_.end()); + } + else if (tcloud || tmesh || tlineset) { + core::Tensor tpoints; + if(tcloud) { + tpoints = tcloud->GetPointPositions(); + } else if (tmesh) { + tpoints = tmesh->GetVertexPositions(); + } else if (tlineset) { + tpoints = tlineset->GetPointPositions(); + } const size_t n = tpoints.NumElements(); float *pts = (float *)tpoints.GetDataPtr(); points_.reserve(points_.size() + n); @@ -203,6 +218,7 @@ void PickPointsInteractor::SetPickableGeometry( // picking_scene_->AddGeometry(pg.name, tmesh, mat); } } + //TODO what about Lineset selection? } // add safety but invalid obj lookup_->Add("", points_.size()); From 4d00414d09e30c93647ac604013b9befe680054d Mon Sep 17 00:00:00 2001 From: Ewing Kang Date: Tue, 21 Nov 2023 08:47:51 +0800 Subject: [PATCH 2/3] Add description to the CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d91ac41c3c2..d4f0b86fce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * Check for support of CUDA Memory Pools at runtime (#4679) * Fix `toString`, `CreateFromPoints` methods and improve docs in `AxisAlignedBoundingBox`. 🐛📝 * Migrate Open3d documentation to furo theme ✨ (#6470) +* Fix geometry picker Error when LineSet objects are presented ## 0.13 From 9b3623a09a429dde6aeae6318214ec2e91ebe3f6 Mon Sep 17 00:00:00 2001 From: "Kang, Hsin-Yi" Date: Thu, 23 Nov 2023 19:10:12 +0800 Subject: [PATCH 3/3] Fix erroneous lineset iterators from previous bugfix --- cpp/open3d/visualization/gui/PickPointsInteractor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/open3d/visualization/gui/PickPointsInteractor.cpp b/cpp/open3d/visualization/gui/PickPointsInteractor.cpp index 7637894e04f..6ac47dc3a36 100644 --- a/cpp/open3d/visualization/gui/PickPointsInteractor.cpp +++ b/cpp/open3d/visualization/gui/PickPointsInteractor.cpp @@ -173,7 +173,7 @@ void PickPointsInteractor::SetPickableGeometry( points_.insert(points_.end(), mesh->vertices_.begin(), mesh->vertices_.end()); } else if (lineset) { - points_.insert(points_.end(), cloud->points_.begin(), + points_.insert(points_.end(), lineset->points_.begin(), lineset->points_.end()); } else if (tcloud || tmesh || tlineset) {