Skip to contents

[Experimental] Checks when the specified circle was first entered by a trajectory.

Usage

time_circle_entered(
  x_vector,
  y_vector,
  t_vector,
  x_mid = 0,
  y_mid = 0,
  radius = 1,
  include_radius = TRUE,
  warn = TRUE
)

Arguments

x_vector

x-coordinates of the executed path.

y_vector

y-coordinates of the executed path.

t_vector

Timestamps of the executed trajectory.

x_mid

x-coordinate of the center of the circle.

y_mid

y-coordinate of the center of the circle.

radius

radius of the center of the circle.

include_radius

Whether points lying exactly on the radius should be included in the circle. Defaults to TRUE.

warn

whether a warning should be thrown if the first entry of t_vector is returned. Defaults to TRUE.

Value

Value of t_vector at the first time at which the trajectory is in the circle.

References

Pfister, R., Tonn, S., Schaaf, M., Wirth, R. (2024). mousetRajectory: Mouse tracking analyses for behavioral scientists. The Quantitative Methods for Psychology, 20(3), 217-229. doi:10.20982/tqmp.20.3.p217

Examples

time_circle_entered(0:10, rep(0, 11), 0:10,
  x_mid = 10, y_mid = 0, radius = 1
)
#> [1] 9
time_circle_entered(0:10, rep(0, 11), 0:10,
  x_mid = 10, y_mid = 0, radius = 1,
  include_radius = FALSE
)
#> [1] 10