View source: R/starting_angle.R
starting_angle | R Documentation |
Computes the angle (in degrees) between a line,
defined by two points with coordinates (x0
, y0
)
and (x1
, y1
), and the specified axis.
starting_angle(x0, x1, y0, y1, swap_x_y = TRUE)
x0 |
x-value of the first point. |
x1 |
x-value of the second point. |
y0 |
y-value of the first point. |
y1 |
y-value of the second point. |
swap_x_y |
Whether to compute the angle relative to the x or y axis.
Defaults to |
If the angle is computed relative to the x axis, counterclockwise changes are counted as positive. If the angle is computed relative to the y axis, clockwise changes are counted as positive.
Angle in degrees with -180 <= angle <= 180
.
Wirth, R., Foerster, A., Kunde, W., & Pfister, R. (2020). Design choices: Empirical recommendations for designing two-dimensional finger tracking experiments. Behavior Research Methods, 52, 2394 - 2416. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3758/s13428-020-01409-0")}
# Note that not the mathematical definition of angle is used by default:
starting_angle(0, 1, 0, 0)
starting_angle(0, 1, 0, 0, swap_x_y = FALSE)
# angles are clockwise and relative to the y-axis.
# Note that return values are in the range [-180, 180], not [0, 360]:
starting_angle(0, -1, 0, -1)
starting_angle(0, 1, 0, -1, swap_x_y = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.