[quote]
double vx1 = c1.get[b]X[/b]dir(), vy1 = c1.get[u][b]X[/b][/u]dir();
double vx2 = c2.get[b]X[/b]dir(), vy2 = c2.get[u][b]X[/b][/u]dir();
[/quote]

Please check out how you calculate vy1 and vy2!