There is nonsense usage of math.pi - result doesn't depend on it.
a = x/R = Cos(Fi)
, where Fi is direction angle of (coordinate origin - starting point) vector, if R is radius of arc with origin as center
(Cos(Fi) negated for positive width values)