tesseract  4.00.00dev
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 76 of file blobs.h.

Constructor & Destructor Documentation

◆ EDGEPT() [1/2]

EDGEPT::EDGEPT ( )
inline

Definition at line 77 of file blobs.h.

78  : next(NULL), prev(NULL), src_outline(NULL), start_step(0), step_count(0) {
79  memset(flags, 0, EDGEPTFLAGS * sizeof(flags[0]));
80  }
int start_step
Definition: blobs.h:173
char flags[EDGEPTFLAGS]
Definition: blobs.h:168
C_OUTLINE * src_outline
Definition: blobs.h:171
EDGEPT * prev
Definition: blobs.h:170
#define EDGEPTFLAGS
Definition: blobs.h:48
int step_count
Definition: blobs.h:174
EDGEPT * next
Definition: blobs.h:169

◆ EDGEPT() [2/2]

EDGEPT::EDGEPT ( const EDGEPT src)
inline

Definition at line 81 of file blobs.h.

81  : next(NULL), prev(NULL) {
82  CopyFrom(src);
83  }
EDGEPT * prev
Definition: blobs.h:170
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:89
EDGEPT * next
Definition: blobs.h:169

Member Function Documentation

◆ CopyFrom()

void EDGEPT::CopyFrom ( const EDGEPT src)
inline

Definition at line 89 of file blobs.h.

89  {
90  pos = src.pos;
91  vec = src.vec;
92  memcpy(flags, src.flags, EDGEPTFLAGS * sizeof(flags[0]));
94  start_step = src.start_step;
95  step_count = src.step_count;
96  }
int start_step
Definition: blobs.h:173
char flags[EDGEPTFLAGS]
Definition: blobs.h:168
TPOINT pos
Definition: blobs.h:163
C_OUTLINE * src_outline
Definition: blobs.h:171
#define EDGEPTFLAGS
Definition: blobs.h:48
VECTOR vec
Definition: blobs.h:164
int step_count
Definition: blobs.h:174

◆ EqualPos()

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

Definition at line 105 of file blobs.h.

105 { return pos == other.pos; }
TPOINT pos
Definition: blobs.h:163

◆ Hide()

void EDGEPT::Hide ( )
inline

Definition at line 147 of file blobs.h.

147  {
148  flags[0] = true;
149  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:168

◆ IsChopPt()

bool EDGEPT::IsChopPt ( ) const
inline

Definition at line 159 of file blobs.h.

159  {
160  return flags[2] != 0;
161  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:168

◆ IsHidden()

bool EDGEPT::IsHidden ( ) const
inline

Definition at line 153 of file blobs.h.

153  {
154  return flags[0] != 0;
155  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:168

◆ MarkChop()

void EDGEPT::MarkChop ( )
inline

Definition at line 156 of file blobs.h.

156  {
157  flags[2] = true;
158  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:168

◆ operator=()

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

Definition at line 84 of file blobs.h.

84  {
85  CopyFrom(src);
86  return *this;
87  }
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:89

◆ Reveal()

void EDGEPT::Reveal ( )
inline

Definition at line 150 of file blobs.h.

150  {
151  flags[0] = false;
152  }
char flags[EDGEPTFLAGS]
Definition: blobs.h:168

◆ SegmentArea()

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

Definition at line 122 of file blobs.h.

122  {
123  int area = 0;
124  const EDGEPT* pt = this->next;
125  do {
126  TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
127  area += CROSS(origin_vec, pt->vec);
128  pt = pt->next;
129  } while (pt != end && pt != this);
130  return area;
131  }
TPOINT pos
Definition: blobs.h:163
#define CROSS(a, b)
Definition: vecfuncs.h:52
VECTOR vec
Definition: blobs.h:164
inT16 x
Definition: blobs.h:71
EDGEPT * next
Definition: blobs.h:169
Definition: blobs.h:76
inT16 y
Definition: blobs.h:72
Definition: blobs.h:50

◆ SegmentBox()

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

Definition at line 108 of file blobs.h.

108  {
109  TBOX box(pos.x, pos.y, pos.x, pos.y);
110  const EDGEPT* pt = this;
111  do {
112  pt = pt->next;
113  if (pt->pos.x < box.left()) box.set_left(pt->pos.x);
114  if (pt->pos.x > box.right()) box.set_right(pt->pos.x);
115  if (pt->pos.y < box.bottom()) box.set_bottom(pt->pos.y);
116  if (pt->pos.y > box.top()) box.set_top(pt->pos.y);
117  } while (pt != end && pt != this);
118  return box;
119  }
TPOINT pos
Definition: blobs.h:163
inT16 x
Definition: blobs.h:71
EDGEPT * next
Definition: blobs.h:169
Definition: blobs.h:76
inT16 y
Definition: blobs.h:72
Definition: rect.h:30

◆ ShortNonCircularSegment()

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

Definition at line 135 of file blobs.h.

135  {
136  int count = 0;
137  const EDGEPT* pt = this;
138  do {
139  if (pt == end) return true;
140  pt = pt->next;
141  ++count;
142  } while (pt != this && count <= min_points);
143  return false;
144  }
EDGEPT * next
Definition: blobs.h:169
Definition: blobs.h:76
int count(LIST var_list)
Definition: oldlist.cpp:103

◆ WeightedDistance()

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

Definition at line 99 of file blobs.h.

99  {
100  int x_dist = pos.x - other.pos.x;
101  int y_dist = pos.y - other.pos.y;
102  return x_dist * x_dist * x_factor + y_dist * y_dist;
103  }
TPOINT pos
Definition: blobs.h:163
inT16 x
Definition: blobs.h:71
inT16 y
Definition: blobs.h:72

Member Data Documentation

◆ flags

char EDGEPT::flags[EDGEPTFLAGS]

Definition at line 168 of file blobs.h.

◆ next

EDGEPT* EDGEPT::next

Definition at line 169 of file blobs.h.

◆ pos

TPOINT EDGEPT::pos

Definition at line 163 of file blobs.h.

◆ prev

EDGEPT* EDGEPT::prev

Definition at line 170 of file blobs.h.

◆ src_outline

C_OUTLINE* EDGEPT::src_outline

Definition at line 171 of file blobs.h.

◆ start_step

int EDGEPT::start_step

Definition at line 173 of file blobs.h.

◆ step_count

int EDGEPT::step_count

Definition at line 174 of file blobs.h.

◆ vec

VECTOR EDGEPT::vec

Definition at line 164 of file blobs.h.


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