import { normalize_angle_rad } from "../normalize_angle_rad.js";

/**
 * TODO untested
 * https://math.stackexchange.com/questions/1596513/find-the-bearing-angle-between-two-points-in-a-2d-space
 * @param {number} x0 first vector X
 * @param {number} y0 first vector Y
 * @param {number} x1 second vector X
 * @param {number} y1 second vector Y
 * @returns {number} in radians
 */
export function v2_bearing_angle_towards(x0, y0, x1, y1) {

    const theta = Math.atan2(x1 - x0, y1 - y0 );

    return normalize_angle_rad(theta);
}