First version of the RayTracing algorithm