If you need to think about it try to do it on the outside

    • Specified by pminand pmax.

    • Center c = (pmin+pmax)/2.

    • Size s = pmax - pmin.

Closest point to AABB

    • The point is p and the closest point will be q.

    • For each axis in p check if value is below min then set that axis in q it to min and if above max set it to max. This will push p along each axis towards the box.

    • If any axis position is inside the box it will remain in the box.

Intersect two AABB.

    • Check each axis. If no overlap in axis then boxes to not intersect.

    • If all axis overlap then they intersect.

Intersect AABB and plane.

Intersec Sphere vs AABB