Convert from East-North-Up cartesian coordinates to polar coordinates.
cartesian_to_polar(cartesian, anchor = c(0, 0, 0), digits = NULL)
A data.table
with three columns describing the *XYZ* coordinates of a point cloud.
A numeric
vector of length three which describe the *XYZ* anchor coordinate for reference to get the polar coordinates. It assumes that the reference coordinates are c(X = 0, Y = 0, Z = 0)
as default.
A numeric
vector of length 1 describing the decimal numbers to round
the zenith and azimuth angles. If NULL
, round
does not apply. NULL
as default.
A data.table
with the zenith and azimuth angles (degrees), and the distance to the anchor coordinate.
It assumes that the positive *Z* axis is the reference vector for the zenith angle. Likewise, it assumes that the *Y* axis is the north-south direction (positive to negative) for the azimuth angle.
If a point from cartesian
presents the same *XY* coordinates than anchor
, angles
returns NA
.
data(pc_tree)
cartesian_to_polar(pc_tree)
#> zenith azimuth distance
#> 1: 89.99378 353.080497 9.215623
#> 2: 90.00000 353.062011 9.290530
#> 3: 89.75675 353.183855 9.186260
#> 4: 89.36618 352.786538 9.220790
#> 5: 89.46676 353.102336 9.213834
#> ---
#> 75844: 64.76840 6.018522 12.715288
#> 75845: 64.64248 5.945087 12.759614
#> 75846: 64.78163 6.383938 12.669886
#> 75847: 64.56638 6.213461 12.632573
#> 75848: 64.54022 6.314357 12.680940
anchor <- c(1, 1, 1)
cartesian_to_polar(pc_tree, anchor)
#> zenith azimuth distance
#> 1: 96.76843 345.480859 8.476392
#> 2: 96.71613 345.527651 8.550640
#> 3: 96.53739 345.566465 8.440816
#> 4: 96.08179 345.166127 8.475847
#> 5: 96.20083 345.502590 8.464203
#> ---
#> 75844: 67.05396 1.130537 11.337925
#> 75845: 66.90628 1.063065 11.382168
#> 75846: 67.06595 1.513200 11.287073
#> 75847: 66.83818 1.300411 11.250751
#> 75848: 66.79539 1.430717 11.297134