tesseract 3.04.01

TPOINT Struct Reference

#include <blobs.h>

List of all members.

Public Member Functions

 TPOINT ()
 TPOINT (inT16 vx, inT16 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 x
inT16 y

Detailed Description

Definition at line 50 of file blobs.h.


Constructor & Destructor Documentation

TPOINT::TPOINT ( ) [inline]

Definition at line 51 of file blobs.h.

: x(0), y(0) {}
TPOINT::TPOINT ( inT16  vx,
inT16  vy 
) [inline]

Definition at line 52 of file blobs.h.

: x(vx), y(vy) {}
TPOINT::TPOINT ( const ICOORD ic) [inline]

Definition at line 53 of file blobs.h.

: x(ic.x()), y(ic.y()) {}

Member Function Documentation

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

Definition at line 73 of file blobs.cpp.

                                         {
  int b0a1xb0b1, b0b1xb0a0;
  int a1b1xa1a0, a1a0xa1b0;

  TPOINT b0a1, b0a0, a1b1, b0b1, a1a0;

  b0a1.x = a1.x - b0.x;
  b0a0.x = a0.x - b0.x;
  a1b1.x = b1.x - a1.x;
  b0b1.x = b1.x - b0.x;
  a1a0.x = a0.x - a1.x;
  b0a1.y = a1.y - b0.y;
  b0a0.y = a0.y - b0.y;
  a1b1.y = b1.y - a1.y;
  b0b1.y = b1.y - b0.y;
  a1a0.y = a0.y - a1.y;

  b0a1xb0b1 = CROSS(b0a1, b0b1);
  b0b1xb0a0 = CROSS(b0b1, b0a0);
  a1b1xa1a0 = CROSS(a1b1, a1a0);
  // For clarity, we want CROSS(a1a0,a1b0) here but we have b0a1 instead of a1b0
  // so use -CROSS(a1b0,b0a1) instead, which is the same.
  a1a0xa1b0 = -CROSS(a1a0, b0a1);

  return ((b0a1xb0b1 > 0 && b0b1xb0a0 > 0) ||
          (b0a1xb0b1 < 0 && b0b1xb0a0 < 0)) &&
         ((a1b1xa1a0 > 0 && a1a0xa1b0 > 0) || (a1b1xa1a0 < 0 && a1a0xa1b0 < 0));
}
void TPOINT::operator+= ( const TPOINT other) [inline]

Definition at line 55 of file blobs.h.

                                       {
    x += other.x;
    y += other.y;
  }
void TPOINT::operator/= ( int  divisor) [inline]

Definition at line 59 of file blobs.h.

                               {
    x /= divisor;
    y /= divisor;
  }
bool TPOINT::operator== ( const TPOINT other) const [inline]

Definition at line 63 of file blobs.h.

                                             {
    return x == other.x && y == other.y;
  }

Member Data Documentation

Definition at line 71 of file blobs.h.

Definition at line 72 of file blobs.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines