2009년 12월 29일 화요일

Hierarchy among complex, vector, matrix, and, pixmap

0. Epsilon
actual zero depending on working machine

#ifndef DOUBLE_EPSILON

#define DOUBLE_EPSILON (2.22045E-016)

#endif

1. real number

type - double

2. complex number

typedef struct {

double real, double imag

} complex_t;

3. vector
typedef struct {

int length;

double *real;

double *imaginary;

} vector_t;

4. matrix

typedef struct {

int columns, rows;

double *real;

double *imaginary;

} matrix_t;

5. pixmap

5.1. header

typedef struct {

int width;

int height;

int pitch;

} maphdr_t;

5.2. bitmap
one bit corresponding one pixel

typedef struct {

maphdr_t header;

unsigned char *buffer;

} bitmap_t;

5.3. bytemap

one byte (8-bits) corresponding one pixel

typedef struct {

maphdr_t header;

unsigned char *buffer;

} bytemap_t;

5.4. wordmap

one word (16-bits) corresponding one pixel

typedef struct {

maphdr_t header;

short *buffer;

} wordmap_t;

5.5. dwordmap

double word (32-bits) corresponding one pixel

typedef struct {

maphdr_t header;

long *buffer;

} dwordmap_t;

5.6. floatmap

float type variable (float point variable containing 32-bits) corresponding one pixel

typedef struct {

maphdr_t header;

float *buffer;

} floatmap_t;

댓글 없음:

댓글 쓰기