30 #include "config_auto.h" 61 edgept = edgept->
next;
66 edgept = edgept->
next;
75 edgept = edgept->
next;
80 edgept = edgept->
next;
88 int centered_maxwidth,
double center_knob,
89 double width_change_knob)
const {
92 int min_left = std::min(box1.
left(), box2.
left());
93 int max_right = std::max(box1.
right(), box2.
right());
94 if (xmin < min_left && xmax > max_right)
return kBadPriority;
98 int width1 = box1.
width();
99 int width2 = box2.
width();
100 int min_width = std::min(width1, width2);
101 int overlap = -box1.
x_gap(box2);
102 if (overlap == min_width) {
105 if (2 * overlap > min_width) overlap += 2 * overlap - min_width;
106 if (overlap > 0) grade += overlap_knob * overlap;
109 if (width1 <= centered_maxwidth || width2 <= centered_maxwidth) {
110 grade += std::min(static_cast<double>(
kCenterGradeCap), center_knob * abs(width1 - width2));
113 float width_change_grade = 20 - (max_right - min_left - std::max(width1, width2));
114 if (width_change_grade > 0.0f)
115 grade += width_change_grade * width_change_knob;
149 this_edgept->
pos.
x = x;
150 this_edgept->
pos.
y = y;
153 if (prev_ol !=
nullptr && prev->
next == next) {
157 double cut_fraction = target_vec.
length() / segment_vec.
length();
163 ICOORD step_vec = step_end - step_start;
164 double target_length = step_vec.
length() * cut_fraction;
168 double best_dist = target_length;
169 for (
int s = prev->
start_step; s < end_step; ++s) {
170 total_step += prev_ol->
step(s % step_length);
171 double dist = fabs(target_length - total_step.
length());
172 if (dist < best_dist) {
179 this_edgept->
step_count = end_step - best_step;
180 this_edgept->
start_step = best_step % step_length;
189 this_edgept->
next = next;
190 this_edgept->
prev = prev;
191 prev->
next = this_edgept;
192 next->
prev = this_edgept;
230 #ifndef GRAPHICS_DISABLED 243 while (outlines->
next !=
nullptr) outlines = outlines->
next;
249 outlines = outlines->
next;
EDGEPT * make_edgept(int x, int y, EDGEPT *next, EDGEPT *prev)
void UnsplitOutlines() const
#define BOOL_VAR(name, val, comment)
const int kCenterGradeCap
TBOX bounding_box() const
bool wordrec_display_splits
void UnsplitOutlineList(TBLOB *blob) const
void ComputeBoundingBox()
bool ShortNonCircularSegment(int min_points, const EDGEPT *end) const
void SplitOutline() const
void remove_edgept(EDGEPT *point)
int x_gap(const TBOX &box) const
bool SegmentCrossesOutline(const TPOINT &pt1, const TPOINT &pt2) const
ICOORD position_at_index(int index) const
int SegmentArea(const EDGEPT *end) const
int32_t pathlength() const
DLLSYM void tprintf(const char *format,...)
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const
bool IsLittleChunk(int min_points, int min_area) const
float length() const
find length
void SplitOutlineList(TESSLINE *outlines) const
float length() const
find length
bool EqualPos(const EDGEPT &other) const
const double kBadPriority
ICOORD step(int index) const
void Line(int x1, int y1, int x2, int y2)
void Mark(ScrollView *window) const