Defines | |
| #define | UL_PI 256 |
| #define | ulSin(angle, radius) ((ul_sin[angle & 511] * radius) >> 8) |
| #define | ulCos(angle, radius) ((ul_cos[angle & 511] * radius) >> 8) |
| #define | ulAbs(x) (((x)<0)?(-(x)):(x)) |
| #define | ulMin(x, y) (((x)<(y))?(x):(y)) |
| #define | ulMax(x, y) (((x)>(y))?(x):(y)) |
| #define | ulNumberof(n) (sizeof(n)/sizeof(*(n))) |
Functions | |
| int | ulGetPowerOf2Count (int value) |
| #define UL_PI 256 |
PI is 256 in µLibrary. One entire circle (2 PI) is 512 and not 360°. This was done like this because of speed.
| #define ulSin | ( | angle, | |||
| radius | ) | ((ul_sin[angle & 511] * radius) >> 8) |
Calculates the sine of an angle. The return value is in fixed point format (256 = 1.0).
| angle | Angle of the circle. 512 represents a full circle (2 PI). | |
| radius | Radius of the circle in fixed point. |
| #define ulCos | ( | angle, | |||
| radius | ) | ((ul_cos[angle & 511] * radius) >> 8) |
Calculates the cosine. See ulSin for further information.
| #define ulAbs | ( | x | ) | (((x)<0)?(-(x)):(x)) |
Calculates the absolute value.
| #define ulMin | ( | x, | |||
| y | ) | (((x)<(y))?(x):(y)) |
Returns the smallest value between the two.
| #define ulMax | ( | x, | |||
| y | ) | (((x)>(y))?(x):(y)) |
Returns the greatest value between the two.
| #define ulNumberof | ( | n | ) | (sizeof(n)/sizeof(*(n))) |
Returns the number of objects in an array.
| int ulGetPowerOf2Count | ( | int | value | ) |
Returns the next (greater) power of two starting from that value.
1.5.2