export type Pos = {
    x: number, y: number,
};
export type Box = Pos & {
    width: number, height: number,
}
export function posInBox(box: Box, pos: Pos) {
    return pos.x > box.x && pos.x < box.x + box.width
        && pos.y > box.y && pos.y < box.y + box.height
}
export function boxCollision(box1: Box, box2: Box) {
    // http://stackoverflow.com/questions/2440377/ddg#7301852
    return !(
        ((box1.y + box1.height) < (box2.y)) ||
        (box1.y > (box2.y + box2.height)) ||
        ((box1.x + box1.width) < box2.x) ||
        (box1.x > (box2.x + box2.width))
    )
}

