#include <SDL/SDL_types.h>
#include <math.h>
#include <SDL/begin_code.h>
#include <SDL/close_code.h>
Include dependency graph for Fxp.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| class | Angle |
| Class used to handle fixed-point angles. More... | |
| class | SfxpCoord |
| Class used to handle fixed-point x/y coordinates. More... | |
Fixed point integer definitions | |
| #define | SFXP_BITS 10 |
| Defines the number of bits precision of fixed point #s. | |
| #define | SFXP_SCALAR (1<<SFXP_BITS) |
| 2^SFXP_BITS | |
| #define | TO_SFXP(x) (((Sint32)(x))<<SFXP_BITS) |
| Convert from integer to signed fixed point. | |
| #define | FROM_SFXP(x) ((Sint32)((x+((SFXP_SCALAR>>1)))>>SFXP_BITS)) |
| Convert from signed fixed point to integer. | |
| #define | F_TO_SFXP(x) ((Sfxp)((x)*SFXP_SCALAR)) |
| Convert from float to signed fixed point. | |
| #define | SFXP_TO_F(x) ( ((FxpFloat)(x)) / ((FxpFloat)SFXP_SCALAR) ) |
| Convert from signed fixed point to floating point. | |
| #define | MUL_SFXP(x, y) FROM_SFXP(((Sint64)(x))*((Sint64)(y))) |
| Multiplies two signed fixed point numbers. | |
| #define | DIV_SFXP(x, y) ((Sfxp)((TO_SFXP((Sint64)(x)))/y)) |
| Divides two signed fixed point numbers, x/y. | |
| typedef Sint32 | Sfxp |
| Definition for the signed fixed-point type. | |
Fixed point angle definitions | |
| #define | AFXP_BITSIZE (sizeof(Afxp)*8) |
| # of bits in angle type | |
| #define | AFXP_MAX (1<<AFXP_BITSIZE) |
| Maximum value of angle type, 2^AFXP_BITSIZE. | |
| #define | AFXP_BITS 8 |
| Defines the bits precision in a fixed-point angle. | |
| #define | FXP_PI 3.14159f |
| Any more digits than this would be superfluous. | |
| #define | DEG_TO_AFXP(x) ((Afxp)((x)*( ((double)AFXP_MAX) /360.))) |
| Convert degrees to fixed-point angles. | |
| #define | RAD_TO_AFXP(x) DEG_TO_AFXP((x)*(180./3.14159)) |
| Convert radians to fixed point angles. | |
| #define | AFXP_TO_DEG(x) ((x)*(360./AFXP_MAX)) |
| Convert fixed point angles to degrees. | |
| typedef Uint16 | Afxp |
| Type definition for the fixed-point angular type. | |
Fixed Point Trigenometry | |
| DECLSPEC void SDLCALL | FXP_Init () |
| Initializes fixed-point trig tables. | |
| DECLSPEC Sfxp SDLCALL | FXP_Sin (Afxp a) |
| Returns fixed-point sin value. | |
| DECLSPEC Afxp SDLCALL | FXP_Asin (Sfxp val) |
| Returns fixed-point inverse-sin value. | |
| DECLSPEC Sfxp SDLCALL | FXP_Cos (Afxp a) |
| Returns fixed-point cos value. | |
| DECLSPEC Afxp SDLCALL | FXP_Acos (Sfxp val) |
| Returns fixed-point inverse-cos value. | |
| DECLSPEC Sfxp SDLCALL | FXP_Tan (Afxp a) |
| Returns fixed-point tan value. | |
| DECLSPEC Afxp SDLCALL | FXP_Atan (Sfxp val) |
| Returns fixed-point inverse-tan value. | |
| DECLSPEC Afxp SDLCALL | FXP_Traj (Sfxp y, Sfxp x) |
| Returns the angle of the vector, valid at any angle. | |
Typedefs | |
| typedef float | FxpFloat |
| The floating point type used converting to/from floating point. | |
Definition in file Fxp.h.
1.3.4