27 #include "config_auto.h"
30 #define MINEDGELENGTH 8 // min decent length
41 C_OUTLINE_IT* outline_it) {
53 outline =
new C_OUTLINE (start, botleft, topright, looplength);
55 outline_it->add_after_then_move (outline);
78 const ERRCODE ED_ILLEGAL_SUM =
"Illegal sum of chain codes";
86 if (edgept->
stepdir != lastchain) {
88 chaindiff = edgept->
stepdir - lastchain;
91 else if (chaindiff < -2)
93 chainsum += chaindiff;
96 edgept = edgept->
next;
100 if ((chainsum != 4 && chainsum != -4)
102 if (edgept != start) {
107 ED_ILLEGAL_SUM.
error (
"check_path_legal",
TESSLOG,
"chainsum=%d",
134 leftmost = edgept->
pos.
x ();
137 edgept = edgept->
next;
138 if (edgept->
pos.
x () < botleft.
x ())
141 else if (edgept->
pos.
x () > topright.
x ())
143 if (edgept->
pos.
y () < botleft.
y ())
146 else if (edgept->
pos.
y () > topright.
y ()) {
148 leftmost = edgept->
pos.
x ();
151 else if (edgept->
pos.
y () == topright.
y ()
152 && edgept->
pos.
x () < leftmost) {
154 leftmost = edgept->
pos.
x ();
159 while (edgept != start);