tesseract  4.0.0-1-g2a2b
vecfuncs.h File Reference
#include <cmath>

Go to the source code of this file.

Macros

#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)
 

Macro Definition Documentation

◆ CROSS

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

Definition at line 52 of file vecfuncs.h.

◆ LENGTH

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

Definition at line 70 of file vecfuncs.h.

◆ point_diff

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

Definition at line 42 of file vecfuncs.h.

◆ SCALAR

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

Definition at line 61 of file vecfuncs.h.

Function Documentation

◆ direction()

int direction ( EDGEPT point)

direction to return

prev point
next point

Definition at line 43 of file vecfuncs.cpp.

43  {
44  int dir;
45  EDGEPT *prev;
46  EDGEPT *next;
48  dir = 0;
49  prev = point->prev;
50  next = point->next;
51 
52  if (((prev->pos.x <= point->pos.x) &&
53  (point->pos.x < next->pos.x)) ||
54  ((prev->pos.x < point->pos.x) && (point->pos.x <= next->pos.x)))
55  dir = 1;
56 
57  if (((prev->pos.x >= point->pos.x) &&
58  (point->pos.x > next->pos.x)) ||
59  ((prev->pos.x > point->pos.x) && (point->pos.x >= next->pos.x)))
60  dir = -1;
61 
62  return dir;
63 }
TPOINT pos
Definition: blobs.h:170
Definition: blobs.h:83
EDGEPT * prev
Definition: blobs.h:177
int16_t x
Definition: blobs.h:78
EDGEPT * next
Definition: blobs.h:176