Skip to content

Commit

Permalink
Doc and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Aug 25, 2024
1 parent e9f3757 commit 1879315
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 41 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(plot)
export(plot_xyzrgb)
exportMethods(plot)
importClassesFrom(lidR,LAS)
importFrom(Rcpp,evalCpp)
useDynLib(lidRviewer, .registration = TRUE)
37 changes: 24 additions & 13 deletions R/plot.R
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
#' Display big 3D point clouds
#'
#' Display aritrary large in memory 3D point clouds. This function does no lag and can display
#' almost instantly millions of points. It is optimized to used the lowest possible memory
#' and is capable of displaying gigabytes of points allocating only few megabyte of memory
#' Display arbitrary large in memory 3D point clouds from the lidR package. Keyboard can be use
#' to control the rendering
#' - Rotate with left mouse button
#' - Zoom with mouse wheel
#' - Pan with right mouse button
#' - Keyboard <kbd>r</kbd> or <kbd>g</kbd> or <kbd>b</kbd> to color with RGB
#' - Keyboard <kbd>z</kbd> to color with Z
#' - Keyboard <kbd>i</kbd> to color with Intensity
#' - Keyboard <kbd>c</kbd> to color with Classification
#' - Keyboard <kbd>+</kbd> or <kbd>-</kbd> to change the point size
#' - Keyboard <kbd>l</kbd> to enable/disable eyes-dome lightning
#'
#' @param x A \code{LAS*} object from the lidR package
#' @param x a point cloud with minimally 3 columns named X,Y,Z
#' @param y Unused (inherited from R base)
#' @export
#' @method plot LAS
#' @importClassesFrom lidR LAS
#' @useDynLib lidRviewer, .registration = TRUE
#' @importFrom Rcpp evalCpp
setGeneric("plot", function(x, y, ...) standardGeneric("plot"))

#' @rdname plot
#' @md
setMethod("plot", signature(x = "LAS", y = "missing"), function(x, y, ...)
{
plot.LAS(x, y, ...)
viewer(x@data)
})

plot.LAS <- function(x, y, ...)
#' @rdname plot
setMethod("plot", signature(x = "data.frame", y = "missing"), function(x, y, ...)
{
viewer(x@data)
}
viewer(x)
})

#' @aliases plot
#' @rdname plot
#' Deprecated backward compatible function
#'
#' @param x,y,z numeric vector
#' @param r,g,b integer vector
#' @param id index
#' @param size not used
#' @export
plot_xyzrgb <- function(x, y, z, r, g, b, id = NULL, size = 4)
{
Expand Down
28 changes: 28 additions & 0 deletions man/plot-LAS-missing-method.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions man/plot.Rd

This file was deleted.

20 changes: 20 additions & 0 deletions man/plot_xyzrgb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Drawer::Drawer(SDL_Window *window, DataFrame df)

auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> duration = end - start;
printf("Indexation: %.1lf seconds (%.1lfM pts/s)\n", duration.count(), x.size()/duration.count()/1000000);
//printf("Indexation: %.1lf seconds (%.1lfM pts/s)\n", duration.count(), x.size()/duration.count()/1000000);

this->point_budget *= 10;
camera.changed = true;
Expand Down Expand Up @@ -340,11 +340,11 @@ bool Drawer::draw()
std::chrono::duration<double> query_duration = end_query - start_query;
std::chrono::duration<double> rendering_duration = end_rendering - start_rendering;

printf("Displayed %dk/%ldk points (%.1f\%)\n", (int)pp.size()/1000, x.size()/1000, (double)pp.size()/(double)x.size()*100);
/*printf("Displayed %dk/%ldk points (%.1f\%)\n", (int)pp.size()/1000, x.size()/1000, (double)pp.size()/(double)x.size()*100);
printf("Full Rendering: %.3f seconds (%.1f fps)\n", total_duration.count(), 1.0f/total_duration.count());
printf("Cloud rendering: %.3f seconds (%.1f fps, %.1f\%)\n", rendering_duration.count(), 1.0f/rendering_duration.count(), rendering_duration.count()/total_duration.count()*100);
printf("Spatial query: %.3f seconds (%.1f fps %.1f\%)\n", query_duration.count(), 1.0f/query_duration.count(), query_duration.count()/total_duration.count()*100);
printf("\n");
printf("\n");*/

glFlush();
SDL_GL_SwapWindow(window);
Expand Down

0 comments on commit 1879315

Please sign in to comment.