# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile)
# Cloud of points is voxelized with a 3-meter resolution and in each voxel
# the number of points is computed.
grid_metrics3d(las, length(Z), 3)
# Cloud of points is voxelized with a 3-meter resolution and in each voxel
# the mean scan angle of points is computed.
grid_metrics3d(las, mean(Intensity), 3)
# }
# NOT RUN {
# Define your own metric function
myMetrics = function(i)
{
ret = list(
npoints = length(i),
imean = mean(i)
)
return(ret)
}
voxels = grid_metrics3d(las, myMetrics(Intensity), 3)
plot(voxels, color = "imean")
#etc.
# }
Run the code above in your browser using DataLab