Well, it depends a lot on the angle. Take the distance between a and b to be 'h' cm and the angle to be 'θ'.
Also note that 'r' cm is negative if B is to the left of A,or below A, and is positive if B is above or to the right of A. Similarly, θ is negative if B is to the left of point A.
The sine of angle θ will tell give you a good idea because since you know the hypotenuse(h cm), you can determine the horizontal difference and then using a cosine(or pythagoras theorem) you can derive at the vertical difference. So, if
[itex]A=[x,y][/itex]
[itex]B=[x+h*sin(θ),y+h*cos(θ)][/itex]
So similarly, to find the value of of 'h' if you know the positions of A and B, use simple inverse trignometry to define 'r'. You can define all unknown values with knowledge of every other value. if you are finding it hard to remember, just draw a right-angle triangle to make sense of it.
Note: Angle θ is obtained by drawing a line parallel to the y-axis to the x-axis.
_______________
This will help a lot:
α β γ δ ε θ λ μ ν π ρ σ τ η φ χ ψ ω Γ Δ Θ Λ Π Σ Φ Ψ Ω
∂ ∏ ∑ ← → ↓ ↑ ↔ ⇐⇑⇒⇓⇔
± − ÷ √ ∫ ½ ∞∴ ~ ≈ ≠ ≡ ≤ ≥ ° ∇∝