isl-org / isl-org/Open3D

fix for example: mouse-and-point-coord-py

Open
#5,593 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

I believe there is a small bug in the example "mouse-and-point-coord-py" on line 102.
https://github.com/isl-org/Open3D/blob/master/examples/python/visualization/mouse_and_point_coord.py

Fix: using x,y instead of event.x and event.y when calling unproject as pixel coordinates need to be relative to the scene's widget frame origin

FROM:
```
world = self.widget3d.scene.camera.unproject(
event.x, event.y, depth, self.widget3d.frame.width,
self.widget3d.frame.height)
```

TO:

```
world = self.widget3d.scene.camera.unproject(
x, y, depth, self.widget3d.frame.width,
self.widget3d.frame.height)
```

### Steps to reproduce the bug

1) Create a window with two scenes side by side
2) attach a mouse callback to each scene

left scene will have a correct unproject, while the right scene will not.

this change fixes the problem.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.