function bearing = getbearingA (x,A,i) P1A = [A(1) - x(1),0, A(3) - x(2)]; P1Zplus = [0,0,1]; bearingA_raw = getbearingbetween(P1A,P1Zplus); bearing = convertangleto360(bearingA_raw - i);