# grid_metrics3d

0th

Percentile

##### Voxelize the space and compute metrics for each voxel

Voxelize the cloud of points and compute a series of descriptive statistics for each voxel.

##### Usage
grid_metrics3d(.las, func, res = 1)
##### Arguments
.las

An object of class LAS

func

the function to be apply to each voxel.

res

numeric. The size of the voxels

##### Details

Voxelize creates a 3D matrix of voxels with a given resolution. It creates a voxel from the cloud of points if there is at least one point in the voxel. For each voxel the function allows computation of one or several derived metrics in the same way as the grid_metrics functions. Basically there are no predefined metrics. Users must write their own function to create metrics. Voxelize will dispatch the LiDAR data for each voxel in the user's function. The user writes their function without considering voxels, only a cloud of points (see example).

##### Value

It returns a data.table containing the metrics for each voxel. The table has the class lasmetrics3d enabling easier plotting.

grid_metrics

##### Aliases
• grid_metrics3d
##### Examples
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")

# Cloud of points is voxelized with a 1-meter resolution and in each voxel
# the number of points is computed.
grid_metrics3d(lidar, length(Z))

# Cloud of points is voxelized with a 1-meter resolution and in each voxel
# the mean scan angle of points is computed.
grid_metrics3d(lidar, mean(ScanAngle))

# Define your own metric function
myMetrics = function(i, angle, pulseID)
{
ret = list(
npulse  = length(unique(pulseID)),
angle   = mean(angle),
imean   = mean(i)
)

return(ret)
}

voxels = grid_metrics3d(lidar, myMetrics(Intensity, ScanAngle, pulseID))

plot(voxels, "angle")
plot(voxels, "imean")
#etc.
# }

Documentation reproduced from package lidR, version 1.0.2, License: GPL-3

### Community examples

Looks like there are no examples yet.