Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the triggering in PickPointsInteractor when there are linesets pr… #6499

Merged
merged 5 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading