tesseract 4.1.1
Loading...
Searching...
No Matches
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 99 of file blobs.h.

Constructor & Destructor Documentation

◆ EDGEPT() [1/2]

EDGEPT::EDGEPT ( )
inline

Definition at line 100 of file blobs.h.

101 : next(nullptr), prev(nullptr), src_outline(nullptr), start_step(0), step_count(0) {
102 memset(flags, 0, EDGEPTFLAGS * sizeof(flags[0]));
103 }
#define EDGEPTFLAGS
Definition: blobs.h:49
int start_step
Definition: blobs.h:196
EDGEPT * next
Definition: blobs.h:192
int step_count
Definition: blobs.h:197
C_OUTLINE * src_outline
Definition: blobs.h:194
char flags[EDGEPTFLAGS]
Definition: blobs.h:191
EDGEPT * prev
Definition: blobs.h:193

◆ EDGEPT() [2/2]

EDGEPT::EDGEPT ( const EDGEPT src)
inline

Definition at line 104 of file blobs.h.

104 : next(nullptr), prev(nullptr) {
105 CopyFrom(src);
106 }
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:112

Member Function Documentation

◆ CopyFrom()

void EDGEPT::CopyFrom ( const EDGEPT src)
inline

Definition at line 112 of file blobs.h.

112 {
113 pos = src.pos;
114 vec = src.vec;
115 memcpy(flags, src.flags, EDGEPTFLAGS * sizeof(flags[0]));
119 }
VECTOR vec
Definition: blobs.h:187
TPOINT pos
Definition: blobs.h:186

◆ EqualPos()

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

Definition at line 128 of file blobs.h.

128{ return pos == other.pos; }

◆ Hide()

void EDGEPT::Hide ( )
inline

Definition at line 170 of file blobs.h.

170 {
171 flags[0] = true;
172 }

◆ IsChopPt()

bool EDGEPT::IsChopPt ( ) const
inline

Definition at line 182 of file blobs.h.

182 {
183 return flags[2] != 0;
184 }

◆ IsHidden()

bool EDGEPT::IsHidden ( ) const
inline

Definition at line 176 of file blobs.h.

176 {
177 return flags[0] != 0;
178 }

◆ MarkChop()

void EDGEPT::MarkChop ( )
inline

Definition at line 179 of file blobs.h.

179 {
180 flags[2] = true;
181 }

◆ operator=()

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

Definition at line 107 of file blobs.h.

107 {
108 CopyFrom(src);
109 return *this;
110 }

◆ Reveal()

void EDGEPT::Reveal ( )
inline

Definition at line 173 of file blobs.h.

173 {
174 flags[0] = false;
175 }

◆ SegmentArea()

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

Definition at line 145 of file blobs.h.

145 {
146 int area = 0;
147 const EDGEPT* pt = this->next;
148 do {
149 TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
150 area += origin_vec.cross(pt->vec);
151 pt = pt->next;
152 } while (pt != end && pt != this);
153 return area;
154 }
Definition: blobs.h:51
int16_t x
Definition: blobs.h:93
int16_t y
Definition: blobs.h:94
Definition: blobs.h:99

◆ SegmentBox()

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

Definition at line 131 of file blobs.h.

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

◆ ShortNonCircularSegment()

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

Definition at line 158 of file blobs.h.

158 {
159 int count = 0;
160 const EDGEPT* pt = this;
161 do {
162 if (pt == end) return true;
163 pt = pt->next;
164 ++count;
165 } while (pt != this && count <= min_points);
166 return false;
167 }
int count(LIST var_list)
Definition: oldlist.cpp:95

◆ WeightedDistance()

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

Definition at line 122 of file blobs.h.

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

Member Data Documentation

◆ flags

char EDGEPT::flags[EDGEPTFLAGS]

Definition at line 191 of file blobs.h.

◆ next

EDGEPT* EDGEPT::next

Definition at line 192 of file blobs.h.

◆ pos

TPOINT EDGEPT::pos

Definition at line 186 of file blobs.h.

◆ prev

EDGEPT* EDGEPT::prev

Definition at line 193 of file blobs.h.

◆ src_outline

C_OUTLINE* EDGEPT::src_outline

Definition at line 194 of file blobs.h.

◆ start_step

int EDGEPT::start_step

Definition at line 196 of file blobs.h.

◆ step_count

int EDGEPT::step_count

Definition at line 197 of file blobs.h.

◆ vec

VECTOR EDGEPT::vec

Definition at line 187 of file blobs.h.


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