Trajr angle computation"

knitr::opts_chunk$set(echo = TRUE)
library(trajr)
library(ggplot2)
# create test traj
testdf = data.frame(x = c(1,1,2,3,4,5,5,5,5,6,7), y = c(1,2,3,3,4,3,3,3,3,2,2))
trj = TrajFromCoords(testdf)

# visualize traj (three steps with zero movement at P(5|3))
ggplot(trj, aes(x = x, y= y)) +
  geom_point() +
  geom_line() +
  theme(aspect.ratio = 1)

# compute angles
angles = TrajAngles(trj)
print(angles)


# for me, angles[5]  and angles [8] should be "NA" (this is how it is implemented in the "traja" python package: https://joss.theoj.org/papers/10.21105/joss.03202)


Try the trajr package in your browser

Any scripts or data that you put into this service are public.

trajr documentation built on July 9, 2023, 6:03 p.m.