It is due to radians. Degrees and radians do the same job, they measure an angle.

It’s similar to the fact that we have Fahrenheit and Celsius for measuring temperature. Different units measuring the same thing.

So how does this affect what we are doing? A circle is made up of 360 degrees or 2 * Pi radians.

To convert degrees into radians we use the following formula **radians = degrees * Pi / 180**

If we were to put 360 degrees into that formula we would find that **360 degrees = 2Pi radians**.

UIBezierPath takes a startAngle and an endAngle that are both in radians. This means that if we use an angle that is degrees, which is much easier for us to see and understand, it would need to be converted into radians to be used with UIBezierPath.

You can see that here.

**let startAngle: CGFloat = 3 * .pi / 4 // This is 135 degrees**

let endAngle: CGFloat = .pi / 4 // This is 45 degrees

Using the formula above

**startAngleInRadians = 135 * Pi / 180 = 3 * Pi / 4**

**endAngleInRadians = 45 * Pi / 180 = Pi / 4**

If we look at this diagram of the unit circle things can become a littler clearer.

We start at 0, on the left hand side. Firstly there are two tracks of numbers. The inner track is in degrees, the outer track is in radians. Going clockwise around the circle, starting from 0. We can see the size of the degrees increases, the radians increase too but that’s a little harder to tell if you are not well versed in fractions.

We are looking to start our arc when we are 135 degrees away from the start of the unit circle and end our arc when we are 45 degrees from the start of the unit circle (the red arrow shows the arc that we want to create)

If we work out the distance that we have travelled, in degrees, from our starting point at 135 degrees to our end point at 45 degrees we get the following:

Firstly we need to calculate the distance from 135 to 360 (as that takes us back to the start of the unit circle, notice how the 0 and 360 are at the same point). So to find that distance we do **360 - 135 = 225 degrees**.

Secondly, we need to calculate the distance from the start of the unit circle to its end point at 45 degrees. This is really easy, it’s just **45 degrees** .

Finally, the total distance travelled is just **225 + 45 = 270 degrees**

We could have done this in one step

**angleDifference = 360 - 135 + 45**

*So the angleDifference is the size of the angle for the arc. Basically how far is it in radians from the startAngle to the endAngle*

We can easily convert this to radians (look just before the diagram for the calculation):

**angleDifference = 2 * Pi - startAngleInRadians + endAngleInRadians**

So if you want to change the size of the arc, you shouldn’t be changing the 2 * Pi as that how many radians there are in the circle, that should be left alone. The best way to change the size of the arc is to change the start and end angles.

I hope that helps explain what is going on.