WRECT2D Struct Reference

2D rectangle using 16-bit integer coordinates. More...

#include <mi32/rect.h>

List of all members.

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

Detailed Description

2D rectangle using 16-bit integer coordinates.


Constructor & Destructor Documentation

WRECT2D::WRECT2D (  )  [inline]

Default constructor, initializes to invalid (empty) rectangle.

WRECT2D::WRECT2D ( INT16  xi,
INT16  yi,
INT16  xl,
INT16  yl 
) [inline]

Construction from X/Y ranges.


Member Function Documentation

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.

bool WRECT2D::Contains ( INT16  x,
INT16  y 
) const [inline]

Check if contains specified point.

void WRECT2D::Expand ( const INT16  xval,
const INT16  yval 
) [inline]

Expand rectangle by specified amounts.

void WRECT2D::Expand ( const INT16  value  )  [inline]

Expand rectangle by specified amount.

void WRECT2D::Extend ( const INT16  xval,
const INT16  yval 
) [inline]

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::Set ( INT16  x1,
INT16  y1,
INT16  x2,
INT16  y2 
) [inline]

Set given (x1,y1), (x2,y2).

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.


Member Data Documentation

Minimum X coordinate (inclusive).

Maximum X coordinate (inclusive).

Minimum Y coordinate (inclusive).

Maximum Y coordinate (inclusive).


The documentation for this struct was generated from the following file:

Generated on Sun Oct 7 21:34:00 2012 for TNTsdk 2012 by  doxygen 1.6.1