@AWOL: That's actually a nice trick. however, I need to evaluate angles from -179 to 180 degrees, so that would make a REALLY long program I might remember it for other uses though.
@AlphaBeta: Yeah, I guess thats what I'll be facing.
But I guess since I want to split up the angles into eight equal pieces (basically the directions up, up-right, right, down-right, etc), I can simply divide them by 45 and then use a switch case statement without much hassle
(in case anyone's interested:)
the +180 is to get 1 to 360 instead of -179 to 180.
the +22.5 degree shifts it again because e.g. I want the direction 4 (right) to span 22.5 degrees up and down starting from the horizontal axis.
this way, direction 0 is left, 1 is down-left, 2 is down, ... and 7 is up-left