integer coordinate
More...
#include <points.h>
|
class | FCOORD |
|
ICOORD | operator! (const ICOORD &) |
| rotate 90 deg anti More...
|
|
ICOORD | operator- (const ICOORD &) |
| unary minus More...
|
|
ICOORD | operator+ (const ICOORD &, const ICOORD &) |
| add More...
|
|
ICOORD & | operator+= (ICOORD &, const ICOORD &) |
| add More...
|
|
ICOORD | operator- (const ICOORD &, const ICOORD &) |
| subtract More...
|
|
ICOORD & | operator-= (ICOORD &, const ICOORD &) |
| subtract More...
|
|
int32_t | operator% (const ICOORD &, const ICOORD &) |
| scalar product More...
|
|
int32_t | operator* (const ICOORD &, const ICOORD &) |
| cross product More...
|
|
ICOORD | operator* (const ICOORD &, TDimension) |
| multiply More...
|
|
ICOORD | operator* (TDimension, const ICOORD &) |
| multiply More...
|
|
ICOORD & | operator*= (ICOORD &, TDimension) |
| multiply More...
|
|
ICOORD | operator/ (const ICOORD &, TDimension) |
| divide More...
|
|
ICOORD & | operator/= (ICOORD &, TDimension) |
| divide More...
|
|
integer coordinate
Definition at line 36 of file points.h.
◆ ICOORD() [1/2]
tesseract::ICOORD::ICOORD |
( |
| ) |
|
|
inline |
empty constructor
Definition at line 41 of file points.h.
◆ ICOORD() [2/2]
constructor
- Parameters
-
Definition at line 47 of file points.h.
◆ ~ICOORD()
tesseract::ICOORD::~ICOORD |
( |
| ) |
|
|
default |
◆ angle()
float tesseract::ICOORD::angle |
( |
| ) |
const |
|
inline |
◆ DeSerialize() [1/2]
bool tesseract::ICOORD::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
Definition at line 79 of file points.cpp.
79 {
81 return false;
82 }
84 return false;
85 }
86 if (swap) {
89 }
90 return true;
91}
void ReverseN(void *ptr, int num_bytes)
bool DeSerialize(bool swap, FILE *fp, std::vector< T > &data)
◆ DeSerialize() [2/2]
bool tesseract::ICOORD::DeSerialize |
( |
TFile * |
f | ) |
|
◆ length()
float tesseract::ICOORD::length |
( |
| ) |
const |
|
inline |
find length
Definition at line 84 of file points.h.
84 {
86 }
float sqlength() const
find sq length
◆ operator!=()
test inequality
Definition at line 112 of file points.h.
112 {
113 return xcoord != other.xcoord ||
ycoord != other.ycoord;
114 }
◆ operator==()
bool tesseract::ICOORD::operator== |
( |
const ICOORD & |
other | ) |
const |
|
inline |
test equality
Definition at line 108 of file points.h.
108 {
109 return xcoord == other.xcoord &&
ycoord == other.ycoord;
110 }
◆ pt_to_pt_dist()
float tesseract::ICOORD::pt_to_pt_dist |
( |
const ICOORD & |
pt | ) |
const |
|
inline |
Distance between pts.
Definition at line 98 of file points.h.
98 {
100 }
float pt_to_pt_sqdist(const ICOORD &pt) const
sq dist between pts
◆ pt_to_pt_sqdist()
float tesseract::ICOORD::pt_to_pt_sqdist |
( |
const ICOORD & |
pt | ) |
const |
|
inline |
sq dist between pts
Definition at line 89 of file points.h.
89 {
91
92 gap.xcoord =
xcoord - pt.xcoord;
93 gap.ycoord =
ycoord - pt.ycoord;
94 return gap.sqlength();
95 }
ICOORD()
empty constructor
◆ rotate()
void tesseract::ICOORD::rotate |
( |
const FCOORD & |
vec | ) |
|
|
inline |
rotate
- Parameters
-
Definition at line 511 of file points.h.
◆ Serialize() [1/2]
bool tesseract::ICOORD::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 74 of file points.cpp.
74 {
76}
bool Serialize(FILE *fp, const std::vector< T > &data)
◆ Serialize() [2/2]
bool tesseract::ICOORD::Serialize |
( |
TFile * |
f | ) |
const |
◆ set_with_shrink()
void tesseract::ICOORD::set_with_shrink |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Set from the given x,y, shrinking the vector to fit if needed.
Definition at line 52 of file points.cpp.
52 {
53
54 int factor = 1;
55 int max_extent = std::max(abs(
x), abs(
y));
56 if (max_extent > INT16_MAX) {
57 factor = max_extent / INT16_MAX + 1;
58 }
61}
TDimension y() const
access_function
TDimension x() const
access function
◆ set_x()
rewrite function
Definition at line 67 of file points.h.
◆ set_y()
rewrite function
Definition at line 71 of file points.h.
◆ setup_render()
void tesseract::ICOORD::setup_render |
( |
ICOORD * |
major_step, |
|
|
ICOORD * |
minor_step, |
|
|
int * |
major, |
|
|
int * |
minor |
|
) |
| const |
Setup for iterating over the pixels in a vector by the well-known Bresenham rendering algorithm. Starting with major/2 in the accumulator, on each step move by major_step, and then add minor to the accumulator. When accumulator >= major subtract major and also move by minor_step.
Definition at line 99 of file points.cpp.
99 {
102 if (abs_x >= abs_y) {
103
104 major_step->xcoord = sign(
xcoord);
105 major_step->ycoord = 0;
106 minor_step->xcoord = 0;
107 minor_step->ycoord = sign(
ycoord);
108 *major = abs_x;
109 *minor = abs_y;
110 } else {
111
112 major_step->xcoord = 0;
113 major_step->ycoord = sign(
ycoord);
114 minor_step->xcoord = sign(
xcoord);
115 minor_step->ycoord = 0;
116 *major = abs_y;
117 *minor = abs_x;
118 }
119}
◆ sqlength()
float tesseract::ICOORD::sqlength |
( |
| ) |
const |
|
inline |
find sq length
Definition at line 79 of file points.h.
◆ x()
access function
Definition at line 58 of file points.h.
◆ y()
access_function
Definition at line 62 of file points.h.
◆ FCOORD
◆ operator!
rotate 90 deg anti
Definition at line 324 of file points.h.
326 {
328
329 result.xcoord = -src.ycoord;
330 result.ycoord = src.xcoord;
331 return result;
332}
◆ operator%
int32_t operator% |
( |
const ICOORD & |
op1, |
|
|
const ICOORD & |
op2 |
|
) |
| |
|
friend |
scalar product
Definition at line 416 of file points.h.
418 {
419 return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
420}
◆ operator* [1/3]
int32_t operator* |
( |
const ICOORD & |
op1, |
|
|
const ICOORD & |
op2 |
|
) |
| |
|
friend |
cross product
Definition at line 428 of file points.h.
430 {
431 return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
432}
◆ operator* [2/3]
multiply
Definition at line 440 of file points.h.
442 {
444
445 result.xcoord = op1.xcoord * scale;
446 result.ycoord = op1.ycoord * scale;
447 return result;
448}
◆ operator* [3/3]
multiply
Definition at line 450 of file points.h.
453 {
455
456 result.xcoord = op1.xcoord * scale;
457 result.ycoord = op1.ycoord * scale;
458 return result;
459}
◆ operator*=
multiply
Definition at line 467 of file points.h.
469 {
470 op1.xcoord *= scale;
471 op1.ycoord *= scale;
472 return op1;
473}
◆ operator+
add
Definition at line 356 of file points.h.
358 {
360
361 sum.xcoord = op1.xcoord + op2.xcoord;
362 sum.ycoord = op1.ycoord + op2.ycoord;
363 return sum;
364}
◆ operator+=
add
Definition at line 372 of file points.h.
374 {
375 op1.xcoord += op2.xcoord;
376 op1.ycoord += op2.ycoord;
377 return op1;
378}
◆ operator- [1/2]
unary minus
Definition at line 340 of file points.h.
342 {
344
345 result.xcoord = -src.xcoord;
346 result.ycoord = -src.ycoord;
347 return result;
348}
◆ operator- [2/2]
subtract
Definition at line 386 of file points.h.
388 {
390
391 sum.xcoord = op1.xcoord - op2.xcoord;
392 sum.ycoord = op1.ycoord - op2.ycoord;
393 return sum;
394}
◆ operator-=
subtract
Definition at line 402 of file points.h.
404 {
405 op1.xcoord -= op2.xcoord;
406 op1.ycoord -= op2.ycoord;
407 return op1;
408}
◆ operator/
divide
Definition at line 481 of file points.h.
483 {
485
486 result.xcoord = op1.xcoord / scale;
487 result.ycoord = op1.ycoord / scale;
488 return result;
489}
◆ operator/=
divide
Definition at line 497 of file points.h.
499 {
500 op1.xcoord /= scale;
501 op1.ycoord /= scale;
502 return op1;
503}
◆ xcoord
◆ ycoord
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/points.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/points.cpp