simplify X=R*cos(arcos(sinA*sinB + cosA*cosB*cos(C-D)))