voxelize {lacunr}R Documentation

Voxelize point cloud

Description

Bins point cloud data into 3D pixels, otherwise known as 'voxels'.

Usage

voxelize(x, edge_length, threads = 1L)

Arguments

x

A data.frame or data.table with columns containing the X, Y, and Z coordinates of every point. Any additional columns are ignored.

edge_length

A numeric vector of length 3, containing values for the desired X, Y, and Z dimensions of each voxel.

threads

The number of threads to use for computing the voxel data. Default is 1.

Value

A data object of class 'lac_voxels', which inherits from data.table. The output contains 4 columns: X, Y, Z, and N. The first three columns encode the spatial coordinates of each voxel while the fourth denotes the total number of points they contain.

Examples

# simulate a diagonal line of points with XYZ coordinates
pc <- data.frame(X = 0:99, Y = 0:99, Z = 0:99)
# convert point data to cubic voxels of length 5
voxelize(pc, edge_length = c(5,5,5))


[Package lacunr version 1.0.1 Index]