Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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)
 
EDGEPTmake_edgept (int x, int y, EDGEPT *next, EDGEPT *prev)
 
void remove_edgept (EDGEPT *point)
 
SPLITnew_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.

53  {
54  if (split) {
55  free_split(split);
56  }
57 }
EDGEPT* make_edgept ( int  x,
int  y,
EDGEPT next,
EDGEPT prev 
)

Definition at line 65 of file split.cpp.

65  {
66  EDGEPT *this_edgept;
67  /* Create point */
68  this_edgept = new EDGEPT;
69  this_edgept->pos.x = x;
70  this_edgept->pos.y = y;
71  /* Hook it up */
72  this_edgept->next = next;
73  this_edgept->prev = prev;
74  prev->next = this_edgept;
75  next->prev = this_edgept;
76  /* Set up vec entries */
77  this_edgept->vec.x = this_edgept->next->pos.x - x;
78  this_edgept->vec.y = this_edgept->next->pos.y - y;
79  this_edgept->prev->vec.x = x - this_edgept->prev->pos.x;
80  this_edgept->prev->vec.y = y - this_edgept->prev->pos.y;
81 
82  return (this_edgept);
83 }
EDGEPT * next
Definition: blobs.h:106
EDGEPT * prev
Definition: blobs.h:107
VECTOR vec
Definition: blobs.h:101
inT16 y
Definition: blobs.h:68
inT16 x
Definition: blobs.h:67
Definition: blobs.h:72
TPOINT pos
Definition: blobs.h:100
makestructure ( newsplit  ,
free_split  ,
SPLIT   
)
SPLIT* new_split ( EDGEPT point1,
EDGEPT point2 
)

Definition at line 106 of file split.cpp.

106  {
107  SPLIT *s;
108  s = (SPLIT *) newsplit ();
109  s->point1 = point1;
110  s->point2 = point2;
111  return (s);
112 }
EDGEPT * point1
Definition: split.h:39
EDGEPT * point2
Definition: split.h:40
void print_split ( SPLIT split)

Definition at line 121 of file split.cpp.

121  {
122  if (split) {
123  cprintf ("(%d,%d)--(%d,%d)",
124  split->point1->pos.x, split->point1->pos.y,
125  split->point2->pos.x, split->point2->pos.y);
126  }
127 }
inT16 y
Definition: blobs.h:68
inT16 x
Definition: blobs.h:67
EDGEPT * point1
Definition: split.h:39
TPOINT pos
Definition: blobs.h:100
EDGEPT * point2
Definition: split.h:40
void cprintf(const char *format,...)
Definition: callcpp.cpp:41
void remove_edgept ( EDGEPT point)

Definition at line 90 of file split.cpp.

90  {
91  EDGEPT *prev = point->prev;
92  EDGEPT *next = point->next;
93  prev->next = next;
94  next->prev = prev;
95  prev->vec.x = next->pos.x - prev->pos.x;
96  prev->vec.y = next->pos.y - prev->pos.y;
97  delete point;
98 }
EDGEPT * next
Definition: blobs.h:106
EDGEPT * prev
Definition: blobs.h:107
VECTOR vec
Definition: blobs.h:101
inT16 y
Definition: blobs.h:68
inT16 x
Definition: blobs.h:67
Definition: blobs.h:72
TPOINT pos
Definition: blobs.h:100
void split_outline ( EDGEPT join_point1,
EDGEPT join_point2 
)

Definition at line 136 of file split.cpp.

136  {
137  EDGEPT *join_point1a;
138  EDGEPT *temp2;
139  EDGEPT *temp1;
140 
141  assert (join_point1 != join_point2);
142 
143  temp2 = join_point2->next;
144  temp1 = join_point1->next;
145  /* Create two new points */
146  join_point1a = make_edgept (join_point1->pos.x,
147  join_point1->pos.y, temp1, join_point2);
148 
149  make_edgept (join_point2->pos.x, join_point2->pos.y, temp2, join_point1);
150 }
EDGEPT * next
Definition: blobs.h:106
inT16 y
Definition: blobs.h:68
EDGEPT * make_edgept(int x, int y, EDGEPT *next, EDGEPT *prev)
Definition: split.cpp:65
inT16 x
Definition: blobs.h:67
Definition: blobs.h:72
TPOINT pos
Definition: blobs.h:100
void unsplit_outlines ( EDGEPT p1,
EDGEPT p2 
)

Definition at line 158 of file split.cpp.

158  {
159  EDGEPT *tmp1 = p1->next;
160  EDGEPT *tmp2 = p2->next;
161 
162  assert (p1 != p2);
163 
164  tmp1->next->prev = p2;
165  tmp2->next->prev = p1;
166 
167  p1->next = tmp2->next;
168  p2->next = tmp1->next;
169 
170  delete tmp1;
171  delete tmp2;
172 
173  p1->vec.x = p1->next->pos.x - p1->pos.x;
174  p1->vec.y = p1->next->pos.y - p1->pos.y;
175 
176  p2->vec.x = p2->next->pos.x - p2->pos.x;
177  p2->vec.y = p2->next->pos.y - p2->pos.y;
178 }
EDGEPT * next
Definition: blobs.h:106
EDGEPT * prev
Definition: blobs.h:107
VECTOR vec
Definition: blobs.h:101
inT16 y
Definition: blobs.h:68
inT16 x
Definition: blobs.h:67
Definition: blobs.h:72
TPOINT pos
Definition: blobs.h:100

Variable Documentation

bool wordrec_display_splits = 0

"Display splits"

Definition at line 39 of file split.cpp.