r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
587 stars 132 forks source link

Don't update display after every sphere. #611

Closed dmurdoch closed 2 years ago

dmurdoch commented 2 years ago

Because spheres are added one at a time, the full display will be redrawn after each one, and that is very slow. This will speed it up quite a bit.

Jean-Romain commented 2 years ago

Thank you for this. I discovered this option yesterday after the discussion on stack-overflow (it was you btw) and this changed the way I understand rgl. This change was in my plan but thank you for the commit.

Following the discussion started here and here about rendering very huge point cloud like 1e8+ points I'm currently thinking about a spatially indexed rendering that only displays n points. The idea is to group the points into chunks at different level of resolution and display the point cloud by chunks. When the user zoom-in or out we can recompute which chunks are visible or not on the fly. Then, we can add new chunks to the rendering and remove chunks that are no longer visible. The goal being to maintain a constant amount of points (e.g 1e6) and increase the local density gradually when the user is zooming. With pop3d and saveSkip = rgl::par3d(skipRedraw = TRUE) I think it is doable to design something smooth.