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.
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.
float sqlength() const
find sq length
◆ operator!=()
test inequality
Definition at line 112 of file points.h.
113 return xcoord != other.xcoord ||
ycoord != other.ycoord;
◆ operator==()
bool tesseract::ICOORD::operator== |
( |
const ICOORD & |
other | ) |
const |
|
inline |
test equality
Definition at line 108 of file points.h.
109 return xcoord == other.xcoord &&
ycoord == other.ycoord;
◆ 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.
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.
92 gap.xcoord =
xcoord - pt.xcoord;
93 gap.ycoord =
ycoord - pt.ycoord;
94 return gap.sqlength();
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.
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.
55 int max_extent = std::max(abs(
x), abs(
y));
56 if (max_extent > INT16_MAX) {
57 factor = max_extent / INT16_MAX + 1;
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.
102 if (abs_x >= abs_y) {
104 major_step->xcoord = sign(
xcoord);
105 major_step->ycoord = 0;
106 minor_step->xcoord = 0;
107 minor_step->ycoord = sign(
ycoord);
112 major_step->xcoord = 0;
113 major_step->ycoord = sign(
ycoord);
114 minor_step->xcoord = sign(
xcoord);
115 minor_step->ycoord = 0;
◆ 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.
329 result.xcoord = -src.ycoord;
330 result.ycoord = src.xcoord;
◆ operator%
int32_t operator% |
( |
const ICOORD & |
op1, |
|
|
const ICOORD & |
op2 |
|
) |
| |
|
friend |
scalar product
Definition at line 416 of file points.h.
419 return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
◆ operator* [1/3]
int32_t operator* |
( |
const ICOORD & |
op1, |
|
|
const ICOORD & |
op2 |
|
) |
| |
|
friend |
cross product
Definition at line 428 of file points.h.
431 return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
◆ operator* [2/3]
multiply
Definition at line 440 of file points.h.
445 result.xcoord = op1.xcoord * scale;
446 result.ycoord = op1.ycoord * scale;
◆ operator* [3/3]
multiply
Definition at line 450 of file points.h.
456 result.xcoord = op1.xcoord * scale;
457 result.ycoord = op1.ycoord * scale;
◆ operator*=
◆ operator+
add
Definition at line 356 of file points.h.
361 sum.xcoord = op1.xcoord + op2.xcoord;
362 sum.ycoord = op1.ycoord + op2.ycoord;
◆ operator+=
add
Definition at line 372 of file points.h.
375 op1.xcoord += op2.xcoord;
376 op1.ycoord += op2.ycoord;
◆ operator- [1/2]
unary minus
Definition at line 340 of file points.h.
345 result.xcoord = -src.xcoord;
346 result.ycoord = -src.ycoord;
◆ operator- [2/2]
subtract
Definition at line 386 of file points.h.
391 sum.xcoord = op1.xcoord - op2.xcoord;
392 sum.ycoord = op1.ycoord - op2.ycoord;
◆ operator-=
subtract
Definition at line 402 of file points.h.
405 op1.xcoord -= op2.xcoord;
406 op1.ycoord -= op2.ycoord;
◆ operator/
divide
Definition at line 481 of file points.h.
486 result.xcoord = op1.xcoord / scale;
487 result.ycoord = op1.ycoord / scale;
◆ operator/=
◆ xcoord
◆ ycoord
The documentation for this class was generated from the following files: