fixed point trig functions. Angle can be in the range of -32768 to 32767. There are 32768 degrees in the unit circle used by nds. To convert between standard degrees (360 per circle): [詳細]
#include <nds/ndstypes.h>
マクロ定義 | |
#define | DEGREES_IN_CIRCLE (1 << 15) |
#define | fixedToInt(n, bits) ((int)((n)>>(bits))) |
#define | intToFixed(n, bits) ((int)((n)<<(bits))) |
#define | floatToFixed(n, bits) ((int)((n) * (float)(1<<(bits)))) |
#define | fixedToFloat(n, bits) (((float)(n)) / (float)(1<<(bits))) |
#define | floorFixed(n, bits) ((int)((n) & ~(((1 << (bits)) - 1)))) |
#define | degreesToAngle(degrees) ((degrees) * DEGREES_IN_CIRCLE / 360) |
#define | angleToDegrees(angle) ((angle) * 360 / DEGREES_IN_CIRCLE) |
関数 | |
s16 | cosLerp (s16 angle) |
fixed point cosine | |
s16 | sinLerp (s16 angle) |
fixed point sine | |
s32 | tanLerp (s16 angle) |
fixed point tangent | |
s16 | acosLerp (s16 par) |
fixed point arccos | |
s16 | asinLerp (s16 par) |
fixed point arcsin |
fixed point trig functions. Angle can be in the range of -32768 to 32767. There are 32768 degrees in the unit circle used by nds. To convert between standard degrees (360 per circle):
angle = degreesToAngle(angleInDegrees);
or
angle = angleInDegrees * 32768 / 360;
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.
s16 acosLerp | ( | s16 | par | ) |
fixed point arccos
par | parameter |
s16 asinLerp | ( | s16 | par | ) |
fixed point arcsin
par | parameter |
s16 cosLerp | ( | s16 | angle | ) |
fixed point cosine
angle | (-32768 to 32767) |
s16 sinLerp | ( | s16 | angle | ) |
fixed point sine
angle | (-32768 to 32767) |
s32 tanLerp | ( | s16 | angle | ) |
fixed point tangent
angle | (-32768 to 32767) |