I think I understand it all now.
So, I came up with some simple numbers just to see:
P1 = (0,4)
V1 = <1,0>
P2 = (3,0)
|V2| = 2
c = -3
d = -4
k = 2
h = 1
B = ?
A = 0
After solving your final equation I ended up with
-3sinB + -4cosB = (-3sin0 + 4cos0)/2
simplified to: -3sinB + -4cosB = 2
I...