tesseract  4.0.0-1-g2a2b
TPOINT Struct Reference

#include <blobs.h>

Public Member Functions

 TPOINT ()
 
 TPOINT (int16_t vx, int16_t vy)
 
 TPOINT (const ICOORD &ic)
 
void operator+= (const TPOINT &other)
 
void operator/= (int divisor)
 
bool operator== (const TPOINT &other) const
 

Static Public Member Functions

static bool IsCrossed (const TPOINT &a0, const TPOINT &a1, const TPOINT &b0, const TPOINT &b1)
 

Public Attributes

int16_t x
 
int16_t y
 

Detailed Description

Definition at line 57 of file blobs.h.

Constructor & Destructor Documentation

◆ TPOINT() [1/3]

TPOINT::TPOINT ( )
inline

Definition at line 58 of file blobs.h.

58 : x(0), y(0) {}
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

◆ TPOINT() [2/3]

TPOINT::TPOINT ( int16_t  vx,
int16_t  vy 
)
inline

Definition at line 59 of file blobs.h.

59 : x(vx), y(vy) {}
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

◆ TPOINT() [3/3]

TPOINT::TPOINT ( const ICOORD ic)
inline

Definition at line 60 of file blobs.h.

60 : x(ic.x()), y(ic.y()) {}
int16_t y() const
access_function
Definition: points.h:57
int16_t x() const
access function
Definition: points.h:53
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

Member Function Documentation

◆ IsCrossed()

bool TPOINT::IsCrossed ( const TPOINT a0,
const TPOINT a1,
const TPOINT b0,
const TPOINT b1 
)
static

Definition at line 73 of file blobs.cpp.

74  {
75  int b0a1xb0b1, b0b1xb0a0;
76  int a1b1xa1a0, a1a0xa1b0;
77 
78  TPOINT b0a1, b0a0, a1b1, b0b1, a1a0;
79 
80  b0a1.x = a1.x - b0.x;
81  b0a0.x = a0.x - b0.x;
82  a1b1.x = b1.x - a1.x;
83  b0b1.x = b1.x - b0.x;
84  a1a0.x = a0.x - a1.x;
85  b0a1.y = a1.y - b0.y;
86  b0a0.y = a0.y - b0.y;
87  a1b1.y = b1.y - a1.y;
88  b0b1.y = b1.y - b0.y;
89  a1a0.y = a0.y - a1.y;
90 
91  b0a1xb0b1 = CROSS(b0a1, b0b1);
92  b0b1xb0a0 = CROSS(b0b1, b0a0);
93  a1b1xa1a0 = CROSS(a1b1, a1a0);
94  // For clarity, we want CROSS(a1a0,a1b0) here but we have b0a1 instead of a1b0
95  // so use -CROSS(a1b0,b0a1) instead, which is the same.
96  a1a0xa1b0 = -CROSS(a1a0, b0a1);
97 
98  return ((b0a1xb0b1 > 0 && b0b1xb0a0 > 0) ||
99  (b0a1xb0b1 < 0 && b0b1xb0a0 < 0)) &&
100  ((a1b1xa1a0 > 0 && a1a0xa1b0 > 0) || (a1b1xa1a0 < 0 && a1a0xa1b0 < 0));
101 }
#define CROSS(a, b)
Definition: vecfuncs.h:52
int16_t x
Definition: blobs.h:78
Definition: blobs.h:57
int16_t y
Definition: blobs.h:79

◆ operator+=()

void TPOINT::operator+= ( const TPOINT other)
inline

Definition at line 62 of file blobs.h.

62  {
63  x += other.x;
64  y += other.y;
65  }
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

◆ operator/=()

void TPOINT::operator/= ( int  divisor)
inline

Definition at line 66 of file blobs.h.

66  {
67  x /= divisor;
68  y /= divisor;
69  }
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

◆ operator==()

bool TPOINT::operator== ( const TPOINT other) const
inline

Definition at line 70 of file blobs.h.

70  {
71  return x == other.x && y == other.y;
72  }
int16_t x
Definition: blobs.h:78
int16_t y
Definition: blobs.h:79

Member Data Documentation

◆ x

int16_t TPOINT::x

Definition at line 78 of file blobs.h.

◆ y

int16_t TPOINT::y

Definition at line 79 of file blobs.h.


The documentation for this struct was generated from the following files: