moved computing transformation matrix for ray from per curve basis to per ray basis