tesseract  5.0.0-alpha-619-ge9db
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 97 of file blobs.h.

Constructor & Destructor Documentation

◆ EDGEPT() [1/2]

EDGEPT::EDGEPT ( )
inline

Definition at line 98 of file blobs.h.

98  {
99  EDGEPT()
100  : next(nullptr), prev(nullptr), src_outline(nullptr), start_step(0), step_count(0) {
101  memset(flags, 0, EDGEPTFLAGS * sizeof(flags[0]));

◆ EDGEPT() [2/2]

EDGEPT::EDGEPT ( const EDGEPT src)
inline

Definition at line 102 of file blobs.h.

103  : next(nullptr), prev(nullptr) {
104  CopyFrom(src);

Member Function Documentation

◆ CopyFrom()

void EDGEPT::CopyFrom ( const EDGEPT src)
inline

Definition at line 110 of file blobs.h.

111  {
112  pos = src.pos;
113  vec = src.vec;
114  memcpy(flags, src.flags, EDGEPTFLAGS * sizeof(flags[0]));
115  src_outline = src.src_outline;
116  start_step = src.start_step;
117  step_count = src.step_count;

◆ EqualPos()

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

Definition at line 126 of file blobs.h.

127 { return pos == other.pos; }

◆ Hide()

void EDGEPT::Hide ( )
inline

Definition at line 168 of file blobs.h.

169  {
170  flags[0] = true;

◆ IsChopPt()

bool EDGEPT::IsChopPt ( ) const
inline

Definition at line 180 of file blobs.h.

181  {
182  return flags[2] != 0;

◆ IsHidden()

bool EDGEPT::IsHidden ( ) const
inline

Definition at line 174 of file blobs.h.

175  {
176  return flags[0] != 0;

◆ MarkChop()

void EDGEPT::MarkChop ( )
inline

Definition at line 177 of file blobs.h.

178  {
179  flags[2] = true;

◆ operator=()

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

Definition at line 105 of file blobs.h.

106  {
107  CopyFrom(src);
108  return *this;

◆ Reveal()

void EDGEPT::Reveal ( )
inline

Definition at line 171 of file blobs.h.

172  {
173  flags[0] = false;

◆ SegmentArea()

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

Definition at line 143 of file blobs.h.

144  {
145  int area = 0;
146  const EDGEPT* pt = this->next;
147  do {
148  TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
149  area += origin_vec.cross(pt->vec);
150  pt = pt->next;
151  } while (pt != end && pt != this);
152  return area;

◆ SegmentBox()

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

Definition at line 129 of file blobs.h.

130  {
131  TBOX box(pos.x, pos.y, pos.x, pos.y);
132  const EDGEPT* pt = this;
133  do {
134  pt = pt->next;
135  if (pt->pos.x < box.left()) box.set_left(pt->pos.x);
136  if (pt->pos.x > box.right()) box.set_right(pt->pos.x);
137  if (pt->pos.y < box.bottom()) box.set_bottom(pt->pos.y);
138  if (pt->pos.y > box.top()) box.set_top(pt->pos.y);
139  } while (pt != end && pt != this);
140  return box;

◆ ShortNonCircularSegment()

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

Definition at line 156 of file blobs.h.

157  {
158  int count = 0;
159  const EDGEPT* pt = this;
160  do {
161  if (pt == end) return true;
162  pt = pt->next;
163  ++count;
164  } while (pt != this && count <= min_points);
165  return false;

◆ WeightedDistance()

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

Definition at line 120 of file blobs.h.

121  {
122  int x_dist = pos.x - other.pos.x;
123  int y_dist = pos.y - other.pos.y;
124  return x_dist * x_dist * x_factor + y_dist * y_dist;

Member Data Documentation

◆ flags

char EDGEPT::flags[EDGEPTFLAGS]

Definition at line 189 of file blobs.h.

◆ next

EDGEPT* EDGEPT::next

Definition at line 190 of file blobs.h.

◆ pos

TPOINT EDGEPT::pos

Definition at line 184 of file blobs.h.

◆ prev

EDGEPT* EDGEPT::prev

Definition at line 191 of file blobs.h.

◆ src_outline

C_OUTLINE* EDGEPT::src_outline

Definition at line 192 of file blobs.h.

◆ start_step

int EDGEPT::start_step

Definition at line 194 of file blobs.h.

◆ step_count

int EDGEPT::step_count

Definition at line 195 of file blobs.h.

◆ vec

VECTOR EDGEPT::vec

Definition at line 185 of file blobs.h.


The documentation for this struct was generated from the following file:
TPOINT
Definition: blobs.h:49
EDGEPT::src_outline
C_OUTLINE * src_outline
Definition: blobs.h:192
EDGEPT::step_count
int step_count
Definition: blobs.h:195
EDGEPT::EDGEPT
EDGEPT()
Definition: blobs.h:98
EDGEPTFLAGS
#define EDGEPTFLAGS
Definition: blobs.h:47
EDGEPT::prev
EDGEPT * prev
Definition: blobs.h:191
EDGEPT::start_step
int start_step
Definition: blobs.h:194
TPOINT::x
int16_t x
Definition: blobs.h:91
TPOINT::y
int16_t y
Definition: blobs.h:92
EDGEPT::vec
VECTOR vec
Definition: blobs.h:185
EDGEPT::flags
char flags[EDGEPTFLAGS]
Definition: blobs.h:189
count
int count(LIST var_list)
Definition: oldlist.cpp:79
EDGEPT
Definition: blobs.h:97
EDGEPT::pos
TPOINT pos
Definition: blobs.h:184
EDGEPT::next
EDGEPT * next
Definition: blobs.h:190
EDGEPT::CopyFrom
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:110
TBOX
Definition: rect.h:33