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

/**
 * Compute interior angle between three points
 * Computed angle is around point B
 * @param {{x:number, y:number, z:number}} a
 * @param {{x:number, y:number, z:number}} b
 * @param {{x:number, y:number, z:number}} c
 * @returns {number} angle in radians
 */
export function v3_compute_interior_angle(a, b, c) {
    //compute AB delta
    const d_ab_x = a.x - b.x;
    const d_ab_y = a.y - b.y;
    const d_ab_z = a.z - b.z;

    //compute CB delta
    const d_cb_x = c.x - b.x;
    const d_cb_y = c.y - b.y;
    const d_cb_z = c.z - b.z;

    return v3_angle_between(
        d_ab_x, d_ab_y, d_ab_z,
        d_cb_x, d_cb_y, d_cb_z,
    )
}