calculation of horizontal displacement vector