Skip to content

Commit

Permalink
Order preserving sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed May 7, 2024
1 parent 9e05257 commit db82633
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ If you are viewing this file on CRAN, please check [the latest news on GitHub](h
## lidR v4.1.2 (Release date: )

- Fix: strongly improved arithmetic accuracy in `point_in_triangle` to improve the quality of delaunay triangulation interpolations and avoid local NAs

- Enhance: `decimate_points()` with `random()` now preserves the point ordering.

## lidR v4.1.1 (Release date: 2024-02-03)

Expand Down
7 changes: 6 additions & 1 deletion R/algorithm-dec.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ random = function(density, use_pulse = FALSE)
else
{
if (nrow(las@data) > n)
return(sample(1:nrow(las@data), n))
{
idx = sample(1:nrow(las@data), n)
idx = sort(idx)
return(idx)
}
else
return(1:nrow(las@data))
}
Expand Down Expand Up @@ -237,6 +241,7 @@ random_per_voxel = function(res = 1, n = 1)

selectedPulses <- sample(p, n)
selectedPulses <- pulseID %in% selectedPulses
selectedPulses <- sort(selectedPulses)

return(selectedPulses)
}

0 comments on commit db82633

Please sign in to comment.