Tesseract 3.02

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
split.cpp File Reference
`#include "split.h"`
`#include "structures.h"`
`#include "callcpp.h"`

Go to the source code of this file.

## Functions
| makestructure (newsplit, free_split, SPLIT)
void | delete_split (SPLIT *split)
EDGEPT * | make_edgept (int x, int y, EDGEPT *next, EDGEPT *prev)
void | remove_edgept (EDGEPT *point)
SPLIT * | new_split (EDGEPT *point1, EDGEPT *point2)
void | print_split (SPLIT *split)
void | split_outline (EDGEPT *join_point1, EDGEPT *join_point2)
void | unsplit_outlines (EDGEPT *p1, EDGEPT *p2)

## Variables
bool | wordrec_display_splits = 0

## Function Documentation

void delete_split | ( | SPLIT * | split | ) |

Definition at line 53 of file split.cpp.

{
if (split) {
free_split(split);
}
}

EDGEPT* make_edgept | ( | int | x,
|  | int | y,
|  | EDGEPT * | next,
|  | EDGEPT * | prev
| ) |  |

Definition at line 65 of file split.cpp.

{
EDGEPT *this_edgept;
/* Create point */
this_edgept = new EDGEPT;
this_edgept->pos.x = x;
this_edgept->pos.y = y;
/* Hook it up */
this_edgept->next = next;
this_edgept->prev = prev;
prev->next = this_edgept;
next->prev = this_edgept;
/* Set up vec entries */
this_edgept->vec.x = this_edgept->next->pos.x - x;
this_edgept->vec.y = this_edgept->next->pos.y - y;
this_edgept->prev->vec.x = x - this_edgept->prev->pos.x;
this_edgept->prev->vec.y = y - this_edgept->prev->pos.y;
return (this_edgept);
}

makestructure | ( | newsplit | ,
|  | free_split | ,
|  | SPLIT |
| ) |  |

SPLIT* new_split | ( | EDGEPT * | point1,
|  | EDGEPT * | point2
| ) |  |

Definition at line 106 of file split.cpp.

{
SPLIT *s;
s = (SPLIT *) newsplit ();
s->point1 = point1;
s->point2 = point2;
return (s);
}

void print_split | ( | SPLIT * | split | ) |

Definition at line 121 of file split.cpp.

{
if (split) {
cprintf ("(%d,%d)--(%d,%d)",
split->point1->pos.x, split->point1->pos.y,
split->point2->pos.x, split->point2->pos.y);
}
}

void remove_edgept | ( | EDGEPT * | point | ) |

Definition at line 90 of file split.cpp.

{
EDGEPT *prev = point->prev;
EDGEPT *next = point->next;
prev->next = next;
next->prev = prev;
prev->vec.x = next->pos.x - prev->pos.x;
prev->vec.y = next->pos.y - prev->pos.y;
delete point;
}

void split_outline | ( | EDGEPT * | join_point1,
|  | EDGEPT * | join_point2
| ) |  |

Definition at line 136 of file split.cpp.

{
EDGEPT *join_point1a;
EDGEPT *temp2;
EDGEPT *temp1;
assert (join_point1 != join_point2);
temp2 = join_point2->next;
temp1 = join_point1->next;
/* Create two new points */
join_point1a = make_edgept (join_point1->pos.x,
join_point1->pos.y, temp1, join_point2);
make_edgept (join_point2->pos.x, join_point2->pos.y, temp2, join_point1);
}

void unsplit_outlines | ( | EDGEPT * | p1,
|  | EDGEPT * | p2
| ) |  |

Definition at line 158 of file split.cpp.

{
EDGEPT *tmp1 = p1->next;
EDGEPT *tmp2 = p2->next;
assert (p1 != p2);
tmp1->next->prev = p2;
tmp2->next->prev = p1;
p1->next = tmp2->next;
p2->next = tmp1->next;
delete tmp1;
delete tmp2;
p1->vec.x = p1->next->pos.x - p1->pos.x;
p1->vec.y = p1->next->pos.y - p1->pos.y;
p2->vec.x = p2->next->pos.x - p2->pos.x;
p2->vec.y = p2->next->pos.y - p2->pos.y;
}

## Variable Documentation

bool wordrec_display_splits = 0

"Display splits"

Definition at line 39 of file split.cpp.