trig_lut.h

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 angle (-32768 to 32767)
s16 asinLerp ( s16  par  ) 

fixed point arcsin

引数:
par parameter
戻り値:
s16 angle (-32768 to 32767)
s16 cosLerp ( s16  angle  ) 

fixed point cosine

引数:
angle (-32768 to 32767)
戻り値:
4.12 fixed point number with the range [-1, 1]
例:
Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/nehe/lesson10b/source/nehe10b.cpp, Graphics/3D/nehe/lesson11/source/nehe11.cpp, と input/Touch_Pad/touch_look/source/main.cpp.
s16 sinLerp ( s16  angle  ) 

fixed point sine

引数:
angle (-32768 to 32767)
戻り値:
4.12 fixed point number with the range [-1, 1]
例:
Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/nehe/lesson10b/source/nehe10b.cpp, Graphics/3D/nehe/lesson11/source/nehe11.cpp, と input/Touch_Pad/touch_look/source/main.cpp.
s32 tanLerp ( s16  angle  ) 

fixed point tangent

引数:
angle (-32768 to 32767)
戻り値:
20.12 fixed point number with the range [-81.483, 524287.999]
 全て クラス ファイル 関数 変数 型定義 列挙型 列挙型の値 マクロ定義
libndsに対してMon Apr 26 23:39:50 2010に生成されました。  doxygen 1.6.3