Learn R Programming

rTLS (version 0.2.5.6)

cartesian_to_polar: Cartesian to Polar Coordinates

Description

Convert from East-North-Up cartesian coordinates to polar coordinates.

Usage

cartesian_to_polar(cartesian, anchor = c(0, 0, 0), digits = NULL)

Value

A data.table with the zenith and azimuth angles (degrees), and the distance to the anchor coordinate.

Arguments

cartesian

A data.table with three columns describing the *XYZ* coordinates of a point cloud.

anchor

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.

digits

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.

Author

J. Antonio Guzmán Q.

Details

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.

See Also

polar_to_cartesian

Examples

Run this code

data(pc_tree)
cartesian_to_polar(pc_tree)
anchor <- c(1, 1, 1)
cartesian_to_polar(pc_tree, anchor)

Run the code above in your browser using DataLab