Maths
[Main]


Defines

#define UL_PI   256
#define ulSin(angle, radius)   ((ul_sin[angle & 511] * radius) >> 8)
#define ulCos(angle, radius)   ((ul_cos[angle & 511] * radius) >> 8)
#define ulAbs(x)   (((x)<0)?(-(x)):(x))
#define ulMin(x, y)   (((x)<(y))?(x):(y))
#define ulMax(x, y)   (((x)>(y))?(x):(y))
#define ulNumberof(n)   (sizeof(n)/sizeof(*(n)))

Functions

int ulGetPowerOf2Count (int value)

Detailed Description

Some "maths" functions.

Define Documentation

#define UL_PI   256

PI is 256 in µLibrary. One entire circle (2 PI) is 512 and not 360°. This was done like this because of speed.

#define ulSin ( angle,
radius   )     ((ul_sin[angle & 511] * radius) >> 8)

Calculates the sine of an angle. The return value is in fixed point format (256 = 1.0).

Parameters:
angle Angle of the circle. 512 represents a full circle (2 PI).
radius Radius of the circle in fixed point.

#define ulCos ( angle,
radius   )     ((ul_cos[angle & 511] * radius) >> 8)

Calculates the cosine. See ulSin for further information.

#define ulAbs (  )     (((x)<0)?(-(x)):(x))

Calculates the absolute value.

#define ulMin ( x,
 )     (((x)<(y))?(x):(y))

Returns the smallest value between the two.

#define ulMax ( x,
 )     (((x)>(y))?(x):(y))

Returns the greatest value between the two.

#define ulNumberof (  )     (sizeof(n)/sizeof(*(n)))

Returns the number of objects in an array.


Function Documentation

int ulGetPowerOf2Count ( int  value  ) 

Returns the next (greater) power of two starting from that value.


Generated on Sat Jul 14 23:39:33 2007 by  doxygen 1.5.2