tesseract  5.0.0
tesseract::EDGEPT Struct Reference

#include <blobs.h>

Public Member Functions

 EDGEPT ()=default
 
 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
 
bool is_hidden = false
 
uint8_t runlength = 0
 
int8_t dir = 0
 
bool fixed = false
 
EDGEPTnext = nullptr
 
EDGEPTprev = nullptr
 
C_OUTLINEsrc_outline = nullptr
 
int start_step = 0
 
int step_count = 0
 

Detailed Description

Definition at line 95 of file blobs.h.

Constructor & Destructor Documentation

◆ EDGEPT() [1/2]

tesseract::EDGEPT::EDGEPT ( )
default

◆ EDGEPT() [2/2]

tesseract::EDGEPT::EDGEPT ( const EDGEPT src)
inline

Definition at line 97 of file blobs.h.

97  : next(nullptr), prev(nullptr) {
98  CopyFrom(src);
99  }
EDGEPT * next
Definition: blobs.h:200
EDGEPT * prev
Definition: blobs.h:201
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:105

Member Function Documentation

◆ CopyFrom()

void tesseract::EDGEPT::CopyFrom ( const EDGEPT src)
inline

Definition at line 105 of file blobs.h.

105  {
106  pos = src.pos;
107  vec = src.vec;
108  is_hidden = src.is_hidden;
109  runlength = src.runlength;
110  dir = src.dir;
111  fixed = src.fixed;
112  src_outline = src.src_outline;
113  start_step = src.start_step;
114  step_count = src.step_count;
115  }
bool is_hidden
Definition: blobs.h:196
uint8_t runlength
Definition: blobs.h:197
TPOINT pos
Definition: blobs.h:194
int8_t dir
Definition: blobs.h:198
VECTOR vec
Definition: blobs.h:195
C_OUTLINE * src_outline
Definition: blobs.h:202

◆ EqualPos()

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

Definition at line 124 of file blobs.h.

124  {
125  return pos == other.pos;
126  }

◆ Hide()

void tesseract::EDGEPT::Hide ( )
inline

Definition at line 178 of file blobs.h.

178  {
179  is_hidden = true;
180  }

◆ IsChopPt()

bool tesseract::EDGEPT::IsChopPt ( ) const
inline

Definition at line 190 of file blobs.h.

190  {
191  return dir != 0;
192  }

◆ IsHidden()

bool tesseract::EDGEPT::IsHidden ( ) const
inline

Definition at line 184 of file blobs.h.

184  {
185  return is_hidden;
186  }

◆ MarkChop()

void tesseract::EDGEPT::MarkChop ( )
inline

Definition at line 187 of file blobs.h.

187  {
188  dir = 1;
189  }

◆ operator=()

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

Definition at line 100 of file blobs.h.

100  {
101  CopyFrom(src);
102  return *this;
103  }

◆ Reveal()

void tesseract::EDGEPT::Reveal ( )
inline

Definition at line 181 of file blobs.h.

181  {
182  is_hidden = false;
183  }

◆ SegmentArea()

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

Definition at line 151 of file blobs.h.

151  {
152  int area = 0;
153  const EDGEPT *pt = this->next;
154  do {
155  TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
156  area += origin_vec.cross(pt->vec);
157  pt = pt->next;
158  } while (pt != end && pt != this);
159  return area;
160  }
@ TPOINT
TDimension x
Definition: blobs.h:89
TDimension y
Definition: blobs.h:90

◆ SegmentBox()

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

Definition at line 129 of file blobs.h.

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

◆ ShortNonCircularSegment()

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

Definition at line 164 of file blobs.h.

164  {
165  int count = 0;
166  const EDGEPT *pt = this;
167  do {
168  if (pt == end) {
169  return true;
170  }
171  pt = pt->next;
172  ++count;
173  } while (pt != this && count <= min_points);
174  return false;
175  }

◆ WeightedDistance()

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

Definition at line 118 of file blobs.h.

118  {
119  int x_dist = pos.x - other.pos.x;
120  int y_dist = pos.y - other.pos.y;
121  return x_dist * x_dist * x_factor + y_dist * y_dist;
122  }

Member Data Documentation

◆ dir

int8_t tesseract::EDGEPT::dir = 0

Definition at line 198 of file blobs.h.

◆ fixed

bool tesseract::EDGEPT::fixed = false

Definition at line 199 of file blobs.h.

◆ is_hidden

bool tesseract::EDGEPT::is_hidden = false

Definition at line 196 of file blobs.h.

◆ next

EDGEPT* tesseract::EDGEPT::next = nullptr

Definition at line 200 of file blobs.h.

◆ pos

TPOINT tesseract::EDGEPT::pos

Definition at line 194 of file blobs.h.

◆ prev

EDGEPT* tesseract::EDGEPT::prev = nullptr

Definition at line 201 of file blobs.h.

◆ runlength

uint8_t tesseract::EDGEPT::runlength = 0

Definition at line 197 of file blobs.h.

◆ src_outline

C_OUTLINE* tesseract::EDGEPT::src_outline = nullptr

Definition at line 202 of file blobs.h.

◆ start_step

int tesseract::EDGEPT::start_step = 0

Definition at line 204 of file blobs.h.

◆ step_count

int tesseract::EDGEPT::step_count = 0

Definition at line 205 of file blobs.h.

◆ vec

VECTOR tesseract::EDGEPT::vec

Definition at line 195 of file blobs.h.


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