Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
DIR128 Class Reference

`#include <mod128.h>`

List of all members.

## Public Member Functions

| DIR128 ()
| DIR128 (inT16 value)
| DIR128 (const FCOORD fc)
DIR128 & | operator= (inT16 value)
inT8 | operator- (const DIR128 &minus) const
DIR128 | operator+ (const DIR128 &add) const
DIR128 & | operator+= (const DIR128 &add)
inT8 | get_dir () const
ICOORD | vector () const

## Detailed Description

Definition at line 29 of file mod128.h.

## Constructor & Destructor Documentation

DIR128::DIR128 | ( |  | ) |

inline

Definition at line 32 of file mod128.h.

{
} //empty constructor

DIR128::DIR128 | ( | inT16 | value | ) |

inline

Definition at line 35 of file mod128.h.

{ //value to assign
value %= MODULUS; //modulo arithmetic
if (value < 0)
value += MODULUS; //done properly
dir = (inT8) value;
}

DIR128::DIR128 | ( | const FCOORD | fc | ) |

Definition at line 66 of file mod128.cpp.

{
int high, low, current; //binary search
low = 0;
if (fc.y () == 0) {
if (fc.x () >= 0)
dir = 0;
else
dir = MODULUS / 2;
return;
}
high = MODULUS;
do {
current = (high + low) / 2;
if (dirtab[current] * fc >= 0)
low = current;
else
high = current;
}
while (high - low > 1);
dir = low;
}

## Member Function Documentation

inT8 DIR128::get_dir | ( |  | ) | const

inline

Definition at line 77 of file mod128.h.

{ //access function
return dir;
}

DIR128 DIR128::operator+ | ( | const DIR128 & | add | ) | const

inline

Definition at line 64 of file mod128.h.

{
DIR128 result; //sum
result = dir + add.dir; //let = do the work
return result;
}

DIR128& DIR128::operator+= | ( | const DIR128 & | add | ) |

inline

Definition at line 72 of file mod128.h.

{
*this = dir + add.dir; //let = do the work
return *this;
}

inT8 DIR128::operator- | ( | const DIR128 & | minus | ) | const

inline

Definition at line 52 of file mod128.h.

{
//result
inT16 result = dir - minus.dir;
if (result > MODULUS / 2)
result -= MODULUS; //get in range
else if (result < -MODULUS / 2)
result += MODULUS;
return (inT8) result;
}

DIR128& DIR128::operator= | ( | inT16 | value | ) |

inline

Definition at line 44 of file mod128.h.

{ //value to assign
value %= MODULUS; //modulo arithmetic
if (value < 0)
value += MODULUS; //done properly
dir = (inT8) value;
return *this;
}

ICOORD DIR128::vector | ( |  | ) | const

Definition at line 98 of file mod128.cpp.

{ //convert to vector
return dirtab[dir]; //easy really
}

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

- /mnt/data/src/tesseract-ocr/ccstruct/mod128.h
- /mnt/data/src/tesseract-ocr/ccstruct/mod128.cpp