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

/**
 * Returns true if two 1D lines overlap, touch is not considered overlap
 * Parameters are assumed to be ordered, a1 > a0, b1 > b0
 * @param {Number} a0
 * @param {Number} a1
 * @param {Number} b0
 * @param {Number} b1
 * @returns {boolean}
 */
export function overlap1D(a0, a1, b0, b1) {
    assert.isNumber(a0, "a0");
    assert.isNumber(a1, "a1");

    assert.isNumber(b0, "b0");
    assert.isNumber(b1, "b1");

    assert.notNaN(a0, 'a0');
    assert.notNaN(a1, 'a1');

    assert.notNaN(b0, 'b0');
    assert.notNaN(b1, 'b1');

    return a1 > b0 && b1 > a0;
}
