prim ray calculation