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

2D scene does not take point radii into account when calculating bounding box #1547

Open
roym899 opened this issue Mar 9, 2023 · 7 comments
Labels
🪳 bug Something isn't working 📺 re_viewer affects re_viewer itself

Comments

@roym899
Copy link
Collaborator

roym899 commented Mar 9, 2023

Describe the bug
Visualizing 2D points does not seem to work (with Python at least), while docs suggest 2D or 3D points should work.
Screenshot from 2023-03-09 18-25-25

To Reproduce
Steps to reproduce the behavior:

  1. Modify code from docs example
import rerun as rr
import numpy as np

rr.init("my data", spawn=True)

num_points = 100
dim_points = 2

positions = np.zeros((num_points, dim_points))
positions[:,0] = np.linspace(-10,10,num_points)

rr.log_points("my_points", positions=positions, radii=0.5)
  1. Run the code

Expected behavior
Should show a scatter plot.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04

Additional context
Python 3.8.11, rerun-sdk 0.3.0

@roym899 roym899 added 👀 needs triage This issue needs to be triaged by the Rerun team 🪳 bug Something isn't working labels Mar 9, 2023
@Wumpf Wumpf added 📺 re_viewer affects re_viewer itself and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels Mar 9, 2023
@Wumpf
Copy link
Member

Wumpf commented Mar 9, 2023

Thanks for the detailed report with repro!

@jleibs
Copy link
Member

jleibs commented Mar 9, 2023

I believe this is related to #1113

This is another (much more serious) case of the bounding box being too small for the content.

One of the easiest (though admittedly hacky) ways to force a larger bounding box is to log one explicitly with a rect.

For example, if I use:

rr.log_rect("bounds", [-10, -10, 20, 20])
rr.log_points("my_points", positions=positions, radii=0.5)

Then the points become visible:
image

@emilk
Copy link
Member

emilk commented Mar 11, 2023

Seems like the points are somehow missed by the bounding box calculations, but I don't see how they could be… weird.

@emilk emilk added the good first issue Good for newcomers label Mar 11, 2023
@jleibs
Copy link
Member

jleibs commented Mar 11, 2023

I don’t think they’re missed. They just don’t have their radius taken into account. These points all lie on a horizontal line and so I suspect the bounding box here ends up having zero height.

@emilk
Copy link
Member

emilk commented Mar 11, 2023

Ah right, that makes sense. Sounds like an easy enough thing to fix then.

@emilk emilk changed the title log_points not working with 2D points 2D scene does not take point radii into account when calculating bounding box Mar 21, 2023
@jleibs jleibs self-assigned this Mar 21, 2023
@jleibs jleibs removed the good first issue Good for newcomers label Mar 21, 2023
@jleibs
Copy link
Member

jleibs commented Mar 21, 2023

This turns out to get quite complicated quite quickly -- not actually a good first issue. I started working on it here: #1658

Although that kind of solves one edge case there is a long tail of issues such as supporting auto for points, handling lines, appropriately, and the fact that the future staging belt design means accessing this data from the builder may be an anti-pattern we should be moving away from.

The better short-term solution here might be to give manual control of changing the bounding box for 2d views as a scene property so we have an escape hatch.

@emilk emilk unassigned jleibs Apr 3, 2023
@abey79
Copy link
Member

abey79 commented Nov 6, 2024

The map view suffers from the same issue for the same reason. It's probably even more complicated to solve, as the scene unit to ui point relationship varies based on the latitude (in addition to whatever current "camera" setting the view has).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

No branches or pull requests

5 participants