axis_distance {VoxR}R Documentation

Computes points distance to an axis of the cartesian coordinates system.

Description

Computes points distance to an axis of the cartesian coordinates system.

Usage

axis_distance(data, axis, message)

Arguments

data

a data.frame or data.table containing the x, y, z, ... coordinates of a point cloud or voxel cloud.

axis

charecter. Specifying the reference axis to compute the distance: "X", "Y" or "Z".

message

logical. If FALSE, messages are disabled. Default = TRUE.

Value

A vector containing the distance values of the points

References

Lecigne, B., Delagrange, S., & Messier, C. (2018). Exploring trees in three dimensions: VoxR, a novel voxel-based R package dedicated to analysing the complex arrangement of tree crowns. Annals of botany, 121(4), 589-601.

Examples

#- import tls data
tls=data.table::fread(system.file("extdata", "Tree_t0.asc", package="VoxR"))

#- compute distance to the Z axis
tls[,dist:=VoxR::axis_distance(tls,"Z")]

#- round distance values for visualization
tls[,dist:=round(dist*100)]

#- plot the distance to the Z axis
cols=rev(rainbow(max(tls$dist)+1,end=4/6)) # color scale
rgl::open3d()
rgl::plot3d(tls,col=cols[tls$dist+1],add=TRUE)

[Package VoxR version 1.0.0 Index]