Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes
TESSLINE Struct Reference

`#include <blobs.h>`

List of all members.

## Public Member Functions

| TESSLINE ()
| TESSLINE (const TESSLINE &src)
| ~TESSLINE ()
TESSLINE & | operator= (const TESSLINE &src)
void | CopyFrom (const TESSLINE &src)
void | Clear ()
void | Normalize (const DENORM &denorm)
void | Rotate (const FCOORD rotation)
void | Move (const ICOORD vec)
void | Scale (float factor)
void | SetupFromPos ()
void | ComputeBoundingBox ()
void | MinMaxCrossProduct (const TPOINT vec, int *min_xp, int *max_xp) const
TBOX | bounding_box () const
bool | Contains (const TPOINT &pt)
void | plot (ScrollView *window, ScrollView::Color color, ScrollView::Color child_color)
int | BBArea () const

## Static Public Member Functions

static TESSLINE * | BuildFromOutlineList (EDGEPT *outline)

## Public Attributes

TPOINT | topleft
TPOINT | botright
TPOINT | start
bool | is_hole
EDGEPT * | loop
TESSLINE * | next

## Detailed Description

Definition at line 113 of file blobs.h.

## Constructor & Destructor Documentation

TESSLINE::TESSLINE | ( |  | ) |

inline

Definition at line 114 of file blobs.h.

: is_hole(false), loop(NULL), next(NULL) {}

TESSLINE::TESSLINE | ( | const TESSLINE & | src | ) |

inline

Definition at line 115 of file blobs.h.

: loop(NULL), next(NULL) {
CopyFrom(src);
}

TESSLINE::~TESSLINE | ( |  | ) |

inline

Definition at line 118 of file blobs.h.

{
Clear();
}

## Member Function Documentation

int TESSLINE::BBArea | ( |  | ) | const

inline

Definition at line 162 of file blobs.h.

{
return (botright.x - topleft.x) * (topleft.y - botright.y);
}

TBOX TESSLINE::bounding_box | ( |  | ) | const

Definition at line 223 of file blobs.cpp.

{
return TBOX(topleft.x, botright.y, botright.x, topleft.y);
}

TESSLINE * TESSLINE::BuildFromOutlineList | ( | EDGEPT * | outline | ) |

static

Definition at line 68 of file blobs.cpp.

{
TESSLINE* result = new TESSLINE;
result->loop = outline;
result->SetupFromPos();
return result;
}

void TESSLINE::Clear | ( |  | ) |

Definition at line 103 of file blobs.cpp.

{
if (loop == NULL)
return;
EDGEPT* this_edge = loop;
do {
EDGEPT* next_edge = this_edge->next;
delete this_edge;
this_edge = next_edge;
} while (this_edge != loop);
loop = NULL;
}

void TESSLINE::ComputeBoundingBox | ( |  | ) |

Definition at line 175 of file blobs.cpp.

{
int minx = MAX_INT32;
int miny = MAX_INT32;
int maxx = -MAX_INT32;
int maxy = -MAX_INT32;
// Find boundaries.
start = loop->pos;
EDGEPT* this_edge = loop;
do {
if (!this_edge->IsHidden() || !this_edge->prev->IsHidden()) {
if (this_edge->pos.x < minx)
minx = this_edge->pos.x;
if (this_edge->pos.y < miny)
miny = this_edge->pos.y;
if (this_edge->pos.x > maxx)
maxx = this_edge->pos.x;
if (this_edge->pos.y > maxy)
maxy = this_edge->pos.y;
}
this_edge = this_edge->next;
} while (this_edge != loop);
// Reset bounds.
topleft.x = minx;
topleft.y = maxy;
botright.x = maxx;
botright.y = miny;
}

bool TESSLINE::Contains | ( | const TPOINT & | pt | ) |

inline

Definition at line 152 of file blobs.h.

{
return topleft.x <= pt.x && pt.x <= botright.x &&
botright.y <= pt.y && pt.y <= topleft.y;
}

void TESSLINE::CopyFrom | ( | const TESSLINE & | src | ) |

Definition at line 76 of file blobs.cpp.

{
Clear();
topleft = src.topleft;
botright = src.botright;
start = src.start;
is_hole = src.is_hole;
if (src.loop != NULL) {
EDGEPT* prevpt = NULL;
EDGEPT* newpt = NULL;
EDGEPT* srcpt = src.loop;
do {
newpt = new EDGEPT(*srcpt);
if (prevpt == NULL) {
loop = newpt;
} else {
newpt->prev = prevpt;
prevpt->next = newpt;
}
prevpt = newpt;
srcpt = srcpt->next;
} while (srcpt != src.loop);
loop->prev = newpt;
newpt->next = loop;
}
}

void TESSLINE::MinMaxCrossProduct | ( | const TPOINT | vec,
|  | int * | min_xp,
|  | int * | max_xp
| ) |  | const

Definition at line 209 of file blobs.cpp.

{
*min_xp = MAX_INT32;
*max_xp = MIN_INT32;
EDGEPT* this_edge = loop;
do {
if (!this_edge->IsHidden() || !this_edge->prev->IsHidden()) {
int product = CROSS(this_edge->pos, vec);
UpdateRange(product, min_xp, max_xp);
}
this_edge = this_edge->next;
} while (this_edge != loop);
}

void TESSLINE::Move | ( | const ICOORD | vec | ) |

Definition at line 141 of file blobs.cpp.

{
EDGEPT* pt = loop;
do {
pt->pos.x += vec.x();
pt->pos.y += vec.y();
pt = pt->next;
} while (pt != loop);
SetupFromPos();
}

void TESSLINE::Normalize | ( | const DENORM & | denorm | ) |

Definition at line 117 of file blobs.cpp.

{
EDGEPT* pt = loop;
do {
denorm.LocalNormTransform(pt->pos, &pt->pos);
pt = pt->next;
} while (pt != loop);
SetupFromPos();
}

TESSLINE& TESSLINE::operator= | ( | const TESSLINE & | src | ) |

inline

Definition at line 121 of file blobs.h.

{
CopyFrom(src);
return *this;
}

void TESSLINE::plot | ( | ScrollView * | window,
|  | ScrollView::Color | color,
|  | ScrollView::Color | child_color
| ) |  |

Definition at line 228 of file blobs.cpp.

{
if (is_hole)
window->Pen(child_color);
else
window->Pen(color);
window->SetCursor(start.x, start.y);
EDGEPT* pt = loop;
do {
bool prev_hidden = pt->IsHidden();
pt = pt->next;
if (prev_hidden)
window->SetCursor(pt->pos.x, pt->pos.y);
else
window->DrawTo(pt->pos.x, pt->pos.y);
} while (pt != loop);
}

void TESSLINE::Rotate | ( | const FCOORD | rotation | ) |

Definition at line 127 of file blobs.cpp.

{
EDGEPT* pt = loop;
do {
int tmp = static_cast<int>(floor(pt->pos.x * rot.x() -
pt->pos.y * rot.y() + 0.5));
pt->pos.y = static_cast<int>(floor(pt->pos.y * rot.x() +
pt->pos.x * rot.y() + 0.5));
pt->pos.x = tmp;
pt = pt->next;
} while (pt != loop);
SetupFromPos();
}

void TESSLINE::Scale | ( | float | factor | ) |

Definition at line 152 of file blobs.cpp.

{
EDGEPT* pt = loop;
do {
pt->pos.x = static_cast<int>(floor(pt->pos.x * factor + 0.5));
pt->pos.y = static_cast<int>(floor(pt->pos.y * factor + 0.5));
pt = pt->next;
} while (pt != loop);
SetupFromPos();
}

void TESSLINE::SetupFromPos | ( |  | ) |

Definition at line 163 of file blobs.cpp.

{
EDGEPT* pt = loop;
do {
pt->vec.x = pt->next->pos.x - pt->pos.x;
pt->vec.y = pt->next->pos.y - pt->pos.y;
pt = pt->next;
} while (pt != loop);
start = pt->pos;
ComputeBoundingBox();
}

## Member Data Documentation

TPOINT TESSLINE::botright

Definition at line 167 of file blobs.h.

bool TESSLINE::is_hole

Definition at line 169 of file blobs.h.

EDGEPT* TESSLINE::loop

Definition at line 170 of file blobs.h.

TESSLINE* TESSLINE::next

Definition at line 171 of file blobs.h.

TPOINT TESSLINE::start

Definition at line 168 of file blobs.h.

TPOINT TESSLINE::topleft

Definition at line 166 of file blobs.h.

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

- /mnt/data/src/tesseract-ocr/ccstruct/blobs.h
- /mnt/data/src/tesseract-ocr/ccstruct/blobs.cpp