2D rectangle using 16-bit integer coordinates. More...
#include <mi32/rect.h>
Public Member Functions | |
| WRECT2D (INT16 xi, INT16 yi, INT16 xl, INT16 yl) | |
| WRECT2D () | |
| bool | Contains (const WRECT2D &rhs) const |
| bool | Contains (const WPOINT2D &pt) const |
| bool | Contains (INT16 x, INT16 y) const |
| void | Expand (const INT16 xval, const INT16 yval) |
| void | Expand (const INT16 value) |
| void | Extend (const INT16 xval, const INT16 yval) |
| UINT16 | GetHeight () const |
| UINT16 | GetWidth () const |
| bool | IsNonEmpty () const |
| bool | IsValid () const |
| bool | Overlaps (const WRECT2D &rhs) const |
| void | Set (INT16 x1, INT16 y1, INT16 x2, INT16 y2) |
| void | SetInvalid () |
| void | SwapBytes () |
Public Attributes | |
| INT16 | xinit |
| INT16 | xlast |
| INT16 | yinit |
| INT16 | ylast |
2D rectangle using 16-bit integer coordinates.
| WRECT2D::WRECT2D | ( | ) | [inline] |
Default constructor, initializes to invalid (empty) rectangle.
| bool WRECT2D::Contains | ( | const WRECT2D & | rhs | ) | const [inline] |
Check if contains specified rectangle.
| bool WRECT2D::Contains | ( | const WPOINT2D & | pt | ) | const [inline] |
Check if contains specified point.
Expand rectangle by specified amounts.
| void WRECT2D::Expand | ( | const INT16 | value | ) | [inline] |
Expand rectangle by specified amount.
Extend rectangle to include specified X,Y point.
| UINT16 WRECT2D::GetHeight | ( | ) | const [inline] |
Return height (Y size) of rectangle.
| UINT16 WRECT2D::GetWidth | ( | ) | const [inline] |
Return width (X size) of rectangle.
| bool WRECT2D::IsNonEmpty | ( | ) | const [inline] |
Check if rectangle is non-empty (has positive area).
| bool WRECT2D::IsValid | ( | ) | const [inline] |
Check if rectangle is valid.
| bool WRECT2D::Overlaps | ( | const WRECT2D & | rhs | ) | const [inline] |
Check if rectangle overlaps.
| void WRECT2D::SetInvalid | ( | ) | [inline] |
Sets the initial values to the maximum possible and the final values to the minimum possible, thus making the rectangle "invalid".
Setting a rectangle to invalid means that no point will be in it. It also makes it easy to compute the min/max of a bunch of points. You just iterate through all the points and Extend() the rectangle. Normally, you'd have to handle the first point specially.
| void WRECT2D::SwapBytes | ( | ) | [inline] |
Perform byte-order swapping.
Minimum X coordinate (inclusive).
Maximum X coordinate (inclusive).
Minimum Y coordinate (inclusive).
Maximum Y coordinate (inclusive).
1.6.1