#include <fpoint.h>
Public Member Functions | |
Point (UCoord h=0, UCoord v=0) | |
Construct a Point from (h, v). | |
bool | inside (const Rect &rect) const |
Checks if point is inside rect . | |
double | distance (const Point &other) const |
Distance from the other to this point. | |
double | angle (const Point &other) const |
Angle from other to this Point. | |
double | length () const |
Calculate length (absolute value) of vector. | |
Point | projection (const Point &other) const |
Orthogonal vector projection of "this" on "other". | |
bool | isLocated (Direction dir, const Point &from) |
Querying and Setting Values. | |
UCoord | getH () const |
Return the X value of this Point. | |
UCoord | getV () const |
Return the Y value of this Point. | |
void | setH (UCoord h) |
Set the X value of this Point. | |
void | setV (UCoord v) |
Set the Y value of this Point. | |
void | offset (UCoord h, UCoord v=0) |
Offset this Point by (x, y). | |
void | offset (const Point &p) |
Offset this Point by Point p. | |
bool | bound (const Rect &rect) |
Set this to the intersection of this and rect. | |
Operations on Point. | |
Point & | operator() (UCoord h, UCoord v) |
Reinitialize to given coordinates. | |
Point | operator+ (const Point &p) const |
Return p + this Point as a Point. | |
Point | operator- (const Point &p) const |
Return this Point minus p as a Point. | |
Point | operator/ (int32 n) const |
Return this Point divided by n as a Point (scalar divide). | |
Point | operator* (int32 n) const |
Return this Point times n as a Point (scalar multiply). | |
Point & | operator+= (const Point &p) |
Add p to this Point. | |
Point & | operator-= (const Point &p) |
Subtract p from this Point. | |
Point & | operator*= (int32 n) |
Scalar multiply n times this Point. | |
Point & | operator/= (int32 n) |
Scalar divide this Point by n. | |
int32 | operator* (const Point &p) const |
Scalar multiply this point with p. | |
bool | operator== (const Point &p) const |
Check if to Points are equal. | |
bool | operator!= (const Point &p) const |
Not equal. | |
Point & | operator= (const Point &p) |
Assignment. | |
Point | operator- () const |
Reinitialize to given coordinates. | |
Data Fields | |
UCoord | h |
UCoord | v |
Point Representation.
UCoord getH | ( | ) | const [inline] |
Return the X value of this Point.
UCoord getV | ( | ) | const [inline] |
Return the Y value of this Point.
void setH | ( | UCoord | h | ) | [inline] |
Set the X value of this Point.
void setV | ( | UCoord | v | ) | [inline] |
Set the Y value of this Point.
void offset | ( | UCoord | h, | |
UCoord | v = 0 | |||
) | [inline] |
Offset this Point by (x, y).
bool bound | ( | const Rect & | rect | ) |
Set this to the intersection of this and rect.
Point & operator() | ( | UCoord | h, | |
UCoord | v | |||
) | [inline] |
Reinitialize to given coordinates.
Point operator/ | ( | int32 | n | ) | const [inline] |
int32 operator* | ( | const Point & | p | ) | const [inline] |
Scalar multiply this point with p.
bool operator== | ( | const Point & | p | ) | const [inline] |
Check if to Points are equal.
bool operator!= | ( | const Point & | p | ) | const [inline] |
Not equal.
Point operator- | ( | ) | const [inline] |
Reinitialize to given coordinates.
bool inside | ( | const Rect & | rect | ) | const |
Checks if point is inside rect
.
double distance | ( | const Point & | other | ) | const |
Distance from the other to this point.
double length | ( | ) | const |
Calculate length (absolute value) of vector.
UCoord h |
UCoord v |