#include "tessclas.h"
#include <math.h>
Go to the source code of this file.
#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))
Definition at line 33 of file vecfuncs.h.
#define SCALAR | ( | a, | |||
b | ) | ((a).x * (b).x + (a).y * (b).y) |
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 }