24 #include "config_auto.h"
55 edgept = edgept->
next;
60 edgept = edgept->
next;
69 edgept = edgept->
next;
74 edgept = edgept->
next;
82 int centered_maxwidth,
double center_knob,
83 double width_change_knob)
const {
86 int min_left = std::min(box1.
left(), box2.
left());
87 int max_right = std::max(box1.
right(), box2.
right());
88 if (xmin < min_left && xmax > max_right)
return kBadPriority;
92 int width1 = box1.
width();
93 int width2 = box2.
width();
94 int min_width = std::min(width1, width2);
95 int overlap = -box1.
x_gap(box2);
96 if (overlap == min_width) {
99 if (2 * overlap > min_width) overlap += 2 * overlap - min_width;
100 if (overlap > 0) grade += overlap_knob * overlap;
103 if (width1 <= centered_maxwidth || width2 <= centered_maxwidth) {
104 grade += std::min(
static_cast<double>(
kCenterGradeCap), center_knob * abs(width1 - width2));
107 float width_change_grade = 20 - (max_right - min_left - std::max(width1, width2));
108 if (width_change_grade > 0.0f)
109 grade += width_change_grade * width_change_knob;
143 this_edgept->
pos.
x = x;
144 this_edgept->
pos.
y = y;
147 if (prev_ol !=
nullptr && prev->
next == next) {
151 double cut_fraction = target_vec.
length() / segment_vec.
length();
157 ICOORD step_vec = step_end - step_start;
158 double target_length = step_vec.
length() * cut_fraction;
162 double best_dist = target_length;
163 for (
int s = prev->
start_step; s < end_step; ++s) {
164 total_step += prev_ol->
step(s % step_length);
165 double dist = fabs(target_length - total_step.
length());
166 if (dist < best_dist) {
173 this_edgept->
step_count = end_step - best_step;
174 this_edgept->
start_step = best_step % step_length;
183 this_edgept->
next = next;
184 this_edgept->
prev = prev;
185 prev->
next = this_edgept;
186 next->
prev = this_edgept;
224 #ifndef GRAPHICS_DISABLED
237 while (outlines->
next !=
nullptr) outlines = outlines->
next;
243 outlines = outlines->
next;
const double kBadPriority
const int kCenterGradeCap
EDGEPT * make_edgept(int x, int y, EDGEPT *next, EDGEPT *prev)
bool wordrec_display_splits
void remove_edgept(EDGEPT *point)
#define BOOL_VAR(name, val, comment)
DLLSYM void tprintf(const char *format,...)
bool ShortNonCircularSegment(int min_points, const EDGEPT *end) const
int SegmentArea(const EDGEPT *end) const
bool EqualPos(const EDGEPT &other) const
void ComputeBoundingBox()
bool SegmentCrossesOutline(const TPOINT &pt1, const TPOINT &pt2) const
ICOORD step(int index) const
ICOORD position_at_index(int index) const
int32_t pathlength() const
float length() const
find length
float length() const
find length
int x_gap(const TBOX &box) const
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
bool IsLittleChunk(int min_points, int min_area) const
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const
void SplitOutlineList(TESSLINE *outlines) const
TBOX bounding_box() const
void SplitOutline() const
void UnsplitOutlineList(TBLOB *blob) const
void Mark(ScrollView *window) const
void UnsplitOutlines() const
void Line(int x1, int y1, int x2, int y2)