0<=direction && direction<=45
でも両方<=だと、たとえばdirectionがちょうど45.0の時に条件がかぶるから
0<=direction && direction<45
の方がいい