Skip to content

Commit

Permalink
Fix the triggering in PickPointsInteractor when there are linesets pr… (
Browse files Browse the repository at this point in the history
#6499)

* Fix the triggering in PickPointsInteractor when there are linesets presents
* Adds handling of LineSet that is similar to Mesh and PointCloud in SetPickableGeometry()

---------

Co-authored-by: Ewing Kang <ewing_kang@glorymakeup.com>
Co-authored-by: Sameer Sheorey <sameer.sheorey@intel.com>
  • Loading branch information
3 people authored Dec 26, 2023
1 parent bd869d4 commit a590c77
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Add Doppler ICP in tensor registration pipeline (PR #5237)
- Rename master branch to main.
- Support in memory loading of XYZ files
- Fix geometry picker Error when LineSet objects are presented (PR #6499)

## 0.13

Expand Down
21 changes: 18 additions & 3 deletions cpp/open3d/visualization/gui/PickPointsInteractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#include <unordered_set>

#include "open3d/geometry/Image.h"
#include "open3d/geometry/LineSet.h"
#include "open3d/geometry/PointCloud.h"
#include "open3d/geometry/TriangleMesh.h"
#include "open3d/t/geometry/LineSet.h"
#include "open3d/t/geometry/PointCloud.h"
#include "open3d/t/geometry/TriangleMesh.h"
#include "open3d/utility/Logging.h"
Expand Down Expand Up @@ -161,15 +163,27 @@ void PickPointsInteractor::SetPickableGeometry(
auto mesh = dynamic_cast<const geometry::TriangleMesh *>(pg.geometry);
auto tmesh =
dynamic_cast<const t::geometry::TriangleMesh *>(pg.tgeometry);
auto lineset = dynamic_cast<const geometry::LineSet *>(pg.geometry);
auto tlineset =
dynamic_cast<const t::geometry::LineSet *>(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(), lineset->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);
Expand Down Expand Up @@ -203,6 +217,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());
Expand Down

0 comments on commit a590c77

Please sign in to comment.