Rotates coordinates in Cartesian space based on two alignment points. The rotation aligns these points either with the 0-degree axis (parallel) or makes them perpendicular to it. This is particularly useful for creating egocentric reference frames or standardizing orientation across multiple frames or individuals.
Arguments
- data
movement data frame with columns: time, individual, keypoint, x, y
- alignment_points
character vector of length 2 specifying the keypoint names to use for alignment
- align_perpendicular
logical; if TRUE, alignment_points will be rotated to be perpendicular to the 0-degree axis. If FALSE (default), alignment_points will be rotated to align with the 0-degree axis