So I'm calculating my bearings on a gui based on incoming degrees and everything works fine. Except now I'm trying to show an view range around that incoming bearing.
For example, the incoming bearing is 0 degrees, and my +/- view radius is 16 degrees.
Therefore at 0 my min view range goes "down" to 344, and my max goes up to 16.
Each degree I have a QGraphicsLineItem that I am coloring based on where it falls within this range; it has an associated degree angle for where it is currently placed. So if the item is not within the current range it is red, if it is then its blue.
My issue lies with trying to figure out the logical condition to check against.
Currently I have:
if(item.degrees <= minViewRange && item.degrees <= bearing )
item.colorBlue = true;
else if (item.degrees >= bearing && item.degrees <= maxViewRange)
item.colorBlue = true;
else
item.colorBlue = false;
All of this works fine until I get within 16 degrees of zero.
So for example, at a bearing of 0, only the (0 - 16) condition is true, so only that half gets colored. (344 - 0) isn't true because 344 isn't less than 0.
Once bearing becomes 16, then my ranges get colored correctly again because then ( 0 < 16 < 32)
How can I compensate for this?