head 1.1; branch 1.1.1; access ; symbols start:1.1.1.1 PAlibDoc:1.1.1; locks ; strict; comment @# @; 1.1 date 2005.11.02.08.30.25; author jandujar; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2005.11.02.08.30.25; author jandujar; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @ PA_lib: Some math functions...

Some math functions...


Defines

#define PA_Cos(angle)   PA_SIN[((angle) + 128)&511]
 Returns the Cos value for an angle. The value goes from -256 to 256... Watch out though : the angle is not in 360 degrees, but in 512 !
#define PA_Sin(angle)   PA_SIN[((angle))&511]
 Returns the Sin value for an angle. The value goes from -256 to 256... Watch out though : the angle is not in 360 degrees, but in 256 !

Functions

void PA_InitRand (void)
 Auto-seeds the Rand function based on the clock !
void PA_SRand (s32 r)
 Set the random's seed. This is taken from Ham, I have no credit. I just made it a little shorter/faster (maybe)
u32 PA_Rand (void)
 Gives a random number, taken from Ham... This is taken from Ham, I have no credit.
u64 PA_Distance (s32 x1, s32 y1, s32 x2, s32 y2)
 Calculate the distance (squared) between 2 points
u16 PA_AdjustAngle (u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety)
 Adjust an angle, for example to calculate in which direction an object shoudl turn
u16 PA_GetAngle (s32 startx, s32 starty, s32 targetx, s32 targety)
 Get the angle, from 0 to 511, formed between the horizontal and the line

Variables

u16 RandomValue

Detailed Description

Adjust angles, get random values...

Function Documentation

u16 PA_AdjustAngle u16  angle,
s16  anglerot,
s32  startx,
s32  starty,
s32  targetx,
s32  targety
 

Adjust an angle, for example to calculate in which direction an object shoudl turn

Parameters:
angle Base angle, from 0 to 511
anglerot For how much to turn...
startx Initial X position
starty Initial Y position
targetx Target X position
targety Target Y position

inline u32 PA_Distance s32  x1,
s32  y1,
s32  x2,
s32  y2
[inline]
 

Calculate the distance (squared) between 2 points

Parameters:
x1 X coordinate of the fist point
y1 Y coordinate of the first point
x2 X coordinate of the second point
y2 Y coordinate of the second point

inline u16 PA_GetAngle s32  startx,
s32  starty,
s32  targetx,
s32  targety
[inline]
 

Get the angle, from 0 to 511, formed between the horizontal and the line

Parameters:
startx Initial X position
starty Initial Y position
targetx Target X position
targety Target Y position

void PA_SRand s32  r  )  [inline]
 

Set the random's seed. This is taken from Ham, I have no credit. I just made it a little shorter/faster (maybe)

Parameters:
r Seed value


Generated on Fri Oct 28 23:16:51 2005 for PA_lib by  doxygen 1.3.9.1
@ 1.1.1.1 log @Initial import of PalibDoc, begin on PAlib0.64b @ text @@