… | |
… | |
2230 | #if 1 // new algorithm |
2230 | #if 1 // new algorithm |
2231 | // this works by putting x, y into 16 sectors, which |
2231 | // this works by putting x, y into 16 sectors, which |
2232 | // are not equal sized, but are a better approximation |
2232 | // are not equal sized, but are a better approximation |
2233 | // then the old algorithm, and then using a mapping |
2233 | // then the old algorithm, and then using a mapping |
2234 | // table to map it into a direction value. |
2234 | // table to map it into a direction value. |
|
|
2235 | // basically, it maps these comparisons to each bit |
|
|
2236 | // bit #3: x < 0 |
|
|
2237 | // bit #2: y < 0 |
|
|
2238 | // bit #1: x > y |
|
|
2239 | // bit #0: x > 2y |
2235 | |
2240 | |
2236 | static const uint8 dir[16] = { |
2241 | static const uint8 dir[16] = { |
2237 | 4, 5, 4, 3, |
2242 | 4, 5, 4, 3, |
2238 | 2, 1, 2, 3, |
2243 | 2, 1, 2, 3, |
2239 | 6, 5, 6, 7, |
2244 | 6, 5, 6, 7, |