I won't just do this for you :), but I will point you to the Code Archives for Chroma's Vector3D Library (Updated). That'll give you all the functions necessary to do the vector math your code chunk requires.
A Ray, incidentally, is a construct containing two Vectors named "origin" and "direction."
A Ray, incidentally, is a construct containing two Vectors named "origin" and "direction."