Tesseract  3.02
tesseract-ocr/ccstruct/vecfuncs.h File Reference
#include <math.h>
#include "blobs.h"

Go to the source code of this file.

Defines

#define point_diff(p, p1, p2)
#define CROSS(a, b)   ((a).x * (b).y - (a).y * (b).x)
#define SCALAR(a, b)   ((a).x * (b).x + (a).y * (b).y)
#define LENGTH(a)   ((a).x * (a).x + (a).y * (a).y)

Functions

int direction (EDGEPT *point)

Define Documentation

#define CROSS (   a,
 
)    ((a).x * (b).y - (a).y * (b).x)

Definition at line 54 of file vecfuncs.h.

#define LENGTH (   a)    ((a).x * (a).x + (a).y * (a).y)

Definition at line 72 of file vecfuncs.h.

#define point_diff (   p,
  p1,
  p2 
)
Value:
((p).x = (p1).x - (p2).x,        \
        (p).y = (p1).y - (p2).y,        \
        (p))

Definition at line 43 of file vecfuncs.h.

#define SCALAR (   a,
 
)    ((a).x * (b).x + (a).y * (b).y)

Definition at line 63 of file vecfuncs.h.


Function Documentation

int direction ( EDGEPT point)

direction to return

prev point

next point

Definition at line 43 of file vecfuncs.cpp.

                             {
  int dir;                       
  EDGEPT *prev;                  
  EDGEPT *next;                  
  dir = 0;
  prev = point->prev;
  next = point->next;

  if (((prev->pos.x <= point->pos.x) &&
    (point->pos.x < next->pos.x)) ||
    ((prev->pos.x < point->pos.x) && (point->pos.x <= next->pos.x)))
    dir = 1;

  if (((prev->pos.x >= point->pos.x) &&
    (point->pos.x > next->pos.x)) ||
    ((prev->pos.x > point->pos.x) && (point->pos.x >= next->pos.x)))
    dir = -1;

  return dir;
}