tesseract v5.3.3.20231005
outlines.h File Reference
#include <cmath>
#include "blobs.h"
#include "params.h"
#include "wordrec.h"

Go to the source code of this file.

Macros

#define LARGE_DISTANCE   100000 /* Used for closest dist */
 
#define MIN_BLOB_SIZE   10 /* Big units */
 
#define MAX_ASPECT_RATIO   2.5 /* Widest character */
 
#define same_point(p1, p2)    ((abs(p1.x - p2.x) < chop_same_distance) && (abs(p1.y - p2.y) < chop_same_distance))
 
#define dist_square(p1, p2)   ((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y))
 
#define closest(test_p, p1, p2)
 
#define edgept_dist(p1, p2)   (dist_square((p1)->pos, (p2)->pos))
 
#define is_exterior_point(edge, point)
 
#define is_equal(p1, p2)   (((p1).x == (p2).x) && ((p1).y == (p2).y))
 
#define is_on_line(p, p0, p1)    (within_range((p).x, (p0).x, (p1).x) && within_range((p).y, (p0).y, (p1).y))
 
#define within_range(x, x0, x1)   (((x0 <= x) && (x <= x1)) || ((x1 <= x) && (x <= x0)))
 

Macro Definition Documentation

◆ closest

#define closest (   test_p,
  p1,
  p2 
)
Value:
(p1 ? (p2 ? ((dist_square(test_p->pos, p1->pos) < dist_square(test_p->pos, p2->pos)) ? p1 : p2) \
: p1) \
: p2)
#define dist_square(p1, p2)
Definition: outlines.h:54

Definition at line 63 of file outlines.h.

◆ dist_square

#define dist_square (   p1,
  p2 
)    ((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y))

Definition at line 54 of file outlines.h.

◆ edgept_dist

#define edgept_dist (   p1,
  p2 
)    (dist_square((p1)->pos, (p2)->pos))

Definition at line 74 of file outlines.h.

◆ is_equal

#define is_equal (   p1,
  p2 
)    (((p1).x == (p2).x) && ((p1).y == (p2).y))

Definition at line 93 of file outlines.h.

◆ is_exterior_point

#define is_exterior_point (   edge,
  point 
)
Value:
(same_point(edge->prev->pos, point->pos) || same_point(edge->next->pos, point->pos) || \
(angle_change(edge->prev, edge, edge->next) - angle_change(edge->prev, edge, point) > 20))
#define same_point(p1, p2)
Definition: outlines.h:44

Definition at line 83 of file outlines.h.

◆ is_on_line

#define is_on_line (   p,
  p0,
  p1 
)     (within_range((p).x, (p0).x, (p1).x) && within_range((p).y, (p0).y, (p1).y))

Definition at line 103 of file outlines.h.

◆ LARGE_DISTANCE

#define LARGE_DISTANCE   100000 /* Used for closest dist */

Definition at line 31 of file outlines.h.

◆ MAX_ASPECT_RATIO

#define MAX_ASPECT_RATIO   2.5 /* Widest character */

Definition at line 33 of file outlines.h.

◆ MIN_BLOB_SIZE

#define MIN_BLOB_SIZE   10 /* Big units */

Definition at line 32 of file outlines.h.

◆ same_point

#define same_point (   p1,
  p2 
)     ((abs(p1.x - p2.x) < chop_same_distance) && (abs(p1.y - p2.y) < chop_same_distance))

Definition at line 44 of file outlines.h.

◆ within_range

#define within_range (   x,
  x0,
  x1 
)    (((x0 <= x) && (x <= x1)) || ((x1 <= x) && (x <= x0)))

Definition at line 113 of file outlines.h.