MATL, 11 bytes
X/Z/0)2/YP/
Input is a sequence of complex numbers including the end point.
Explanation
Most of the work is done by the Z/ function (unwrap), which unwraps angles in radians by changing absolute jumps greater than or equal to pi to their 2*pi complement.
X/ % compute angle of each complex number
Z/ % unwrap angles
0) % pick last value. Total change of angle will be a multiple of 2*pi because
% the path is closed. Total change of angle coincides with last unwrapped
% angle because the first angle is always 0
2/ % divide by 2
YP/ % divide by pi
Luis Mendo
- 106.7k
- 10
- 139
- 382