Description Usage Arguments Value References Examples

View source: R/point_distance.R

Computes the distance of a set of points to a user defined point.

1 | ```
point_distance(data, point, message)
``` |

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

`point` |
a vector of length 3 containing the x, y and z coordintes of the reference point. |

`message` |
logical. If FALSE, messages are disabled. Default = TRUE. |

A vector containing the distance values of the points.

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.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
#- import tls data
tls=data.table::fread(system.file("extdata", "Tree_t0.asc", package="VoxR"))
#- compute distance to the crown centre
tls[,dist:=VoxR::point_distance(tls,c(mean(x),mean(y),mean(z)))]
#- round distance values for visualization
tls[,dist:=round(dist*100)]
#- plot the distance to crown centre
cols=rev(rainbow(max(tls$dist)+1,end=4/6)) # color scale
rgl::open3d()
rgl::plot3d(tls,col=cols[tls$dist+1],add=TRUE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.