43 #define SPLIT_CLOSENESS 20 45 #define MAX_NUM_SEAMS 150 47 #define MAX_OLD_SEAMS 150 48 #define NO_FULL_PRIORITY -1 50 #define BAD_PRIORITY 9999.0 65 if (new_seam == NULL)
return;
67 tprintf(
"Pushing new seam with priority %g :", new_priority);
68 new_seam->
Print(
"seam: ");
72 if (seams->
PopWorst(&old_pair) && old_pair.
key() <= new_priority) {
74 tprintf(
"Old seam staying with priority %g\n", old_pair.
key());
77 seams->
Push(&old_pair);
80 tprintf(
"New seam with priority %g beats old worst seam with %g\n",
81 new_priority, old_pair.
key());
84 SeamPair new_pair(new_priority, new_seam);
85 seams->
Push(&new_pair);
109 my_priority = priority;
114 seam =
new SEAM(my_priority, split_point, *split);
124 while (!seam_queue->
empty()) {
126 seam_queue->
Pop(&seam_pair);
133 sprintf (str,
"Full my_priority %0.0f, ", my_priority);
137 if ((*seam_result == NULL || (*seam_result)->
priority() > my_priority) &&
143 *seam_result =
new SEAM(*seam);
144 (*seam_result)->set_priority(my_priority);
163 seam_pile->
Push(&pair);
166 seam_pile->
PeekTop().key() > seam_pair.
key()) {
169 seam_pile->
Pop(&pair);
174 seam_pile->
Push(&pair);
198 for (
int x = 0; x < seam_pile.
size(); ++x) {
199 const SEAM *this_one = seam_pile.
get(x).data();
218 EDGEPT_CLIST new_points;
221 inT16 num_points = 0;
223 #ifndef GRAPHICS_DISABLED 231 for (outline = blob->
outlines; outline; outline = outline->
next)
235 points[num_points++] = point_heap.
PeekTop().data;
236 point_heap.
Pop(NULL);
242 try_point_pairs(points, num_points, &seam_queue, &seam_pile, &seam, blob);
244 &seam_queue, &seam_pile, &seam, blob);
253 EDGEPT_C_IT it(&new_points);
254 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
255 EDGEPT *inserted_point = it.data();
256 if (seam == NULL || !seam->
UsesPoint(inserted_point)) {
257 for (outline = blob->
outlines; outline; outline = outline->
next) {
258 if (outline->
loop == inserted_point) {
271 #ifndef GRAPHICS_DISABLED 306 for (x = 0; x < num_points; x++) {
307 for (y = x + 1; y < num_points; y++) {
311 points[x] != points[y]->next && points[y] != points[x]->next &&
314 SPLIT split(points[x], points[y]);
336 EDGEPT_CLIST *new_points,
341 EDGEPT *vertical_point = NULL;
346 for (x = 0; x < num_points; x++) {
347 vertical_point = NULL;
348 for (outline = blob->
outlines; outline; outline = outline->
next) {
350 &vertical_point, new_points);
353 if (vertical_point && points[x] != vertical_point->
next &&
354 vertical_point != points[x]->
next &&
357 SPLIT split(points[x], vertical_point);
void remove_edgept(EDGEPT *point)
const Pair & get(int index) const
int chop_centered_maxwidth
void try_vertical_splits(EDGEPT *points[MAX_NUM_POINTS], inT16 num_points, EDGEPT_CLIST *new_points, SeamQueue *seam_queue, SeamPile *seam_pile, SEAM **seam, TBLOB *blob)
#define update_edge_window()
void set_data(Data *new_data)
void combine_seam(const SeamPile &seam_pile, const SEAM *seam, SeamQueue *seam_queue)
void draw_blob_edges(TBLOB *blob)
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
#define is_exterior_point(edge, point)
int chop_min_outline_points
void choose_best_seam(SeamQueue *seam_queue, const SPLIT *split, PRIORITY priority, SEAM **seam_result, TBLOB *blob, SeamPile *seam_pile)
TBOX bounding_box() const
#define partial_split_priority(split)
double chop_width_change_knob
void prioritize_points(TESSLINE *outline, PointHeap *points)
int chop_min_outline_area
void try_point_pairs(EDGEPT *points[MAX_NUM_POINTS], inT16 num_points, SeamQueue *seam_queue, SeamPile *seam_pile, SEAM **seam, TBLOB *blob)
const Pair & PeekTop() const
bool wordrec_display_splits
void CombineWith(const SEAM &other)
void add_seam_to_queue(float new_priority, SEAM *new_seam, SeamQueue *seams)
void Mark(ScrollView *window) const
bool UsesPoint(const EDGEPT *point) const
void vertical_projection_point(EDGEPT *split_point, EDGEPT *target_point, EDGEPT **best_point, EDGEPT_CLIST *new_points)
bool PopWorst(Pair *entry)
bool CombineableWith(const SEAM &other, int max_x_dist, float max_total_priority) const
void set_key(const Key &new_key)
#define edge_window_wait()
SEAM * pick_good_seam(TBLOB *blob)
void Print(const char *label) const
int WeightedDistance(const EDGEPT &other, int x_factor) const
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const