Learn R Programming

TreeLS (version 1.0)

tlsAlter: Alter point cloud's coordinates

Description

Apply transformations to the XYZ axes of a point cloud.

Usage

tlsAlter(las, xyz = c("X", "Y", "Z"), bring_to_origin = FALSE,
  rotate = FALSE)

Arguments

las

LAS object.

xyz

character vector of length 3 - las' columns to be reassigned as XYZ, respectively. Use minus signs to mirror the axes' coordinates - more details in the sections below.

bring_to_origin

logical - force output to start at c(0,0,0)? If TRUE, removes any geographical information from the output.

rotate

logical - rotate the point cloud to align the ground points horizontally? If TRUE, removes any geographical information from the output. Checkout tlsRotate for more information.

Value

LAS object.

XYZ Manipulation

The xyz argument can take a few different forms, it is useful to shift axes positions in a point cloud or to mirror an axis' coordinates. All axes characters can be entered in lower or uppercase and also be preceeded by a minus sign ('-'), indicating to invert (mirror) the axis' coordinates in the output. Check the examples section for a practical overview.

Examples

Run this code
# NOT RUN {
file = system.file("extdata", "pine.laz", package="TreeLS")
tls = readTLS(file)

### swap the Y and Z axes
zy = tlsAlter(tls, c('x', 'z', 'y'))
bbox(zy)
range(zy$Z)
plot(zy, clear_artifacts=FALSE)
rgl::axes3d(col='white')

### return an upside down point cloud
ud = tlsAlter(tls, c('x', 'y', '-z'))
bbox(ud)
range(ud$Z)
plot(zy, clear_artifacts=FALSE)
rgl::axes3d(col='white')

### mirror all axes, then set the point cloud's starting point as the origin
rv = tlsAlter(tls, c('-x', '-y', '-z'), bring_to_origin=TRUE)
bbox(rv)
range(rv$Z)
plot(rv, clear_artifacts=FALSE)
rgl::axes3d(col='white')

# }

Run the code above in your browser using DataLab