# ccstruct/vecfuncs.h File Reference

#include "tessclas.h"
#include <math.h>

## Defines

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

## Define Documentation

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

cross product

Definition at line 41 of file vecfuncs.h.

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

length of vector

Definition at line 53 of file vecfuncs.h.

 #define point_diff ( p, p1, p2 )

Value:

((p).x = (p1).x - (p2).x,        \
(p).y = (p1).y - (p2).y,        \
(p))
Return the difference from point (p1) to point (p2). Put the value into point (p).

Definition at line 33 of file vecfuncs.h.

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

scalar vector product

Definition at line 47 of file vecfuncs.h.

Referenced by angle_change().

## Function Documentation

 int direction ( EDGEPT * point )

Show if the line is going in the positive or negative X direction.

direction to return

prev point

next point

Definition at line 34 of file vecfuncs.cpp.

References edgeptstruct::next, edgeptstruct::pos, edgeptstruct::prev, and TPOINT::x.

Referenced by add_new_edge(), new_max_point(), new_min_point(), print_dawg_node(), and prioritize_points().

00034                              {
00035   int dir;
00036   EDGEPT *prev;
00037   EDGEPT *next;
00039   dir = 0;
00040   prev = point->prev;
00041   next = point->next;
00042
00043   if (((prev->pos.x <= point->pos.x) &&
00044     (point->pos.x < next->pos.x)) ||
00045     ((prev->pos.x < point->pos.x) && (point->pos.x <= next->pos.x)))
00046     dir = 1;
00047
00048   if (((prev->pos.x >= point->pos.x) &&
00049     (point->pos.x > next->pos.x)) ||
00050     ((prev->pos.x > point->pos.x) && (point->pos.x >= next->pos.x)))
00051     dir = -1;
00052
00053   return dir;
00054 }

Generated on Wed Feb 28 19:49:16 2007 for Tesseract by  1.5.1