#include <wx/geometry.h>
wxRect2DDouble is an axis-aligned rectangle; each side of the rect is parallel to the X or Y axis.
The rectangle is either defined by the top left and bottom right corner, or by the top left corner and size.
A point is contained within the rectangle if left <= right and top <= m_x <m_y < bottom; thus, it is a half open interval.
SetXXX functions, which keep the other corners at their position whenever sensibleMoveXXX functions, which keep the size of the rectangle and move the other corners appropriately Public Member Functions | |
| wxRect2DDouble () | |
| Default constructor. More... | |
| wxRect2DDouble (wxDouble x, wxDouble y, wxDouble width, wxDouble height) | |
| Creates a wxRect2DDouble object from x, y, width and height values. More... | |
| wxRect2DDouble (const wxRect &rect) | |
| Constructs a wxRect2DDouble from a wxRect. More... | |
| wxPoint2DDouble | GetPosition () const |
| Returns the position. More... | |
| wxSize | GetSize () const |
| Returns the size. More... | |
| wxDouble | GetX () const |
| Returns the left position of the rectangle. More... | |
| wxDouble | GetY () const |
| Returns the top position of the rect. More... | |
| wxDouble | GetWidth () const |
| Returns the width. More... | |
| void | SetWidth (wxDouble w) |
| Sets the width. More... | |
| wxDouble | GetHeight () const |
| Returns the height. More... | |
| void | SetHeight (wxDouble h) |
| Sets the height. More... | |
| wxDouble | GetLeft () const |
| Returns the left point of the rectangle (the same as GetX()). More... | |
| void | SetLeft (wxDouble n) |
| Set the left side of the rectangle. More... | |
| void | MoveLeftTo (wxDouble n) |
| Sets the left position, which may adjust the width of the rectangle. More... | |
| wxDouble | GetTop () const |
| Returns the top point of the rectangle (the same as GetY()). More... | |
| void | SetTop (wxDouble n) |
| Set the top edge of the rectangle. More... | |
| void | MoveTopTo (wxDouble n) |
| Set the top edge of the rectangle, preserving the height. More... | |
| wxDouble | GetBottom () const |
| Returns the bottom point of the rectangle. More... | |
| void | SetBottom (wxDouble n) |
| Set the bottom edge of the rectangle. More... | |
| void | MoveBottomTo (wxDouble n) |
| Set the bottom edge of the rectangle, preserving the height. More... | |
| wxDouble | GetRight () const |
| Returns the right point of the rectangle. More... | |
| void | SetRight (wxDouble n) |
| Set the right side of the rectangle. More... | |
| void | MoveRightTo (wxDouble n) |
| Set the right side of the rectangle, preserving the width. More... | |
| wxPoint2DDouble | GetLeftTop () const |
| Returns the position of the top left corner of the rectangle, same as GetPosition(). More... | |
| void | SetLeftTop (const wxPoint2DDouble &pt) |
| Set the top-left point of the rectangle. More... | |
| void | MoveLeftTopTo (const wxPoint2DDouble &pt) |
| Set the top-left point of the rectangle, while preserving the width and height of the rectangle. More... | |
| wxPoint2DDouble | GetLeftBottom () const |
| Returns the position of the bottom left corner. More... | |
| void | SetLeftBottom (const wxPoint2DDouble &pt) |
| Set the bottom-left point of the rectangle. More... | |
| void | MoveLeftBottomTo (const wxPoint2DDouble &pt) |
| Set the bottom-left point of the rectangle, while preserving the width and height of the rectangle. More... | |
| wxPoint2DDouble | GetRightTop () const |
| Returns the position of the top right corner. More... | |
| void | SetRightTop (const wxPoint2DDouble &pt) |
| Set the top-right point of the rectangle. More... | |
| void | MoveRightTopTo (const wxPoint2DDouble &pt) |
| Set the top-right point of the rectangle, while preserving the width and height of the rectangle. More... | |
| wxPoint2DDouble | GetRightBottom () const |
| Returns the position of the bottom right corner. More... | |
| void | SetRightBottom (const wxPoint2DDouble &pt) |
| Set the bottom-right point of the rectangle. More... | |
| void | MoveRightBottomTo (const wxPoint2DDouble &pt) |
| Set the bottom-right point of the rectangle, while preserving the width and height of the rectangle. More... | |
| wxPoint2DDouble | GetCentre () const |
| Returns the centre point of the rectangle. More... | |
| void | SetCentre (const wxPoint2DDouble &pt) |
| Recenters (i.e., moves) the rectangle to the given point. More... | |
| void | MoveCentreTo (const wxPoint2DDouble &pt) |
| An alias for MoveCentreTo(). More... | |
| wxOutCode | GetOutCode (const wxPoint2DDouble &pt) const |
| Returns the relative location of a point to the rectangle (e.g., inside or to the left of it). More... | |
| bool | Contains (const wxPoint2DDouble &pt) const |
| Returns true if the given point is inside the rectangle (or on its boundary) and false otherwise. More... | |
| bool | Contains (const wxRect2DDouble &rect) const |
| Returns true if the given rectangle is completely inside this rectangle (or touches its boundary) and false otherwise. More... | |
| bool | IsEmpty () const |
| Returns true if this rectangle has a width or height less than or equal to 0 and false otherwise. More... | |
| bool | HaveEqualSize (const wxRect2DDouble &rect) const |
| Returns true if another rectangle has the same width and height. More... | |
| void | Inset (wxDouble x, wxDouble y) |
Offsets the rectangle by x and y, but maintains the bottom right corner. More... | |
| void | Inset (wxDouble left, wxDouble top, wxDouble right, wxDouble bottom) |
| void | Offset (const wxPoint2DDouble &pt) |
| Moves the rectangle by the specified offset. More... | |
| void | Offset (wxDouble dx, wxDouble dy) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
| void | ConstrainTo (const wxRect2DDouble &rect) |
| Resizes the rectangle to fit within the dimensions of another rectangle. More... | |
| wxPoint2DDouble | Interpolate (wxInt32 widthfactor, wxInt32 heightfactor) const |
| void | Intersect (const wxRect2DDouble &otherRect) |
| Constrains the rectangle to the intersection of another rectangle. More... | |
| wxRect2DDouble | CreateIntersection (const wxRect2DDouble &otherRect) const |
| Returns the intersecting rectangle of this rectangle with another one. More... | |
| bool | Intersects (const wxRect2DDouble &rect) const |
| Returns true if this rectangle has a non-empty intersection with the rectangle rect and false otherwise. More... | |
| void | Union (const wxRect2DDouble &otherRect) |
| Expands the rectangle to the union with another rectangle. More... | |
| void | Union (const wxPoint2DDouble &pt) |
Expands the rectangle to include the point at pt. More... | |
| wxRect2DDouble | CreateUnion (const wxRect2DDouble &otherRect) const |
| Returns the union of this rectangle with another one. More... | |
| void | Scale (wxDouble f) |
| void | Scale (wxInt32 num, wxInt32 denum) |
| wxRect | ToRect () const |
| Returns the rectangle as a wxRect. More... | |
| wxRect2DDouble & | Inflate (wxDouble dx, wxDouble dy) |
| Increases the size of the rectangle. More... | |
| wxRect2DDouble & | Inflate (const wxSize &d) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
| wxRect2DDouble & | Inflate (wxDouble d) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
| wxRect2DDouble | Inflate (wxDouble dx, wxDouble dy) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
| wxRect2DDouble & | Deflate (wxDouble dx, wxDouble dy) |
| Decrease the rectangle size. More... | |
| wxRect2DDouble & | Deflate (const wxSize &d) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
| wxRect2DDouble & | Deflate (wxDouble d) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
| wxRect2DDouble | Deflate (wxDouble dx, wxDouble dy) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
Miscellaneous operators | |
| wxRect2DDouble & | operator= (const wxRect2DDouble &rect) |
| Assignment operator. More... | |
| bool | operator== (const wxRect2DDouble &rect) const |
| Equality operator. More... | |
| bool | operator!= (const wxRect2DDouble &rect) const |
| Inequality operator. More... | |
Static Public Member Functions | |
| static void | Intersect (const wxRect2DDouble &src1, const wxRect2DDouble &src2, wxRect2DDouble *dest) |
| Returns the intersecting rectangle of two rectangles. More... | |
| static void | Union (const wxRect2DDouble &src1, const wxRect2DDouble &src2, wxRect2DDouble *dest) |
| Returns the union rectangle of two rectangles. More... | |
Public Attributes | |
| wxDouble | m_x |
| wxDouble | m_y |
| wxDouble | m_width |
| wxDouble | m_height |
| wxRect2DDouble::wxRect2DDouble | ( | ) |
Default constructor.
Initializes to zero the internal m_x, m_y, m_width and m_height members.
Creates a wxRect2DDouble object from x, y, width and height values.
|
explicit |
Constructs a wxRect2DDouble from a wxRect.
| void wxRect2DDouble::ConstrainTo | ( | const wxRect2DDouble & | rect | ) |
Resizes the rectangle to fit within the dimensions of another rectangle.
| bool wxRect2DDouble::Contains | ( | const wxPoint2DDouble & | pt | ) | const |
Returns true if the given point is inside the rectangle (or on its boundary) and false otherwise.
| bool wxRect2DDouble::Contains | ( | const wxRect2DDouble & | rect | ) | const |
Returns true if the given rectangle is completely inside this rectangle (or touches its boundary) and false otherwise.
| wxRect2DDouble wxRect2DDouble::CreateIntersection | ( | const wxRect2DDouble & | otherRect | ) | const |
Returns the intersecting rectangle of this rectangle with another one.
| wxRect2DDouble wxRect2DDouble::CreateUnion | ( | const wxRect2DDouble & | otherRect | ) | const |
Returns the union of this rectangle with another one.
| wxRect2DDouble& wxRect2DDouble::Deflate | ( | const wxSize & | d | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| wxRect2DDouble& wxRect2DDouble::Deflate | ( | wxDouble | d | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| wxRect2DDouble& wxRect2DDouble::Deflate | ( | wxDouble | dx, |
| wxDouble | dy | ||
| ) |
| wxRect2DDouble wxRect2DDouble::Deflate | ( | wxDouble | dx, |
| wxDouble | dy | ||
| ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| wxDouble wxRect2DDouble::GetBottom | ( | ) | const |
Returns the bottom point of the rectangle.
| wxPoint2DDouble wxRect2DDouble::GetCentre | ( | ) | const |
Returns the centre point of the rectangle.
| wxDouble wxRect2DDouble::GetHeight | ( | ) | const |
Returns the height.
| wxDouble wxRect2DDouble::GetLeft | ( | ) | const |
Returns the left point of the rectangle (the same as GetX()).
| wxPoint2DDouble wxRect2DDouble::GetLeftBottom | ( | ) | const |
Returns the position of the bottom left corner.
| wxPoint2DDouble wxRect2DDouble::GetLeftTop | ( | ) | const |
Returns the position of the top left corner of the rectangle, same as GetPosition().
| wxOutCode wxRect2DDouble::GetOutCode | ( | const wxPoint2DDouble & | pt | ) | const |
Returns the relative location of a point to the rectangle (e.g., inside or to the left of it).
| wxPoint2DDouble wxRect2DDouble::GetPosition | ( | ) | const |
Returns the position.
| wxDouble wxRect2DDouble::GetRight | ( | ) | const |
Returns the right point of the rectangle.
| wxPoint2DDouble wxRect2DDouble::GetRightBottom | ( | ) | const |
Returns the position of the bottom right corner.
| wxPoint2DDouble wxRect2DDouble::GetRightTop | ( | ) | const |
Returns the position of the top right corner.
| wxSize wxRect2DDouble::GetSize | ( | ) | const |
Returns the size.
| wxDouble wxRect2DDouble::GetTop | ( | ) | const |
Returns the top point of the rectangle (the same as GetY()).
| wxDouble wxRect2DDouble::GetWidth | ( | ) | const |
Returns the width.
| wxDouble wxRect2DDouble::GetX | ( | ) | const |
Returns the left position of the rectangle.
| wxDouble wxRect2DDouble::GetY | ( | ) | const |
Returns the top position of the rect.
| bool wxRect2DDouble::HaveEqualSize | ( | const wxRect2DDouble & | rect | ) | const |
Returns true if another rectangle has the same width and height.
| wxRect2DDouble& wxRect2DDouble::Inflate | ( | const wxSize & | d | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| wxRect2DDouble& wxRect2DDouble::Inflate | ( | wxDouble | d | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| wxRect2DDouble& wxRect2DDouble::Inflate | ( | wxDouble | dx, |
| wxDouble | dy | ||
| ) |
Increases the size of the rectangle.
The left border is moved farther left and the right border is moved farther right by dx. The upper border is moved farther up and the bottom border is moved farther down by dy. (Note that the width and height of the rectangle thus change by 2*dx and 2*dy, respectively.) If one or both of dx and dy are negative, the opposite happens: the rectangle size decreases in the respective direction.
Inflating and deflating behaves "naturally". Defined more precisely, that means:
| wxRect2DDouble wxRect2DDouble::Inflate | ( | wxDouble | dx, |
| wxDouble | dy | ||
| ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Offsets the rectangle by x and y, but maintains the bottom right corner.
| wxPoint2DDouble wxRect2DDouble::Interpolate | ( | wxInt32 | widthfactor, |
| wxInt32 | heightfactor | ||
| ) | const |
| void wxRect2DDouble::Intersect | ( | const wxRect2DDouble & | otherRect | ) |
Constrains the rectangle to the intersection of another rectangle.
|
static |
Returns the intersecting rectangle of two rectangles.
| bool wxRect2DDouble::Intersects | ( | const wxRect2DDouble & | rect | ) | const |
Returns true if this rectangle has a non-empty intersection with the rectangle rect and false otherwise.
| bool wxRect2DDouble::IsEmpty | ( | ) | const |
Returns true if this rectangle has a width or height less than or equal to 0 and false otherwise.
| void wxRect2DDouble::MoveBottomTo | ( | wxDouble | n | ) |
Set the bottom edge of the rectangle, preserving the height.
| void wxRect2DDouble::MoveCentreTo | ( | const wxPoint2DDouble & | pt | ) |
An alias for MoveCentreTo().
| void wxRect2DDouble::MoveLeftBottomTo | ( | const wxPoint2DDouble & | pt | ) |
Set the bottom-left point of the rectangle, while preserving the width and height of the rectangle.
| void wxRect2DDouble::MoveLeftTo | ( | wxDouble | n | ) |
Sets the left position, which may adjust the width of the rectangle.
| void wxRect2DDouble::MoveLeftTopTo | ( | const wxPoint2DDouble & | pt | ) |
Set the top-left point of the rectangle, while preserving the width and height of the rectangle.
| void wxRect2DDouble::MoveRightBottomTo | ( | const wxPoint2DDouble & | pt | ) |
Set the bottom-right point of the rectangle, while preserving the width and height of the rectangle.
| void wxRect2DDouble::MoveRightTo | ( | wxDouble | n | ) |
Set the right side of the rectangle, preserving the width.
| void wxRect2DDouble::MoveRightTopTo | ( | const wxPoint2DDouble & | pt | ) |
Set the top-right point of the rectangle, while preserving the width and height of the rectangle.
| void wxRect2DDouble::MoveTopTo | ( | wxDouble | n | ) |
Set the top edge of the rectangle, preserving the height.
| void wxRect2DDouble::Offset | ( | const wxPoint2DDouble & | pt | ) |
Moves the rectangle by the specified offset.
If X of pt is positive, the rectangle is moved to the right, if Y of pt is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| bool wxRect2DDouble::operator!= | ( | const wxRect2DDouble & | rect | ) | const |
Inequality operator.
| wxRect2DDouble& wxRect2DDouble::operator= | ( | const wxRect2DDouble & | rect | ) |
Assignment operator.
| bool wxRect2DDouble::operator== | ( | const wxRect2DDouble & | rect | ) | const |
Equality operator.
| void wxRect2DDouble::Scale | ( | wxDouble | f | ) |
| void wxRect2DDouble::SetBottom | ( | wxDouble | n | ) |
Set the bottom edge of the rectangle.
| void wxRect2DDouble::SetCentre | ( | const wxPoint2DDouble & | pt | ) |
Recenters (i.e., moves) the rectangle to the given point.
|
inline |
Sets the height.
| void wxRect2DDouble::SetLeft | ( | wxDouble | n | ) |
Set the left side of the rectangle.
| void wxRect2DDouble::SetLeftBottom | ( | const wxPoint2DDouble & | pt | ) |
Set the bottom-left point of the rectangle.
| void wxRect2DDouble::SetLeftTop | ( | const wxPoint2DDouble & | pt | ) |
Set the top-left point of the rectangle.
| void wxRect2DDouble::SetRight | ( | wxDouble | n | ) |
Set the right side of the rectangle.
| void wxRect2DDouble::SetRightBottom | ( | const wxPoint2DDouble & | pt | ) |
Set the bottom-right point of the rectangle.
| void wxRect2DDouble::SetRightTop | ( | const wxPoint2DDouble & | pt | ) |
Set the top-right point of the rectangle.
| void wxRect2DDouble::SetTop | ( | wxDouble | n | ) |
Set the top edge of the rectangle.
| void wxRect2DDouble::SetWidth | ( | wxDouble | w | ) |
Sets the width.
| void wxRect2DDouble::Union | ( | const wxPoint2DDouble & | pt | ) |
Expands the rectangle to include the point at pt.
| void wxRect2DDouble::Union | ( | const wxRect2DDouble & | otherRect | ) |
Expands the rectangle to the union with another rectangle.
|
static |
Returns the union rectangle of two rectangles.
| wxDouble wxRect2DDouble::m_height |
| wxDouble wxRect2DDouble::m_width |
| wxDouble wxRect2DDouble::m_x |
| wxDouble wxRect2DDouble::m_y |