ray_near and ray_far were inverted several times. fix
Add ray-box intersection test and factorize code for rebase