In purely Newtonian physics, the concept of relative velocity is a comparatively simple one. Lacking any objective frame of reference, we simply define some object's position as a baseline, measuring position and velocity from that viewpoint. The notation I use is vab, where a is the object being viewed and b is our reference position. Let our reference position be (X0 , Y0 , Z0).
We observe object 1, at: (X1 , Y1 , Z1).
The relative velocity of object one will be, then:
v10 = d/dt(X1 - X0 , Y1 - Y0 , Z1 - Z0)
From Position 2, separate from Positions 0 and 1, we can define:
v02 = d/dt(X0 - X2 , Y0 - Y2 , Z0 - Z2)
v12 = d/dt(X1 - X2 , Y1 - Y2 , Z1 - Z2)
To switch reference frames, then, we can calculate:
v10 = v12 - v02
v01 = v02 - v12
Relativity complicates matters considerably, and I may add a treatment later. Feel free to write your own.