Renders one frame of a skeleton in a perspective-like 3D projection using a lightweight base graphics backend (no external 3D dependency required).
Usage
plotSkeleton3D(
pe,
skeleton,
frame = 1,
azimuth = 35,
elevation = 20,
distance = 6,
show_labels = FALSE,
point_col = "steelblue",
segment_col = "gray40",
point_cex = 1.1,
segment_lwd = 1.5,
main = NULL,
draw = TRUE
)Arguments
- pe
A PhysioExperiment object with
position_x,position_y, andposition_zassays.- skeleton
A
SkeletonModelobject.- frame
Integer frame index.
- azimuth
View azimuth angle in degrees.
- elevation
View elevation angle in degrees.
- distance
Perspective distance (larger = weaker perspective).
- show_labels
Logical; if
TRUE, draws keypoint labels.- point_col
Point color.
- segment_col
Segment color.
- point_cex
Point size.
- segment_lwd
Segment line width.
- main
Plot title. If
NULL, auto-generated.- draw
Logical; if
TRUE, draws to current graphics device.
References
Winter DA (2009). "Biomechanics and Motor Control of Human Movement." 4th ed. John Wiley & Sons.
See also
plotSkeleton() for 2D skeleton visualization,
projectTo2D() for manual coordinate projection.
Examples
sk <- define_skeleton("BODY_25")
labels <- sk$keypoints$label
set.seed(42)
nk <- length(labels); nf <- 10
mk <- function(b) matrix(rep(b, each = nf), nf)
px <- mk(rnorm(nk, 0, 0.3)); py <- mk(rnorm(nk, 0, 0.3))
pz <- mk(seq(1.8, 0, length.out = nk))
colnames(px) <- colnames(py) <- colnames(pz) <- labels
pe <- PhysioExperiment(assays = S4Vectors::SimpleList(
position_x = px, position_y = py, position_z = pz),
colData = S4Vectors::DataFrame(label = labels, type = rep("keypoint", nk)),
samplingRate = 30)
plotSkeleton3D(pe, sk, frame = 1)