title: Swift. Represent northerly direction as a range of course direction
body: <p>I'm working with annotations and MapKit. I have a bike annotation where the default image points east (ie a side view of a bike which has the concept of up, down, front, and back). If the CLLocation course of the bike is west, I need to use a flipped image (ie image pointing west) otherwise the bike travels backwards. To avoid excessive "flipping" of the annotation image I want to have a buffer zone at due north and due south where, for example, if the bike's course is east (and hence the image used is the east facing bike image), if the course veers a little west (say 184 degrees) then this is considered "within the buffer zone" and I don't use the flipped image on the updated annotation. Say buffer zone is 5 degrees either side of due north and due south. I want to capture these "directions" in variables ie effectiveEast is range 5.0..&lt;175, southBuffer is range 175..&lt;185, effectiveWest is 185..&lt;355 ... but how would I represent the northBuffer .... which effectively needs to be a range from 355 to 360 and also from 0 to 5 ie not contiguous numbers ... I'm guessing this should be quite simple to do mathematically but just can't think of how?</p>