00001
00020 #ifndef SEAM_H
00021 #define SEAM_H
00022
00023
00024
00025
00026 #include "split.h"
00027 #include "tessarray.h"
00028
00029
00030
00031
00036 typedef float PRIORITY;
00037
00046 typedef struct seam_record
00047 {
00048 PRIORITY priority;
00049 INT8 widthp;
00050 INT8 widthn;
00051 INT16 location;
00052 SPLIT *split1;
00053 SPLIT *split2;
00054 SPLIT *split3;
00055 } SEAM;
00056
00061 typedef ARRAY SEAMS;
00062
00063 extern SEAM *newseam();
00064
00065
00066
00067
00068
00072 #define clone_seam(dest,source) \
00073 if (source) { \
00074 (dest) = newseam (); \
00075 (dest)->location = (source)->location; \
00076 (dest)->widthp = (source)->widthp; \
00077 (dest)->widthn = (source)->widthn; \
00078 (dest)->priority = (source)->priority; \
00079 clone_split ((dest)->split1, (source)->split1); \
00080 clone_split ((dest)->split2, (source)->split2); \
00081 clone_split ((dest)->split3, (source)->split3); \
00082 } \
00083 else { \
00084 (dest) = (SEAM*) NULL; \
00085 } \
00086
00087
00088
00094 #define exact_point(p1,p2) \
00095 (! ((p1->pos.x - p2->pos.x) || (p1->pos.y - p2->pos.y)))
00096
00097
00098
00099
00100 bool point_in_split(SPLIT *split, EDGEPT *point1, EDGEPT *point2);
00101
00102 bool point_in_seam(SEAM *seam, SPLIT *split);
00103
00104 SEAMS add_seam(SEAMS seam_list, SEAM *seam);
00105
00106 void combine_seams(SEAM *dest_seam, SEAM *source_seam);
00107
00108 void delete_seam(void *arg);
00109
00110 void free_seam_list(SEAMS seam_list);
00111
00112 bool test_insert_seam(SEAMS seam_list,
00113 int index,
00114 TBLOB *left_blob,
00115 TBLOB *first_blob);
00116
00117 SEAMS insert_seam(SEAMS seam_list,
00118 int index,
00119 SEAM *seam,
00120 TBLOB *left_blob,
00121 TBLOB *first_blob);
00122
00123 int account_splits_right(SEAM *seam, TBLOB *blob);
00124
00125 int account_splits_left(SEAM *seam, TBLOB *blob, TBLOB *end_blob);
00126
00127 bool find_split_in_blob(SPLIT *split, TBLOB *blob);
00128
00129 SEAM *join_two_seams(SEAM *seam1, SEAM *seam2);
00130
00131 SEAM *new_seam(PRIORITY priority,
00132 int x_location,
00133 SPLIT *split1,
00134 SPLIT *split2,
00135 SPLIT *split3);
00136
00137 SEAMS new_seam_list();
00138
00139 void print_seam(const char *label, SEAM *seam);
00140
00141 void print_seams(const char *label, SEAMS seams);
00142
00143 int shared_split_points(SEAM *seam1, SEAM *seam2);
00144 #endif