Tesseract  3.02
tesseract-ocr/ccstruct/split.h File Reference
#include "blobs.h"
#include "oldlist.h"

Go to the source code of this file.

Classes

struct  split_record

Defines

#define clone_split(dest, source)

Typedefs

typedef struct split_record SPLIT
typedef LIST SPLITS

Functions

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

Define Documentation

#define clone_split (   dest,
  source 
)
Value:
if (source)                                                  \
        (dest) = new_split ((source)->point1, (source)->point2);  \
else                                                         \
        (dest) = (SPLIT*) NULL                                    \

Definition at line 61 of file split.h.


Typedef Documentation

typedef struct split_record SPLIT
typedef LIST SPLITS

Definition at line 43 of file split.h.


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);
}
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

"Display splits"

Definition at line 39 of file split.cpp.