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 &, int16_t) |
| multiply More...
|
|
ICOORD | operator* (int16_t, const ICOORD &) |
| multiply More...
|
|
ICOORD & | operator*= (ICOORD &, int16_t) |
| multiply More...
|
|
ICOORD | operator/ (const ICOORD &, int16_t) |
| divide More...
|
|
ICOORD & | operator/= (ICOORD &, int16_t) |
| divide More...
|
|
integer coordinate
Definition at line 31 of file points.h.
◆ ICOORD() [1/2]
empty constructor
Definition at line 37 of file points.h.
◆ ICOORD() [2/2]
ICOORD::ICOORD |
( |
int16_t |
xin, |
|
|
int16_t |
yin |
|
) |
| |
|
inline |
constructor
- Parameters
-
Definition at line 43 of file points.h.
◆ ~ICOORD()
◆ angle()
float ICOORD::angle |
( |
| ) |
const |
|
inline |
find angle
Definition at line 97 of file points.h.
◆ DeSerialize()
bool ICOORD::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
Definition at line 67 of file points.cpp.
67 {
70 if (swap) {
73 }
74 return true;
75}
void ReverseN(void *ptr, int num_bytes)
bool DeSerialize(FILE *fp, char *data, size_t n)
◆ length()
float ICOORD::length |
( |
| ) |
const |
|
inline |
find length
Definition at line 78 of file points.h.
78 {
80 }
float sqlength() const
find sq length
◆ operator!=()
test inequality
Definition at line 106 of file points.h.
◆ operator==()
bool ICOORD::operator== |
( |
const ICOORD & |
other | ) |
const |
|
inline |
◆ pt_to_pt_dist()
float ICOORD::pt_to_pt_dist |
( |
const ICOORD & |
pt | ) |
const |
|
inline |
Distance between pts.
Definition at line 92 of file points.h.
92 {
94 }
float pt_to_pt_sqdist(const ICOORD &pt) const
sq dist between pts
◆ pt_to_pt_sqdist()
float ICOORD::pt_to_pt_sqdist |
( |
const ICOORD & |
pt | ) |
const |
|
inline |
sq dist between pts
Definition at line 83 of file points.h.
◆ rotate()
void ICOORD::rotate |
( |
const FCOORD & |
vec | ) |
|
|
inline |
rotate
- Parameters
-
Definition at line 536 of file points.h.
537 {
538 auto tmp =
static_cast<int16_t
>(std::floor(
xcoord * vec.
x() -
543}
◆ Serialize()
bool ICOORD::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 61 of file points.cpp.
61 {
64}
bool Serialize(FILE *fp, const char *data, size_t n)
◆ set_with_shrink()
void ICOORD::set_with_shrink |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Set from the given x,y, shrinking the vector to fit if needed.
Definition at line 41 of file points.cpp.
41 {
42
43 int factor = 1;
44 int max_extent = std::max(abs(
x), abs(
y));
45 if (max_extent > INT16_MAX)
46 factor = max_extent / INT16_MAX + 1;
49}
int16_t y() const
access_function
int16_t x() const
access function
◆ set_x()
void ICOORD::set_x |
( |
int16_t |
xin | ) |
|
|
inline |
rewrite function
Definition at line 61 of file points.h.
◆ set_y()
void ICOORD::set_y |
( |
int16_t |
yin | ) |
|
|
inline |
rewrite function
Definition at line 65 of file points.h.
◆ setup_render()
void 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 83 of file points.cpp.
84 {
87 if (abs_x >= abs_y) {
88
93 *major = abs_x;
94 *minor = abs_y;
95 } else {
96
101 *major = abs_y;
102 *minor = abs_x;
103 }
104}
◆ sqlength()
float ICOORD::sqlength |
( |
| ) |
const |
|
inline |
find sq length
Definition at line 73 of file points.h.
◆ x()
int16_t ICOORD::x |
( |
| ) |
const |
|
inline |
access function
Definition at line 52 of file points.h.
◆ y()
int16_t ICOORD::y |
( |
| ) |
const |
|
inline |
access_function
Definition at line 56 of file points.h.
◆ FCOORD
◆ operator!
rotate 90 deg anti
Definition at line 327 of file points.h.
329 {
331
334 return result;
335}
◆ operator%
int32_t operator% |
( |
const ICOORD & |
op1, |
|
|
const ICOORD & |
op2 |
|
) |
| |
|
friend |
scalar product
Definition at line 431 of file points.h.
◆ operator* [1/3]
int32_t operator* |
( |
const ICOORD & |
op1, |
|
|
const ICOORD & |
op2 |
|
) |
| |
|
friend |
◆ operator* [2/3]
multiply
Definition at line 457 of file points.h.
459 {
461
464 return result;
465}
◆ operator* [3/3]
multiply
Definition at line 468 of file points.h.
471 {
473
476 return result;
477}
◆ operator*=
multiply
Definition at line 487 of file points.h.
489 {
492 return op1;
493}
◆ operator+
add
Definition at line 363 of file points.h.
365 {
367
370 return sum;
371}
◆ operator+=
add
Definition at line 381 of file points.h.
383 {
386 return op1;
387}
◆ operator- [1/2]
unary minus
Definition at line 345 of file points.h.
347 {
349
352 return result;
353}
◆ operator- [2/2]
subtract
Definition at line 397 of file points.h.
399 {
401
404 return sum;
405}
◆ operator-=
subtract
Definition at line 415 of file points.h.
417 {
420 return op1;
421}
◆ operator/
divide
Definition at line 503 of file points.h.
505 {
507
510 return result;
511}
◆ operator/=
divide
Definition at line 521 of file points.h.
523 {
526 return op1;
527}
◆ xcoord
◆ ycoord
The documentation for this class was generated from the following files: