intersectsWithAabb2 method
Whether the ray intersects the box or not.
Rays that originate on the edge of the box are considered to be
intersecting with the box no matter what direction they have.
Implementation
// This uses the Branchless Ray/Bounding box intersection method by Tavian,
// but since +-infinity is replaced by +-maxFinite for directionInvX and
// directionInvY, rays that originate on an edge will always be considered to
// intersect with the aabb, no matter what direction they have.
// https://tavianator.com/2011/ray_box.html
// https://tavianator.com/2015/ray_box_nan.html
bool intersectsWithAabb2(Aabb2 box) => entryDistanceToAabb2(box) >= 0;