refactored ray-sphere intersections to use funct in lib_vector.lua