public static IEnumerable <float> Enumerate360Angles(float initialAngle, int increments = 20) { initialAngle = initialAngle % 360; var opposite = initialAngle.GetOppositeAngle(); for (var i = 1; i <= increments; i++) { if (i == 1) { yield return(initialAngle); } else if (i == 1) { yield return(opposite); } else { var increment = 180f * i / increments; yield return(initialAngle.AddToAngle(increment)); yield return(initialAngle.AddToAngle(-increment)); } } }
public static bool IsClockwiseShortestPathToAngle(this float a, float b) { var diff = a.DiffAngle(b); return(a.AddToAngle(diff) == b); }