We must assume that the circle has only 360 degrees, otherwise it will be difficult.
So, the first thing you need to do is get each mark in the range from 0 to 360. To do this, you can take the module of both labels 360. If the amount is less than 0, add 360.
Let's say our points are 520 and -45.
mark1 = ((520 % 360) >= 0) ? (520 % 360) : 360 - (520 % 360); mark2 = ((-45 % 360) >= 0) ? (-45 % 360) : 360 - (-45 % 360);
mark1 will be 160. Sign 2 will be 315.
Now you just accept the absolute value of the difference:
result = abs(mark1 - mark2) = 155
Notme
source share