I posted one approach for computing ABC from positional data. idea is to form rotation matrix and then find ABC that produce those matrix coefficients.
the point is that when doing last step (angle computations) there are more than one way to choose angle values.
while choosing one angle value can be arbitrary, choosing arbitrary set of all three angles is not. this is what kaneyja run into (I think he went first for negative SIN(B) which is single term), but there are two possible angles. using ASIN function and blindly picking lower value can work in some cases but not always (depends on input data values of P1,P2,P3). this is why in KRL program that was linked by Hermann, another strategy is used (that code is clever and makes use of ATAN2 where possible etc.).
btw when I tried that code it did not work for me because of way parameters are passed, this is why I posted modified version along with test program in reply 17.