trig_lut.h File Reference

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): More...

#include <nds/ndstypes.h>

Functions

s16 acosLerp (s16 par)
 fixed point arccos
s16 asinLerp (s16 par)
 fixed point arcsin
s16 cosLerp (s16 angle)
 fixed point cosine
s16 sinLerp (s16 angle)
 fixed point sine
s32 tanLerp (s16 angle)
 fixed point tangent


Detailed Description

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.


Function Documentation

s16 acosLerp ( s16  par  ) 

fixed point arccos

Parameters:
par parameter
Returns:
s16 angle (-32768 to 32767)

s16 asinLerp ( s16  par  ) 

fixed point arcsin

Parameters:
par parameter
Returns:
s16 angle (-32768 to 32767)

s16 cosLerp ( s16  angle  ) 

fixed point cosine

Parameters:
angle (-32768 to 32767)
Returns:
4.12 fixed point number with the range [-1, 1]
Examples:
Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/nehe/lesson10b/source/nehe10b.cpp, Graphics/3D/nehe/lesson11/source/nehe11.cpp, and input/Touch_Pad/touch_look/source/main.cpp.

s16 sinLerp ( s16  angle  ) 

fixed point sine

Parameters:
angle (-32768 to 32767)
Returns:
4.12 fixed point number with the range [-1, 1]
Examples:
Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/nehe/lesson10b/source/nehe10b.cpp, Graphics/3D/nehe/lesson11/source/nehe11.cpp, and input/Touch_Pad/touch_look/source/main.cpp.

s32 tanLerp ( s16  angle  ) 

fixed point tangent

Parameters:
angle (-32768 to 32767)
Returns:
20.12 fixed point number with the range [-81.483, 524287.999]


Generated on Sun Mar 7 12:47:55 2010 for libnds by  doxygen 1.5.7.1