# 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(ScanAngle), 3)
# }
# NOT RUN {
# Define your own metric function
myMetrics = function(i, angle)
{
ret = list(
npoints = length(i),
angle = mean(angle),
imean = mean(i)
)
return(ret)
}
voxels = grid_metrics3d(las, myMetrics(Intensity, ScanAngle), 3)
plot(voxels, color = "angle")
plot(voxels, color = "imean")
#etc.
# }
Run the code above in your browser using DataLab