|
libnds
|
Fixed point trig functions. Angle can be in the range of -32768 to. More...
#include <nds/ndstypes.h>Macros | |
| #define | angleToDegrees(angle) ((angle) * 360 / DEGREES_IN_CIRCLE) |
| Converts an angle in the format used by libnds in the 360 degree format. | |
| #define | DEGREES_IN_CIRCLE (1 << 15) |
| Number of degrees in a circle. | |
| #define | degreesToAngle(degrees) ((degrees) * DEGREES_IN_CIRCLE / 360) |
| Convert an angle in 360 degree format to the format used by libnds. | |
| #define | fixedToFloat(n, bits) (((float)(n)) / (float)(1 << (bits))) |
| Converts a fixed point number to a floating point number. | |
| #define | fixedToInt(n, bits) ((int)((n) >> (bits))) |
| Convert a fixed point number to an integer. | |
| #define | floatToFixed(n, bits) ((int)((n) * (float)(1 << (bits)))) |
| Converts a floating point number to a fixed point number. | |
| #define | floorFixed(n, bits) ((int)((n) & ~(((1 << (bits)) - 1)))) |
| Removes the decimal part of a fixed point number. | |
| #define | intToFixed(n, bits) ((int)((n) << (bits))) |
| Converts an integer to a fixed point number. | |
Functions | |
| s16 | acosLerp (s16 par) |
| Fixed point arccos. | |
| s16 | asinLerp (s16 par) |
| Fixed point arcsin. | |
| s16 | atanLerp (s32 par) |
| Fixed point arctan. | |
| s16 | cosLerp (s16 angle) |
| Fixed point cosine. | |
| s16 | sinLerp (s16 angle) |
| Fixed point sine. | |
| s32 | tanLerp (s16 angle) |
| Fixed point tangent. | |
Fixed point trig functions. Angle can be in the range of -32768 to.
or
This unit of measure is sometimes refered to as a binary radian (brad) or binary degree. It allows for more precise representation of angle and faster calculation as the DS has no floating point processor.
| #define fixedToFloat | ( | n, | |
| bits | |||
| ) | (((float)(n)) / (float)(1 << (bits))) |
Converts a fixed point number to a floating point number.
| n | The fixed point number to convert. |
| bits | The number of bits used for the decimal part. |
| #define fixedToInt | ( | n, | |
| bits | |||
| ) | ((int)((n) >> (bits))) |
Convert a fixed point number to an integer.
| n | The number the number to convert. |
| bits | The number of bits used for the decimal part. |
| #define floatToFixed | ( | n, | |
| bits | |||
| ) | ((int)((n) * (float)(1 << (bits)))) |
Converts a floating point number to a fixed point number.
| n | The floating point number to convert. |
| bits | The number of bits used for the decimal part. |
| #define floorFixed | ( | n, | |
| bits | |||
| ) | ((int)((n) & ~(((1 << (bits)) - 1)))) |
Removes the decimal part of a fixed point number.
| n | The fixed point number. |
| bits | The number of bits used for the decimal part. |
| #define intToFixed | ( | n, | |
| bits | |||
| ) | ((int)((n) << (bits))) |
Converts an integer to a fixed point number.
| n | The integer to convert. |
| bits | The number of bits used for the decimal part. |
Fixed point arccos.
| par | 4.12 fixed point number with the range [-1, 1]. |
Fixed point arcsin.
| par | 4.12 fixed point number with the range [-1, 1]. |
Fixed point arctan.
| par | 4.12 fixed point number with the range (-inf, +inf). |
Fixed point cosine.
| angle | Angle (-32768 to 32767). |
Fixed point sine.
| angle | Angle (-32768 to 32767). |