24 #include "config_auto.h"
27 #define MINEDGELENGTH 8 // min decent length
36 C_OUTLINE_IT* outline_it) {
48 outline =
new C_OUTLINE (start, botleft, topright, looplength);
50 outline_it->add_after_then_move (outline);
73 constexpr
ERRCODE ED_ILLEGAL_SUM(
"Illegal sum of chain codes");
81 if (edgept->
stepdir != lastchain) {
83 chaindiff = edgept->
stepdir - lastchain;
86 else if (chaindiff < -2)
88 chainsum += chaindiff;
91 edgept = edgept->
next;
95 if ((chainsum != 4 && chainsum != -4)
97 if (edgept != start) {
102 ED_ILLEGAL_SUM.error (
"check_path_legal",
TESSLOG,
"chainsum=%d",
129 leftmost = edgept->
pos.
x ();
132 edgept = edgept->
next;
133 if (edgept->
pos.
x () < botleft.
x ())
136 else if (edgept->
pos.
x () > topright.
x ())
138 if (edgept->
pos.
y () < botleft.
y ())
141 else if (edgept->
pos.
y () > topright.
y ()) {
143 leftmost = edgept->
pos.
x ();
146 else if (edgept->
pos.
y () == topright.
y ()
147 && edgept->
pos.
x () < leftmost) {
149 leftmost = edgept->
pos.
x ();
154 while (edgept != start);