plot_qsm3d: Plot QSM Cylinders in 3D

View source: R/diagnostics.R

plot_qsm3dR Documentation

Plot QSM Cylinders in 3D

Description

Renders a 3D visualization of tree cylinders (from a Quantitative Structure Model, QSM) using actual geometric radii. Each cylinder is drawn between its start and end coordinates with the radius provided in the QSM data.

Usage

plot_qsm3d(qsm, bg = "white", color = "black", alpha = 0.7)

Arguments

qsm

A data frame or tibble containing QSM cylinder data with columns: startX, startY, startZ, endX, endY, endZ, and radius_cyl.

bg

Background color for the 3D plot. Defaults to "white".

color

Cylinder color. Defaults to "black".

alpha

Transparency level for cylinders, between 0 (fully transparent) and 1 (fully opaque). Defaults to 0.7.

Details

This function uses rgl to draw 3D cylinders representing each segment of a tree model. It is intended for visualizing QSM output such as that produced by PyTLidar or other tree reconstruction algorithms.

For large models, rendering may be slow because each cylinder is drawn as a separate mesh. Consider downsampling or filtering before plotting.

Value

Opens an interactive 3D rgl window with rendered cylinders. Returns NULL invisibly.

A 'ggplot' object combining multiple diagnostic panels.

Examples

# Load QSM output (example path)
qsm_file = system.file('extdata',"tree_0744_qsm.txt", package='tReeTraits')
qsm = load_qsm(qsm_file)
# Plot with real radii

plot_qsm3d(qsm, color = "forestgreen", alpha = 0.6)


tReeTraits documentation built on Feb. 26, 2026, 1:07 a.m.