Setting the scene

Data collection by TLS (Terrestrial Laser Scanning) in forest ecosystems leads to produce three-dimensional point clouds (Figure 1). A point cloud is a set of points with x, y, and z coordinates, to which can be associated ancillary information as intensity (https://doi.org/10.1016/j.agrformet.2019.107766) or RGB colors.

For forest structural analysis, it should be required to convert the x,y, and z coordinates in distance and angles (both azimuth and “slope”).

In this page, we describe the conversion procedure using R, with an example from TLS data collected in a forest ecosystem of Parco Nazionale del Circeo, Italy.

Figure 1: screenshot of a 3D-point-cloud collected in Parco Nazionale del Circeo, Italy.

Maths

The laser source is the origin P0 with coordinates [0, 0, 0]. Each point of the point cloud is Pi with coordinates [xi; yi; zi] (see Figure 2).

Figure 2: screenshot of a 3D-point-cloud collected in Parco Nazionale del Circeo, Italy.

The Euclidean distance di of the point Pi from the origin P0 is:

\[ d_i = \sqrt{(z_i - z_0)^2 + (y_i - y_0)^2 + (x_i - x_0)^2 } \]

The “slope” (i.e. θ, the “vertical” angle) over the horizon (i.e. the height of the scan) is:

θ = acos(zi / di)

while the last angle φ, i.e. the horizontal direction, can be calculated as:

φ = atan2(yi, xi)

General example

We use a a sample of three points as in Figure 3. Coordinates are described in the following chunk.

library(tidyverse)

pntcld <- tibble::tibble(
  x = c(5,  7,  3),
  y = c(1,  8,  5),
  z = c(2,  7, 11)
)

pntcld
## # A tibble: 3 x 3
##       x     y     z
##   <dbl> <dbl> <dbl>
## 1     5     1     2
## 2     7     8     7
## 3     3     5    11
pntcld |> 
  dplyr::mutate(
    d_i = sqrt((z - 0)^2 + (y - 0)^2 + (x - 0)^2),
    theta_i = acos(z / d_i)
  )
## # A tibble: 3 x 5
##       x     y     z   d_i theta_i
##   <dbl> <dbl> <dbl> <dbl>   <dbl>
## 1     5     1     2  5.48   1.20 
## 2     7     8     7 12.7    0.988
## 3     3     5    11 12.4    0.487

Figure 3: the 3D-point-cloud used for this general example..