tesseract  4.1.0
EDGEPT Struct Reference

#include <blobs.h>

Public Member Functions

 EDGEPT ()
 
 EDGEPT (const EDGEPT &src)
 
EDGEPToperator= (const EDGEPT &src)
 
void CopyFrom (const EDGEPT &src)
 
int WeightedDistance (const EDGEPT &other, int x_factor) const
 
bool EqualPos (const EDGEPT &other) const
 
TBOX SegmentBox (const EDGEPT *end) const
 
int SegmentArea (const EDGEPT *end) const
 
bool ShortNonCircularSegment (int min_points, const EDGEPT *end) const
 
void Hide ()
 
void Reveal ()
 
bool IsHidden () const
 
void MarkChop ()
 
bool IsChopPt () const
 

Public Attributes

TPOINT pos
 
VECTOR vec
 
char flags [EDGEPTFLAGS]
 
EDGEPTnext
 
EDGEPTprev
 
C_OUTLINEsrc_outline
 
int start_step
 
int step_count
 

Detailed Description

Definition at line 78 of file blobs.h.

Constructor & Destructor Documentation

EDGEPT::EDGEPT ( )
inline

Definition at line 79 of file blobs.h.

80  : next(nullptr), prev(nullptr), src_outline(nullptr), start_step(0), step_count(0) {
81  memset(flags, 0, EDGEPTFLAGS * sizeof(flags[0]));
82  }
int step_count
Definition: blobs.h:176
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
#define EDGEPTFLAGS
Definition: blobs.h:50
EDGEPT * next
Definition: blobs.h:171
int start_step
Definition: blobs.h:175
C_OUTLINE * src_outline
Definition: blobs.h:173
EDGEPT * prev
Definition: blobs.h:172
EDGEPT::EDGEPT ( const EDGEPT src)
inline

Definition at line 83 of file blobs.h.

83  : next(nullptr), prev(nullptr) {
84  CopyFrom(src);
85  }
EDGEPT * next
Definition: blobs.h:171
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:91
EDGEPT * prev
Definition: blobs.h:172

Member Function Documentation

void EDGEPT::CopyFrom ( const EDGEPT src)
inline

Definition at line 91 of file blobs.h.

91  {
92  pos = src.pos;
93  vec = src.vec;
94  memcpy(flags, src.flags, EDGEPTFLAGS * sizeof(flags[0]));
96  start_step = src.start_step;
97  step_count = src.step_count;
98  }
int step_count
Definition: blobs.h:176
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
#define EDGEPTFLAGS
Definition: blobs.h:50
TPOINT pos
Definition: blobs.h:165
int start_step
Definition: blobs.h:175
C_OUTLINE * src_outline
Definition: blobs.h:173
VECTOR vec
Definition: blobs.h:166
bool EDGEPT::EqualPos ( const EDGEPT other) const
inline

Definition at line 107 of file blobs.h.

107 { return pos == other.pos; }
TPOINT pos
Definition: blobs.h:165
void EDGEPT::Hide ( )
inline

Definition at line 149 of file blobs.h.

149  {
150  flags[0] = true;
151  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
bool EDGEPT::IsChopPt ( ) const
inline

Definition at line 161 of file blobs.h.

161  {
162  return flags[2] != 0;
163  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
bool EDGEPT::IsHidden ( ) const
inline

Definition at line 155 of file blobs.h.

155  {
156  return flags[0] != 0;
157  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
void EDGEPT::MarkChop ( )
inline

Definition at line 158 of file blobs.h.

158  {
159  flags[2] = true;
160  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
EDGEPT& EDGEPT::operator= ( const EDGEPT src)
inline

Definition at line 86 of file blobs.h.

86  {
87  CopyFrom(src);
88  return *this;
89  }
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:91
void EDGEPT::Reveal ( )
inline

Definition at line 152 of file blobs.h.

152  {
153  flags[0] = false;
154  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
int EDGEPT::SegmentArea ( const EDGEPT end) const
inline

Definition at line 124 of file blobs.h.

124  {
125  int area = 0;
126  const EDGEPT* pt = this->next;
127  do {
128  TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
129  area += CROSS(origin_vec, pt->vec);
130  pt = pt->next;
131  } while (pt != end && pt != this);
132  return area;
133  }
int16_t x
Definition: blobs.h:73
EDGEPT * next
Definition: blobs.h:171
TPOINT pos
Definition: blobs.h:165
int16_t y
Definition: blobs.h:74
Definition: blobs.h:52
Definition: blobs.h:78
#define CROSS(a, b)
Definition: vecfuncs.h:47
VECTOR vec
Definition: blobs.h:166
TBOX EDGEPT::SegmentBox ( const EDGEPT end) const
inline

Definition at line 110 of file blobs.h.

110  {
111  TBOX box(pos.x, pos.y, pos.x, pos.y);
112  const EDGEPT* pt = this;
113  do {
114  pt = pt->next;
115  if (pt->pos.x < box.left()) box.set_left(pt->pos.x);
116  if (pt->pos.x > box.right()) box.set_right(pt->pos.x);
117  if (pt->pos.y < box.bottom()) box.set_bottom(pt->pos.y);
118  if (pt->pos.y > box.top()) box.set_top(pt->pos.y);
119  } while (pt != end && pt != this);
120  return box;
121  }
Definition: rect.h:34
int16_t x
Definition: blobs.h:73
EDGEPT * next
Definition: blobs.h:171
TPOINT pos
Definition: blobs.h:165
int16_t y
Definition: blobs.h:74
Definition: blobs.h:78
bool EDGEPT::ShortNonCircularSegment ( int  min_points,
const EDGEPT end 
) const
inline

Definition at line 137 of file blobs.h.

137  {
138  int count = 0;
139  const EDGEPT* pt = this;
140  do {
141  if (pt == end) return true;
142  pt = pt->next;
143  ++count;
144  } while (pt != this && count <= min_points);
145  return false;
146  }
EDGEPT * next
Definition: blobs.h:171
Definition: blobs.h:78
int count(LIST var_list)
Definition: oldlist.cpp:96
int EDGEPT::WeightedDistance ( const EDGEPT other,
int  x_factor 
) const
inline

Definition at line 101 of file blobs.h.

101  {
102  int x_dist = pos.x - other.pos.x;
103  int y_dist = pos.y - other.pos.y;
104  return x_dist * x_dist * x_factor + y_dist * y_dist;
105  }
int16_t x
Definition: blobs.h:73
TPOINT pos
Definition: blobs.h:165
int16_t y
Definition: blobs.h:74

Member Data Documentation

char EDGEPT::flags[EDGEPTFLAGS]

Definition at line 170 of file blobs.h.

EDGEPT* EDGEPT::next

Definition at line 171 of file blobs.h.

TPOINT EDGEPT::pos

Definition at line 165 of file blobs.h.

EDGEPT* EDGEPT::prev

Definition at line 172 of file blobs.h.

C_OUTLINE* EDGEPT::src_outline

Definition at line 173 of file blobs.h.

int EDGEPT::start_step

Definition at line 175 of file blobs.h.

int EDGEPT::step_count

Definition at line 176 of file blobs.h.

VECTOR EDGEPT::vec

Definition at line 166 of file blobs.h.


The documentation for this struct was generated from the following file: