229 int ext_start_y, ext_end_y;
230 BLOBNBOX_CLIST good_points;
234 int pt_count = AlignTabs(align_params,
false, bbox, &good_points, &ext_end_y);
235 pt_count += AlignTabs(align_params,
true, bbox, &good_points, &ext_start_y);
236 BLOBNBOX_C_IT it(&good_points);
238 box = it.data()->bounding_box();
239 int end_y = box.
top();
240 int end_x = align_params.right_tab ? box.
right() : box.
left();
242 box = it.data()->bounding_box();
243 int start_x = align_params.right_tab ? box.
right() : box.
left();
244 int start_y = box.
bottom();
250 bool at_least_2_crossings = AtLeast2LineCrossings(&good_points);
251 if ((pt_count >= align_params.min_points &&
252 end_y - start_y >= align_params.min_length &&
253 (align_params.ragged ||
255 at_least_2_crossings) {
256 int confirmed_points = 0;
258 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
260 if (align_params.right_tab) {
269 if (!align_params.ragged ||
270 confirmed_points + confirmed_points < pt_count) {
273 tprintf(
"Confirming tab vector of %d pts starting at %d,%d\n",
277 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
279 if (align_params.right_tab) {
290 align_params.vertical,
291 ext_start_y, ext_end_y,
293 vertical_x, vertical_y);
294 result->set_intersects_other_lines(at_least_2_crossings);
297 result->Print(
"After fitting");
301 tprintf(
"Ragged tab used too many used points: %d out of %d\n",
302 confirmed_points, pt_count);
305 tprintf(
"Tab vector failed basic tests: pt count %d vs min %d, "
306 "length %d vs min %d, min grad %g\n",
307 pt_count, align_params.min_points, end_y - start_y,