Simple raytracing in javascript