utils/geometry/plane.js
function distanceAAShapes(shapeA, shapeB) {
    const dx = Math.max(Math.abs(shapeA.pos.x - shapeB.pos.x) - ((shapeA.w / 2) + (shapeB.w / 2)), 0);
    const dy = Math.max(Math.abs(shapeA.pos.y - shapeB.pos.y) - ((shapeA.h / 2) + (shapeB.h / 2)), 0);
    return Math.sqrt(dx * dx + dy * dy);
}
function distanceAAShapes(shapeA, shapeB) {
    const dx = Math.max(Math.abs(shapeA.pos.x - shapeB.pos.x) - ((shapeA.w / 2) + (shapeB.w / 2)), 0);
    const dy = Math.max(Math.abs(shapeA.pos.y - shapeB.pos.y) - ((shapeA.h / 2) + (shapeB.h / 2)), 0);
    return Math.sqrt(dx * dx + dy * dy);
}
function distanceAAShapes ( shapeA , shapeB ) { const dx = Math . max ( Math . abs ( shapeA . pos . x - shapeB . pos . x ) - ( ( shapeA . w / 2 ) + ( shapeB . w / 2 ) ) , 0 ) ; const dy = Math . max ( Math . abs ( shapeA . pos . y - shapeB . pos . y ) - ( ( shapeA . h / 2 ) + ( shapeB . h / 2 ) ) , 0 ) ; return Math . sqrt ( dx * dx + dy * dy ) ; }
AA = Axis Aligned, distance from AA shape to AA shape
@param {{ pos: Point2D, w, h }} shapeA AA shape A
@param {{ pos: Point2D, w, h }} shapeB AA shape B
AA = Axis Aligned distance from AA shape to AA shape