如圖是8個(gè)塊的轉(zhuǎn)盤,假如傳入的角度值是負(fù)數(shù),如何計(jì)算它對應(yīng)是哪個(gè)塊呢?
每個(gè)角度是 360 / 8 = 45
0 - 44 = 0
45 - 89 = 1
90 - 134 = 2
135 - 179 = 3
180 - 224 = 4
225 - 269 = 5
270 - 314 = 6
315 - 360 = 7
假如傳入 -1,那么對應(yīng)的塊應(yīng)該是7
傳入 -46,對應(yīng)的塊應(yīng)該是6
傳入 90,對應(yīng)的塊應(yīng)該是2
請問是怎么樣的計(jì)算過程呢?