import { GeomConstants } from '../math/geometry/geomConstants';
export function compareBooleans(a, b) {
    // return a - b
    return (a ? 1 : 0) - (b ? 1 : 0);
}
export function compareNumbers(a, b) {
    const t = a - b;
    return t < 0 ? -1 : t == 0 ? 0 : 1;
}
export function comparePointsYFirst(a, b) {
    const cmp = compareNumbers(a.y, b.y);
    return cmp ? cmp : compareNumbers(a.x, b.x);
}
export function comparePointsXFirst(a, b) {
    const cmp = compareNumbers(a.x, b.x);
    return cmp ? cmp : compareNumbers(a.y, b.y);
}
export function closeDistEps(a, b) {
    const d = a - b;
    return -GeomConstants.distanceEpsilon <= d && d <= GeomConstants.distanceEpsilon;
}
export function greaterDistEps(a, b) {
    return compareNumbersDistEps(a, b) > 0;
}
export function compareNumbersDistEps(a, b) {
    const c = a - b;
    //  The <= and >= here complement the < and > in Close(double, double).
    if (c <= -GeomConstants.distanceEpsilon) {
        return -1;
    }
    if (c >= GeomConstants.distanceEpsilon) {
        return 1;
    }
    return 0;
}
//# sourceMappingURL=compare.js.map