BPoint¶
Data Members¶
float x¶
The coordinate value measured horizontally along the x-axis.
float y¶
The coordinate value measured vertically along the y-axis.
Constructor and Destructor¶
BPoint()
inline BPoint::BPoint(float x, float y)
inline BPoint::BPoint(const BPoint &point)
inline BPoint::BPoint()
Creates a new BPoint object that corresponds to the point (x, y), or BPoint that’s copied from point. If no coordinate values are assigned, the BPoint’s location is indeterminate.
See also: Set()
, the assignment operator
Member Functions¶
ConstrainTo()
void BPoint::ConstrainTo(BRect rect)
Ensures that the BPoint lies within rect. If it’s already contained in the rectangle, the BPoint is unchanged; otherwise, it’s moved to the rect’s nearest edge.
See also: BRect::Contains()
PrintToStream()
void BPoint::PrintToStream() const
Prints the BPoint’s coordinates to standard output in the form:
"BPoint(x, y)"
Set()
inline void BPoint::Set(float x, float y)
Sets the BPoint’s x and y coordinates.
Operators¶
inline BPoint &operator=(const BPoint &from)
Copies from’s coordinate data into the left-side object.
bool operator==(BPoint) const
bool operator!=(BPoint) const
== returns true if the two objects’ point exactly coincide.
!= returns true if the two objects’ points don’t coincide.
BPoint operator+(const BPoint&) const
BPoint operator+=(const BPoint&) const
+ creates and returns a new BPoint that adds the two operands together. The new object’s x coordinate is the sum of the operands’ x values; its y value is the sum of the operands’ y values.
+= adds the operands together and stores the result in the left operand.
BPoint operator-(const BPoint&) const
BPoint operator-=(const BPoint&) const
- creates and returns a new BPoint that subtracts the right operand from the left. The new object’s x coordinate is the difference between the operands’ x values; its y value is the difference between the operands’ y values.
-= performs the subtraction and stores the result in the left operand.
Global Objects¶
B_ORIGIN¶
BPoint object that represents (0.0, 0.0).