Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Лабы / 5 / ROMA / TYPES

.H
Скачиваний:
20
Добавлен:
16.04.2013
Размер:
1.08 Кб
Скачать

#if !defined ( __TYPES__ )
#define __TYPES__

#include <math.h>
#include <graphics.h>


#if !defined ( NULL )
#define NULL 0L
#endif

/* Truth and
falsehood. */

#define FALSE 0
#define TRUE !FALSE

/* Real is a
double. */

typedef float REAL;

/* Boolean type
for true\false. */

typedef int BOOL;

/* Pixel type
is a char. */

typedef unsigned char PIXEL;

/* An integer
point. */

typedef struct {

int x, y;
} INTPOINT;

/* Some usefull
macros. */

#define ABS(a) (((a)<0)?-(a):(a))
#define SGN(a) (((a)<0)?-1:(a)>0?1:0)
#define SWAP(a,b) a^=b;b^=a;a^=b;
#define CLAMP(a) ((a-floor(a)>0.5)?ceil(a):floor(a))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define RADIAN(x) ((22.0/7.0/180.0)*x)
#define DEGREE(x) ((acos ((x)))*180.0)

/* Some macros for doing fixed point
( Abrash's scan convertors use these ). */

#define INT_TO_FIXED(a) (long)(((long)(a))<<16)
#define ROUND_FIXED_TO_INT(FixedVal) ((int)((FixedVal+0x8000)>>16))
#endif
Соседние файлы в папке ROMA