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

/**
 * @param {Vector2} p0
 * @param {Vector2} p1
 * @param {Vector2} p2
 * @param {Vector2} p3
 * @returns {number[]} 2 elements
 */
export function line_segment_compute_line_segment_intersection_vectors_array_2d(p0, p1, p2, p3) {
    const p0_x = p0.x;
    const p0_y = p0.y;
    const p1_x = p1.x;
    const p1_y = p1.y;
    const p2_x = p2.x;
    const p2_y = p2.y;
    const p3_x = p3.x;
    const p3_y = p3.y;

    const result = [];

    if (line_segment_compute_line_segment_intersection_array_2d(result, 0, p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y)) {
        return result;
    } else {
        return null; // No collision
    }

}
