Learn R Programming

TreeLS (version 2.0.2)

tlsTransform: Simple operations on point cloud objects

Description

Apply transformations to the XYZ axes of a point cloud.

Usage

tlsTransform(
  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 an axis` coordinates - more details in the sections below.

bring_to_origin

logical - force point cloud origin to match c(0,0,0)? If TRUE, clears the header of the LAS object.

rotate

logical - rotate the point cloud to align the ground points horizontally (as in tlsRotate)?

Value

LAS object.

XYZ Manipulation

The xyz argument can take a few different forms. It is useful for shifting 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 preceded by a minus sign ('-') to reverse its coordinates.

Examples

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

### swap the Y and Z axes
zy = tlsTransform(tls, c('x', 'z', 'y'))
bbox(zy)
range(zy$Z)

### return an upside down point cloud
ud = tlsTransform(tls, c('x', 'y', '-z'))
bbox(ud)
range(ud$Z)
plot(zy)

### mirror all axes, then set the point cloud's starting point as the origin
rv = tlsTransform(tls, c('-x', '-y', '-z'), bring_to_origin=TRUE)
bbox(rv)
range(rv$Z)
# }

Run the code above in your browser using DataLab