40 #define NUM_STARTING_SEAMS 20
82 if (split ==
NULL)
return false;
93 if (seam ==
NULL)
return false;
121 if (source_seam->
split1) {
124 else if (!dest_seam->
split2)
126 else if (!dest_seam->
split3)
129 cprintf(
"combine_seam: Seam is too crowded, can't be combined !\n");
131 if (source_seam->
split2) {
134 else if (!dest_seam->
split3)
137 cprintf(
"combine_seam: Seam is too crowded, can't be combined !\n");
139 if (source_seam->
split3) {
143 cprintf(
"combine_seam: Seam is too crowded, can't be combined !\n");
145 free_seam(source_seam);
182 for (blob = blobs; blob->
next !=
NULL; blob = blob->
next) {
185 location.
x = (bbox.
right() + nbox.
left()) / 2;
223 for (test_index=0, blob=first_blob->
next;
225 test_index++, blob=blob->
next) {
227 if (test_index + test_seam->
widthp < index &&
228 test_seam->
widthp + test_index == index - 1 &&
232 for (test_index=index, blob=left_blob->
next;
233 test_index < list_length;
234 test_index++, blob=blob->
next) {
236 if (test_index - test_seam->
widthn >= index &&
237 test_index - test_seam->
widthn == index &&
261 for (test_index=0, blob=first_blob->
next;
263 test_index++, blob=blob->
next) {
265 if (test_index + test_seam->
widthp >= index) {
267 }
else if (test_seam->
widthp + test_index == index - 1) {
269 if (test_seam->
widthp < 0) {
270 cprintf(
"Failed to find any right blob for a split!\n");
276 for (test_index=index, blob=left_blob->
next;
277 test_index < list_length;
278 test_index++, blob=blob->
next) {
280 if (test_index - test_seam->
widthn < index) {
282 }
else if (test_index - test_seam->
widthn == index) {
284 if (test_seam->
widthn < 0) {
285 cprintf(
"Failed to find any left blob for a split!\n");
308 if (found_em[0] && found_em[1] && found_em[2])
318 if (found_em[0] && found_em[1] && found_em[2]) {
323 }
while (blob !=
NULL);
344 if (blob != end_blob) {
347 depth, width, found_em);
361 if (!found_em[0] || !found_em[1] || !found_em[2]) {
400 assert(seam1 &&seam2);
461 cprintf(
" %6.2f @ (%d,%d), p=%d, n=%d ",
492 sprintf(number,
"%2d: ", x);
540 for (x = start; x < end; x++)
543 next_blob = blobs->
next;
545 while (outline && next_blob) {
549 next_blob = next_blob->
next;
552 outline = outline->
next;
571 for (x = 0, blob = piece_blobs; x < start; x++)
573 next_blob = blob->
next;
580 if (x - seam->
widthn >= start && x + seam->
widthp < end)
582 while (outline->
next)
583 outline = outline->
next;
585 next_blob = next_blob->
next;
625 edgept = edgept->
next;
627 while (!
exact_point (edgept, pt2) && edgept != pt1);
635 edgept = edgept->
next;
637 while (!
exact_point (edgept, pt1) && edgept != pt2);
678 edgept = edgept->
next;
680 while (!
exact_point (edgept, pt2) && edgept != pt1);
688 edgept = edgept->
next;
690 while (!
exact_point (edgept, pt1) && edgept != pt2);
bool point_used_by_split(SPLIT *split, EDGEPT *point)
bool find_split_in_blob(SPLIT *split, TBLOB *blob)
ARRAY array_push(ARRAY array, void *value)
SEAMS start_seam_list(TBLOB *blobs)
void reveal_seam(SEAM *seam)
int shared_split_points(SEAM *seam1, SEAM *seam2)
bool point_used_by_seam(SEAM *seam, EDGEPT *point)
void hide_edge_pair(EDGEPT *pt1, EDGEPT *pt2)
void break_pieces(TBLOB *blobs, SEAMS seams, inT16 start, inT16 end)
int account_splits_left(SEAM *seam, TBLOB *blob, TBLOB *end_blob)
SEAM * join_two_seams(SEAM *seam1, SEAM *seam2)
#define exact_point(p1, p2)
SEAMS insert_seam(SEAMS seam_list, int index, SEAM *seam, TBLOB *left_blob, TBLOB *first_blob)
void print_seams(const char *label, SEAMS seams)
int account_splits_right(SEAM *seam, TBLOB *blob)
void join_pieces(TBLOB *piece_blobs, SEAMS seams, inT16 start, inT16 end)
ARRAY array_insert(ARRAY array, int index, void *value)
bool point_in_split(SPLIT *split, EDGEPT *point1, EDGEPT *point2)
makestructure(newseam, free_seam, SEAM)
void delete_split(SPLIT *split)
bool test_insert_seam(SEAMS seam_list, int index, TBLOB *left_blob, TBLOB *first_blob)
void delete_seam(void *arg)
#define NUM_STARTING_SEAMS
bool point_in_seam(SEAM *seam, SPLIT *split)
void hide_seam(SEAM *seam)
void combine_seams(SEAM *dest_seam, SEAM *source_seam)
void free_seam_list(SEAMS seam_list)
#define clone_seam(dest, source)
TBOX bounding_box() const
void account_splits_left_helper(SEAM *seam, TBLOB *blob, TBLOB *end_blob, inT32 *depth, inT8 *width, inT8 *found_em)
bool Contains(const TPOINT &pt)
SEAM * new_seam(PRIORITY priority, const TPOINT &location, SPLIT *split1, SPLIT *split2, SPLIT *split3)
SEAMS add_seam(SEAMS seam_list, SEAM *seam)
#define array_value(a, i)
void cprintf(const char *format,...)
void print_split(SPLIT *split)
void print_seam(const char *label, SEAM *seam)
void reveal_edge_pair(EDGEPT *pt1, EDGEPT *pt2)