Home

Awesome

Github licence

This is a point cloud viewer for R. The first goal of this package is to be an alternative backend to display point clouds in the lidR package in replacement of rgl. It is fully supported but one may consider that this package is under development (it works good enough to me but still have bugs).

rgl is an awesome package but has some difficulties displaying large point clouds. The lidRviewer package is able to display large point clouds consisting of several million points. So far I have tried it with over 30 million points and the display window remained fluid (smoothly pan, zoom and rotate).

Advantage of lidRviewer:

Drawbacks

Installation

GNU/Linux

sudo apt-get install libsdl2-dev freeglut3-dev
devtools::install_github("r-lidar-lab/lidRviewer")

Windows

devtools::install_github("r-lidar-lab/lidRviewer")

MacOS

brew install sdl2 mesa mesa-glu
devtools::install_github("r-lidar-lab/lidRviewer")

Usage

library(lidR)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile)
plot(las, backend = "lidRviewer")

How it works

Displaying huge point clouds in real time is a complex task. Advanced techniques often rely on Octrees to selectively display points within the camera field of view. These techniques are smart but not really appropriate for my low memory usage requirements. Considering how R stores data, constructing an Octree would require a full copy of the point cloud. This package uses some very naive optimization to render large point clouds in pseudo-real time:

So far it works well on my tests and the package can display as many points as the user wants (I stopped my tests after 35 million points [~1GB]).

Benchmark

On a core i7 with 11 million points.

PackageTime (s)Alloc memFluid
rgl15-201.2 GBno
lidRviewer< 11.0 MByes

'Time' is the time taken to open the Windows. 'Alloc mem' is the extra memory allocated by the call. 'Fluid' means you can rotate and zoom freely.