tesseract  4.0.0-1-g2a2b
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 83 of file blobs.h.

Constructor & Destructor Documentation

◆ EDGEPT() [1/2]

EDGEPT::EDGEPT ( )
inline

Definition at line 84 of file blobs.h.

85  : next(nullptr), prev(nullptr), src_outline(nullptr), start_step(0), step_count(0) {
86  memset(flags, 0, EDGEPTFLAGS * sizeof(flags[0]));
87  }
int step_count
Definition: blobs.h:181
int start_step
Definition: blobs.h:180
#define EDGEPTFLAGS
Definition: blobs.h:55
EDGEPT * prev
Definition: blobs.h:177
C_OUTLINE * src_outline
Definition: blobs.h:178
char flags[EDGEPTFLAGS]
Definition: blobs.h:175
EDGEPT * next
Definition: blobs.h:176

◆ EDGEPT() [2/2]

EDGEPT::EDGEPT ( const EDGEPT src)
inline

Definition at line 88 of file blobs.h.

88  : next(nullptr), prev(nullptr) {
89  CopyFrom(src);
90  }
EDGEPT * prev
Definition: blobs.h:177
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:96
EDGEPT * next
Definition: blobs.h:176

Member Function Documentation

◆ CopyFrom()

void EDGEPT::CopyFrom ( const EDGEPT src)
inline

Definition at line 96 of file blobs.h.

96  {
97  pos = src.pos;
98  vec = src.vec;
99  memcpy(flags, src.flags, EDGEPTFLAGS * sizeof(flags[0]));
100  src_outline = src.src_outline;
101  start_step = src.start_step;
102  step_count = src.step_count;
103  }
int step_count
Definition: blobs.h:181
TPOINT pos
Definition: blobs.h:170
int start_step
Definition: blobs.h:180
#define EDGEPTFLAGS
Definition: blobs.h:55
VECTOR vec
Definition: blobs.h:171
C_OUTLINE * src_outline
Definition: blobs.h:178
char flags[EDGEPTFLAGS]
Definition: blobs.h:175

◆ EqualPos()

bool EDGEPT::EqualPos ( const EDGEPT other) const
inline

Definition at line 112 of file blobs.h.

112 { return pos == other.pos; }
TPOINT pos
Definition: blobs.h:170

◆ Hide()

void EDGEPT::Hide ( )
inline

Definition at line 154 of file blobs.h.

154  {
155  flags[0] = true;
156  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:175

◆ IsChopPt()

bool EDGEPT::IsChopPt ( ) const
inline

Definition at line 166 of file blobs.h.

166  {
167  return flags[2] != 0;
168  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:175

◆ IsHidden()

bool EDGEPT::IsHidden ( ) const
inline

Definition at line 160 of file blobs.h.

160  {
161  return flags[0] != 0;
162  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:175

◆ MarkChop()

void EDGEPT::MarkChop ( )
inline

Definition at line 163 of file blobs.h.

163  {
164  flags[2] = true;
165  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:175

◆ operator=()

EDGEPT& EDGEPT::operator= ( const EDGEPT src)
inline

Definition at line 91 of file blobs.h.

91  {
92  CopyFrom(src);
93  return *this;
94  }
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:96

◆ Reveal()

void EDGEPT::Reveal ( )
inline

Definition at line 157 of file blobs.h.

157  {
158  flags[0] = false;
159  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:175

◆ SegmentArea()

int EDGEPT::SegmentArea ( const EDGEPT end) const
inline

Definition at line 129 of file blobs.h.

129  {
130  int area = 0;
131  const EDGEPT* pt = this->next;
132  do {
133  TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
134  area += CROSS(origin_vec, pt->vec);
135  pt = pt->next;
136  } while (pt != end && pt != this);
137  return area;
138  }
TPOINT pos
Definition: blobs.h:170
#define CROSS(a, b)
Definition: vecfuncs.h:52
VECTOR vec
Definition: blobs.h:171
Definition: blobs.h:83
int16_t x
Definition: blobs.h:78
Definition: blobs.h:57
int16_t y
Definition: blobs.h:79
EDGEPT * next
Definition: blobs.h:176

◆ SegmentBox()

TBOX EDGEPT::SegmentBox ( const EDGEPT end) const
inline

Definition at line 115 of file blobs.h.

115  {
116  TBOX box(pos.x, pos.y, pos.x, pos.y);
117  const EDGEPT* pt = this;
118  do {
119  pt = pt->next;
120  if (pt->pos.x < box.left()) box.set_left(pt->pos.x);
121  if (pt->pos.x > box.right()) box.set_right(pt->pos.x);
122  if (pt->pos.y < box.bottom()) box.set_bottom(pt->pos.y);
123  if (pt->pos.y > box.top()) box.set_top(pt->pos.y);
124  } while (pt != end && pt != this);
125  return box;
126  }
TPOINT pos
Definition: blobs.h:170
Definition: rect.h:34
Definition: blobs.h:83
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79
EDGEPT * next
Definition: blobs.h:176

◆ ShortNonCircularSegment()

bool EDGEPT::ShortNonCircularSegment ( int  min_points,
const EDGEPT end 
) const
inline

Definition at line 142 of file blobs.h.

142  {
143  int count = 0;
144  const EDGEPT* pt = this;
145  do {
146  if (pt == end) return true;
147  pt = pt->next;
148  ++count;
149  } while (pt != this && count <= min_points);
150  return false;
151  }
int count(LIST var_list)
Definition: oldlist.cpp:98
Definition: blobs.h:83
EDGEPT * next
Definition: blobs.h:176

◆ WeightedDistance()

int EDGEPT::WeightedDistance ( const EDGEPT other,
int  x_factor 
) const
inline

Definition at line 106 of file blobs.h.

106  {
107  int x_dist = pos.x - other.pos.x;
108  int y_dist = pos.y - other.pos.y;
109  return x_dist * x_dist * x_factor + y_dist * y_dist;
110  }
TPOINT pos
Definition: blobs.h:170
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

Member Data Documentation

◆ flags

char EDGEPT::flags[EDGEPTFLAGS]

Definition at line 175 of file blobs.h.

◆ next

EDGEPT* EDGEPT::next

Definition at line 176 of file blobs.h.

◆ pos

TPOINT EDGEPT::pos

Definition at line 170 of file blobs.h.

◆ prev

EDGEPT* EDGEPT::prev

Definition at line 177 of file blobs.h.

◆ src_outline

C_OUTLINE* EDGEPT::src_outline

Definition at line 178 of file blobs.h.

◆ start_step

int EDGEPT::start_step

Definition at line 180 of file blobs.h.

◆ step_count

int EDGEPT::step_count

Definition at line 181 of file blobs.h.

◆ vec

VECTOR EDGEPT::vec

Definition at line 171 of file blobs.h.


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