integer coordinate
More...
#include <points.h>
List of all members.
Public Member Functions |
| ICOORD () |
| empty constructor
|
| ICOORD (inT16 xin, inT16 yin) |
| ~ICOORD () |
| destructor
|
inT16 | x () const |
| access function
|
inT16 | y () const |
| access_function
|
void | set_x (inT16 xin) |
| rewrite function
|
void | set_y (inT16 yin) |
| rewrite function
|
void | set_with_shrink (int x, int y) |
| Set from the given x,y, shrinking the vector to fit if needed.
|
float | sqlength () const |
| find sq length
|
float | length () const |
| find length
|
float | pt_to_pt_sqdist (const ICOORD &pt) const |
| sq dist between pts
|
float | pt_to_pt_dist (const ICOORD &pt) const |
| Distance between pts.
|
float | angle () const |
| find angle
|
BOOL8 | operator== (const ICOORD &other) const |
| test equality
|
BOOL8 | operator!= (const ICOORD &other) const |
| test inequality
|
void | rotate (const FCOORD &vec) |
void | setup_render (ICOORD *major_step, ICOORD *minor_step, int *major, int *minor) const |
bool | Serialize (FILE *fp) const |
bool | DeSerialize (bool swap, FILE *fp) |
Protected Attributes |
inT16 | xcoord |
inT16 | ycoord |
Friends |
class | FCOORD |
ICOORD | operator! (const ICOORD &) |
| rotate 90 deg anti
|
ICOORD | operator- (const ICOORD &) |
| unary minus
|
ICOORD | operator+ (const ICOORD &, const ICOORD &) |
| add
|
ICOORD & | operator+= (ICOORD &, const ICOORD &) |
| add
|
ICOORD | operator- (const ICOORD &, const ICOORD &) |
| subtract
|
ICOORD & | operator-= (ICOORD &, const ICOORD &) |
| subtract
|
inT32 | operator% (const ICOORD &, const ICOORD &) |
| scalar product
|
inT32 | operator* (const ICOORD &, const ICOORD &) |
| cross product
|
ICOORD | operator* (const ICOORD &, inT16) |
| multiply
|
ICOORD | operator* (inT16, const ICOORD &) |
| multiply
|
ICOORD & | operator*= (ICOORD &, inT16) |
| multiply
|
ICOORD | operator/ (const ICOORD &, inT16) |
| divide
|
ICOORD & | operator/= (ICOORD &, inT16) |
| divide
|
Detailed Description
integer coordinate
Definition at line 30 of file points.h.
Constructor & Destructor Documentation
ICOORD::ICOORD |
( |
| ) |
[inline] |
empty constructor
Definition at line 36 of file points.h.
constructor
- Parameters:
-
Definition at line 42 of file points.h.
ICOORD::~ICOORD |
( |
| ) |
[inline] |
destructor
Definition at line 48 of file points.h.
Member Function Documentation
float ICOORD::angle |
( |
| ) |
const [inline] |
find angle
Definition at line 97 of file points.h.
{
return (float) atan2 ((double) ycoord, (double) xcoord);
}
bool ICOORD::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
float ICOORD::length |
( |
| ) |
const [inline] |
find length
Definition at line 78 of file points.h.
BOOL8 ICOORD::operator!= |
( |
const ICOORD & |
other | ) |
const [inline] |
test inequality
Definition at line 106 of file points.h.
BOOL8 ICOORD::operator== |
( |
const ICOORD & |
other | ) |
const [inline] |
float ICOORD::pt_to_pt_dist |
( |
const ICOORD & |
pt | ) |
const [inline] |
Distance between pts.
Definition at line 92 of file points.h.
float ICOORD::pt_to_pt_sqdist |
( |
const ICOORD & |
pt | ) |
const [inline] |
sq dist between pts
Definition at line 83 of file points.h.
void ICOORD::rotate |
( |
const FCOORD & |
vec | ) |
[inline] |
rotate
- Parameters:
-
Definition at line 241 of file ipoints.h.
bool ICOORD::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 60 of file points.cpp.
{
if (fwrite(&xcoord, sizeof(xcoord), 1, fp) != 1) return false;
if (fwrite(&ycoord, sizeof(ycoord), 1, fp) != 1) return false;
return true;
}
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 40 of file points.cpp.
void ICOORD::set_x |
( |
inT16 |
xin | ) |
[inline] |
rewrite function
Definition at line 61 of file points.h.
void ICOORD::set_y |
( |
inT16 |
yin | ) |
[inline] |
rewrite function
Definition at line 65 of file points.h.
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.
float ICOORD::sqlength |
( |
| ) |
const [inline] |
find sq length
Definition at line 73 of file points.h.
inT16 ICOORD::x |
( |
| ) |
const [inline] |
access function
Definition at line 52 of file points.h.
inT16 ICOORD::y |
( |
| ) |
const [inline] |
access_function
Definition at line 56 of file points.h.
Friends And Related Function Documentation
rotate 90 deg anti
Definition at line 32 of file ipoints.h.
Member Data Documentation
The documentation for this class was generated from the following files: