00001
#ifndef _RECTANGLE_H_
00002
#define _RECTANGLE_H_
00003
00004
00005
00006
00007
00008
00017
enum {RECTANGLE_GLOBAL_TO_LOCAL,
00018 RECTANGLE_LOCAL_TO_GLOBAL};
00019
00024 struct Rectangle4i
00025 {
00026
int BIN_START;
00027
int BIN_STOP;
00028
int SCAN_START;
00029
int SCAN_STOP;
00030 };
00031
00032
typedef struct Rectangle4i Rectangle4i;
00033
typedef struct Rectangle4i Insets4i;
00034
00035
typedef struct
00036
{
00037
int BIN_SIZE;
00038
int SCAN_SIZE;
00039 } Dimensions2i;
00040
00041
00042
int Rectangle4i_cmp(Rectangle4i* RECT1, Rectangle4i* RECT2);
00043
00056
void Rectangle4i_init(Rectangle4i *rRect,
int x1,
int x2,
int y1,
int y2);
00057 Rectangle4i newRectangle4i(
int x1,
int x2,
int y1,
int y2);
00058 Dimensions2i newDimensions2i(
int x,
int y);
00059 Dimensions2i calcDimensions2i(Rectangle4i rect);
00060
00061
struct Insets4f Rectangle4i_convert(Rectangle4i rect);
00062 Dimensions2i Rectangle4i_getDimensions2i(Rectangle4i* rect);
00063
00073
void Rectangle4i_fprint (FILE* fp, Rectangle4i *R);
00074
00083
void Rectangle4i_fprintln(FILE* fp, Rectangle4i *R);
00084
00095
void Rectangle4i_fprintf (FILE* fp, Rectangle4i *R,
const char* format);
00096
void Rectangle4i_fprintAsHeader (FILE* fp, Rectangle4i *R);
00097
00098 Rectangle4i* Rectangle4iArray_create(
int size,
int start_index);
00099
void Rectangle4iArray_fprint (FILE* fp, Rectangle4i *R,
int nstart,
int nstop);
00100
void Rectangle4iArray_fprintf(FILE* fp, Rectangle4i *R,
int nstart,
int nstop,
const char* format);
00101
00102
int Rectangle4i_isPointInside(Rectangle4i rect,
int x,
int y);
00103
00104 Rectangle4i Rectangle4i_mergeRectangles(Rectangle4i RECT1, Rectangle4i RECT2);
00105
int Rectangle4i_correctSubRect(Rectangle4i* subrect, Rectangle4i* rect);
00106
void Rectangle4i_transform(Rectangle4i* target, Rectangle4i* reference,
int type);
00107
int Rectangle4i_calcArea(Rectangle4i *rect);
00108
00109
int isPointWithinRect (Dimensions2i dim,
int x,
int y);
00110
int isPointWithinRect2(Rectangle4i rect,
int x,
int y);
00111
int isRectWithinRect(Rectangle4i rect1, Rectangle4i rect2);
00112 Rectangle4i transformRectangle4i(
int type, Rectangle4i parent, Rectangle4i child);
00113
void transformRectangle4i_2(
int type, Rectangle4i reference, Rectangle4i* target);
00114
00115
00116
#endif
00117