A point on a two-dimensional Cartesian coordinate system. More...
Public Member Functions | |
BPoint () | |
Initializes a BPoint object at the origin, (0, 0). | |
BPoint (const BPoint &p) | |
Initializes a BPoint object from another BPoint. | |
BPoint (float x, float y) | |
Initializes a BPoint object at the specified x and y coordinates. | |
void | ConstrainTo (BRect rect) |
Moves the BPoint so that it is contained within rect. | |
void | PrintToStream () const |
Print the x and y coordinates to standard output. | |
void | Set (float x, float y) |
Sets the x and y coordinates of a BPoint object. | |
Operators | |
BPoint & | operator= (const BPoint &other) |
Initializes a BPoint object from another BPoint by overloading the = operator. | |
BPoint | operator- () const |
Returns a BPoint object with the x and y coordinates negated. | |
BPoint | operator+ (const BPoint &other) const |
Returns a BPoint where the x-coordinate is the sum of the x values and the y-coordinate is the sum of the y values. | |
BPoint | operator- (const BPoint &other) const |
Returns a BPoint where the x-coordinate is the difference of the x values and the y-coordinate is the difference of the y values. | |
BPoint & | operator+= (const BPoint &other) |
Uses the BPoint as an accumulator storing the sum of the x values and the sum of the y values. | |
BPoint & | operator-= (const BPoint &other) |
Uses the BPoint as an accumulator storing the difference of the x values and the difference of the y values. | |
bool | operator!= (const BPoint &other) const |
Returns whether or not the x and y coordinates of the BPoint objects differ. | |
bool | operator== (const BPoint &other) const |
Returns whether or not the x and y coordinates of the BPoint objects are equal. | |
Public Attributes | |
float | x |
The horizontal coordinate. | |
float | y |
The vertical coordinate. | |
A point on a two-dimensional Cartesian coordinate system.
|
inline |
|
inline |
Initializes a BPoint object at the specified x and y coordinates.
x | The x coordinate. |
y | The y coordinate. |
|
inline |
void BPoint::ConstrainTo | ( | BRect | rect | ) |
bool BPoint::operator!= | ( | const BPoint & | other | ) | const |
Returns whether or not the x and y coordinates of the BPoint objects differ.
true
if the x or y coordinates differ, false
otherwise.BPoint BPoint::operator- | ( | ) | const |
bool BPoint::operator== | ( | const BPoint & | other | ) | const |
Returns whether or not the x and y coordinates of the BPoint objects are equal.
true
if the x and y coordinates are equal, false
otherwise.void BPoint::PrintToStream | ( | ) | const |
Print the x and y coordinates to standard output.
Prints in the following format:
BPoint(x:%.0f, y:%.0f)
|
inline |
BPoint::x |
BPoint::y |