Present angles as vectors with norm = 1 and average sum.
x1 = {cos(a),sin(a)}
x2 = {cos(b),sin(b)}
(x1+x2)/2 = {(cos(a)+cos(b))/2,(sin(a)+sin(b))/2}
which means that the angle for the average is
atan2((sin(a)+sin(b)) /(cos(a)+cos(b)))
Just beware of controlling possible overflow when the denominator is close to zero.
