libtonc: Look-up tables

Tonclib

Look-up tables
[Math]

Tonc's internal look-up tables and related routines. More...

Defines

#define SIN_LUT_SIZE   514
#define DIV_LUT_SIZE   257

Functions

INLINE s32 lu_sin (uint theta)
 Look-up a sine value (2π = 0x10000).
INLINE s32 lu_cos (uint theta)
 Look-up a cosine value (2π = 0x10000).
INLINE uint lu_div (uint x)
 Look-up a division value between 0 and 255.
INLINE int lu_lerp32 (const s32 lut[], uint x, const uint shift)
 Linear interpolator for 32bit LUTs.
INLINE int lu_lerp16 (const s16 lut[], uint x, const uint shift)
 As lu_lerp32, but for 16bit LUTs.

Variables

s32 div_lut [257]
s16 sin_lut [514]

Detailed Description

Tonc's internal look-up tables and related routines.


Define Documentation

#define SIN_LUT_SIZE   514


Function Documentation

INLINE s32 lu_cos ( uint  theta  ) 

Look-up a cosine value (2π = 0x10000).

Parameters:
theta Angle in [0,FFFFh] range
Returns:
.12f cosine value

INLINE uint lu_div ( uint  x  ) 

Look-up a division value between 0 and 255.

Parameters:
x reciprocal to look up.
Returns:
1/x (.16f)

INLINE int lu_lerp32 ( const s32  lut[],
uint  x,
const uint  shift 
)

Linear interpolator for 32bit LUTs.

A lut is essentially the discrete form of a function, f(x). You can get values for non-integer x via (linear) interpolation between f(x) and f(x+1).

Parameters:
lut The LUT to interpolate from.
x Fixed point number to interpolate at.
shift Number of fixed-point bits of x.

INLINE s32 lu_sin ( uint  theta  ) 

Look-up a sine value (2π = 0x10000).

Parameters:
theta Angle in [0,FFFFh] range
Returns:
.12f sine value


Generated on Mon Aug 25 17:03:57 2008 for libtonc by  doxygen 1.5.3