Fixed subpixel direction calculation

@priseborough You will want to give this one a ride.