There actually is a delightful formula -- see page 11 at 
http://www.mit.edu/~evanchen/handouts/bary/bary-full.pdf

Your displacement vector is $(u-1,v,w)$, giving $d^2=-(a^2vw+b^2w(u-1)+c^2v(u-1))$