Title: Synthetic Crook Deformations in Stem Point Clouds
Version: 0.1.0
Description: Simulates parameterized single- and double-directional stem deformations in tree point clouds derived from terrestrial or mobile laser scanning, enabling the generation of realistic synthetic datasets for training and validating machine learning models in wood defect detection, quality assessment, and precision forestry. For more details see Pires (2025) <doi:10.54612/a.7hln0kr0ta>.
License: MIT + file LICENSE
URL: https://github.com/raudep/crookR
BugReports: https://github.com/raudep/crookR/issues
Depends: R (≥ 4.2)
Imports: data.table, stats, utils
Suggests: knitr, lidR, rmarkdown, spelling, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: false
RoxygenNote: 7.3.3
NeedsCompilation: no
Packaged: 2025-10-30 15:20:29 UTC; rads0001
Author: Raul de Paula Pires ORCID iD [aut, cre]
Maintainer: Raul de Paula Pires <rauldepaulapires@gmail.com>
Repository: CRAN
Date/Publication: 2025-11-03 19:20:02 UTC

Backwards-compatible wrapper keeping your original name/signature

Description

Backwards-compatible wrapper keeping your original name/signature

Usage

Create_Krok(
  tree_stem,
  krok_length = 0.5,
  krok_start = 4,
  krok_type = "2dir",
  krok_deviation = 0.1,
  inflektion_X = 1/4,
  inflektion_ext = 1/2,
  az = 0,
  spar = 0.8
)

Arguments

tree_stem

tree stem point cloud (lidR::LAS or data.frame)

krok_length

range of the deformation along the stem's length

krok_start

start height of the crook

krok_type

single- or double-directional deviation

krok_deviation

extent of the deviation

inflektion_X

placement of double directional deviation

inflektion_ext

placement of double directional deviation

az

numeric degrees. Azimuth of lateral rotation (0 = X axis, 90 = Y axis). Default 0.

spar

smoothing parameter for stats::smooth.spline (0..1).

Value

Same class as input (LAS or data.frame object with crook deformation)


Apply a synthetic crook/krok deformation to a stem point cloud (LAS or XYZ)

Description

Generalization of your Create_Krok() that supports lidR::LAS or data.frames, arbitrary azimuth, and safer handling of edge cases.

Usage

crook_deform(
  x,
  krok_length = 0.5,
  krok_start = 4,
  krok_type = c("2dir", "1dir"),
  krok_deviation = 0.1,
  inflektion_X = 1/4,
  inflektion_ext = 1/2,
  az = 0,
  spar = 0.8
)

Arguments

x

LAS or data.frame with X,Y,Z (case-insensitive if data.frame).

krok_length

range of the deformation along the stem's length

krok_start

start height of the crook

krok_type

single- or double-directional deviation

krok_deviation

extent of the deviation

inflektion_X

placement of double directional deviation

inflektion_ext

placement of double directional deviation

az

numeric degrees. Azimuth of lateral rotation (0 = X axis, 90 = Y axis). Default 0.

spar

smoothing parameter for stats::smooth.spline (0..1).

Value

Same class as input (LAS or data.frame object with crook deformation)


Example stem point cloud (XYZ)

Description

A LiDAR-derived stem used in examples and tests.

Format

A data frame with 3 variables:

X

numeric, meters (local coord)

Y

numeric, meters

Z

numeric, meters above ground

Details

Points belong to a single Scots pine stem, pre-segmented.

Source

Synthetic/field data prepared for the crookR package.

Examples

data(example_stem)
head(example_stem)

mirror server hosted at Truenetwork, Russian Federation.