20 #ifndef TESSERACT_TEXTORD_TABVECTOR_H__
21 #define TESSERACT_TEXTORD_TABVECTOR_H__
37 "Max fraction of mean blob width allowed for vertical gaps in vertical text");
39 "Fraction of box matches required to declare a line vertical");
78 static void CreateConstraint(
TabVector* vector,
bool is_top);
81 static bool CompatibleConstraints(TabConstraint_LIST* list1,
82 TabConstraint_LIST* list2);
86 static void MergeConstraints(TabConstraint_LIST* list1,
87 TabConstraint_LIST* list2);
91 static void ApplyConstraints(TabConstraint_LIST* constraints);
97 static void GetConstraints(TabConstraint_LIST* constraints,
98 int* y_min,
int* y_max);
128 int extended_start_y,
int extended_end_y,
129 BLOBNBOX_CLIST* good_points,
130 int* vertical_x,
int* vertical_y);
153 return extended_ymax_;
156 return extended_ymin_;
165 top_constraints_ = constraints;
168 bottom_constraints_ = constraints;
180 return intersects_other_lines_;
183 intersects_other_lines_ = value;
190 int height = endpt_.
y() - startpt_.
y();
192 return (y - startpt_.
y()) * (endpt_.
x() - startpt_.
x()) / height +
200 return MIN(other.endpt_.
y(), endpt_.
y()) -
201 MAX(other.startpt_.
y(), startpt_.
y());
205 return MIN(top_y, endpt_.
y()) -
MAX(bottom_y, startpt_.
y());
209 return MIN(top_y, extended_ymax_) -
MAX(bottom_y, extended_ymin_);
236 return sort_key_ < other.sort_key_;
241 return partners_.empty();
246 return boxes_.length();
251 boxes_.shallow_clear();
256 int x = startpt_.
y();
257 startpt_.
set_y(startpt_.
x());
266 startpt_.
set_x(-startpt_.
x());
267 endpt_.
set_x(-endpt_.
x());
268 sort_key_ = -sort_key_;
282 return pt * vertical;
287 if (vertical.
y() != 0)
288 return (vertical.
x() * y +
sort_key) / vertical.
y();
297 return tv1->sort_key_ - tv2->sort_key_;
329 TabVector_LIST* vectors,
BlobGrid* grid);
349 void Print(
const char* prefix);
352 void Debug(
const char* prefix);
373 bool Fit(
ICOORD vertical,
bool force_parallel);
413 bool needs_evaluation_;
415 bool intersects_other_lines_;
419 BLOBNBOX_CLIST boxes_;
421 TabVector_CLIST partners_;
424 TabConstraint_LIST* top_constraints_;
425 TabConstraint_LIST* bottom_constraints_;
430 #endif // TESSERACT_TEXTORD_TABVECTOR_H__