get_center_of_mass: Get center of mass from tree bole segments QSM (X, Y, Z)

View source: R/traits_from_qsm.R

get_center_of_massR Documentation

Get center of mass from tree bole segments QSM (X, Y, Z)

Description

This function calculates the center of mass/volume from a QSM by estimating the centroid of cylinder locations, each weighted by their volume. Only trunk sections are included (e.g., 'branching_order == 0'). For center of mass, assumes constant density within segments.

Usage

get_center_of_mass(qsm)

Arguments

qsm

qsm object loaded from '[load_qsm]'.

Value

A tibble with one row and three numeric columns:

X

Volume-weighted X coordinate of the trunk center of mass (m).

Y

Volume-weighted Y coordinate of the trunk center of mass (m).

Z

Volume-weighted Z coordinate of the trunk center of mass (m).

Examples

qsm_file = system.file("extdata", "tree_0744_qsm.txt", package='tReeTraits')
qsm = load_qsm(qsm_file)
print(get_center_of_mass(qsm))

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