#include "scrollview.h"
#include "params.h"
#include "pdblock.h"
#include "coutln.h"
#include "crakedge.h"
Go to the source code of this file.
◆ BUCKETSIZE
◆ check_path_legal()
Definition at line 65 of file edgloop.cpp.
67 {
68 int lastchain;
69 int chaindiff;
70 int32_t length;
71 int32_t chainsum;
73 constexpr ERRCODE ED_ILLEGAL_SUM(
"Illegal sum of chain codes");
74
75 length = 0;
76 chainsum = 0;
77 edgept = start;
79 do {
80 length++;
81 if (edgept->
stepdir != lastchain) {
82
83 chaindiff = edgept->
stepdir - lastchain;
84 if (chaindiff > 2)
85 chaindiff -= 4;
86 else if (chaindiff < -2)
87 chaindiff += 4;
88 chainsum += chaindiff;
90 }
91 edgept = edgept->
next;
92 }
94
95 if ((chainsum != 4 && chainsum != -4)
97 if (edgept != start) {
101 } else {
102 ED_ILLEGAL_SUM.error (
"check_path_legal",
TESSLOG,
"chainsum=%d",
103 chainsum);
105 }
106 }
107
109}
static const int kMaxOutlineLength
◆ complete_edge()
void complete_edge |
( |
CRACKEDGE * |
start, |
|
|
C_OUTLINE_IT * |
outline_it |
|
) |
| |
Definition at line 35 of file edgloop.cpp.
36 {
38 int16_t looplength;
42
43
45
48 outline =
new C_OUTLINE (start, botleft, topright, looplength);
49
50 outline_it->add_after_then_move (outline);
51 }
52}
int16_t loop_bounding_box(CRACKEDGE *&start, ICOORD &botleft, ICOORD &topright)
ScrollView::Color check_path_legal(CRACKEDGE *start)
◆ loop_bounding_box()
Definition at line 117 of file edgloop.cpp.
120 {
121 int16_t length;
122 int16_t leftmost;
125
126 edgept = start;
127 realstart = start;
129 leftmost = edgept->
pos.
x ();
130 length = 0;
131 do {
132 edgept = edgept->
next;
133 if (edgept->
pos.
x () < botleft.
x ())
134
136 else if (edgept->
pos.
x () > topright.
x ())
138 if (edgept->
pos.
y () < botleft.
y ())
139
141 else if (edgept->
pos.
y () > topright.
y ()) {
142 realstart = edgept;
143 leftmost = edgept->
pos.
x ();
145 }
146 else if (edgept->
pos.
y () == topright.
y ()
147 && edgept->
pos.
x () < leftmost) {
148
149 leftmost = edgept->
pos.
x ();
150 realstart = edgept;
151 }
152 length++;
153 }
154 while (edgept != start);
155 start = realstart;
156 return length;
157}
void set_x(int16_t xin)
rewrite function
int16_t y() const
access_function
void set_y(int16_t yin)
rewrite function
int16_t x() const
access function