LRECT2D Struct Reference

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

#include <mi32/rect.h>

List of all members.

Public Member Functions

 CHECKSIZE (16)
bool Contains (const LRECT2D &rhs) const
bool Contains (const LPOINT2D &pt) const
bool Contains (INT32 x, INT32 y) const
void Expand (const INT32 xval, const INT32 yval)
void Expand (const INT32 value)
void Extend (const INT32 xval, const INT32 yval)
void Extend (const LPOINT2D &pt)
void Extend (const LRECT2D &rect)
INT32 GetArea () const
void GetBottomLeft (LPOINT2D &ret) const
void GetBottomRight (LPOINT2D &ret) const
void GetCenter (DPOINT2D &ret) const
DPOINT2D GetCenter () const
void GetCorners (LPOINT2D *corners, bool ClosePoly=false, bool OrientCCW=false) const
int GetDimension () const
UINT32 GetHeight () const
void GetSize (LPOINT2D &ret) const
void GetTopLeft (LPOINT2D &ret) const
void GetTopRight (LPOINT2D &ret) const
UINT32 GetWidth () const
bool IniRead (INIHANDLE IniHandle, const char *IniGroup, const char *IniName)
void IniWrite (INIHANDLE IniHandle, const char *IniGroup, const char *IniName) const
void Intersect (const LRECT2D &rect)
bool IsValid () const
void Limit (DPOINT2D &point) const
void Limit (LPOINT2D &point) const
 LRECT2D (INT32 xi, INT32 yi, INT32 xl, INT32 yl)
 LRECT2D (INT32 xsize, INT32 ysize)
 LRECT2D ()
bool Overlaps (const LRECT2D &rhs) const
void Set (INT32 x1, INT32 y1, INT32 x2, INT32 y2)
void SetInvalid ()
void SwapBytes ()

Public Attributes

INT32 xinit
INT32 xlast
INT32 yinit
INT32 ylast


Detailed Description

2D rectangle using 32-bit integer coordinates.

Definition at line 212 of file rect.h.


Constructor & Destructor Documentation

LRECT2D::LRECT2D (  )  [inline]

Default constructor, initializes to invalid (empty) rectangle.

Definition at line 220 of file rect.h.

LRECT2D::LRECT2D ( INT32  xsize,
INT32  ysize 
) [inline]

Construct rectangle of specified size.

Definition at line 224 of file rect.h.

LRECT2D::LRECT2D ( INT32  xi,
INT32  yi,
INT32  xl,
INT32  yl 
) [inline]

Construction from X/Y ranges.

Definition at line 230 of file rect.h.


Member Function Documentation

LRECT2D::CHECKSIZE ( 16   ) 

Make compiler validate structure size.

bool LRECT2D::Contains ( const LRECT2D rhs  )  const [inline]

Check if contains specified rectangle.

Definition at line 249 of file rect.h.

bool LRECT2D::Contains ( const LPOINT2D pt  )  const [inline]

Check if contains specified point.

Definition at line 244 of file rect.h.

bool LRECT2D::Contains ( INT32  x,
INT32  y 
) const [inline]

Check if contains specified point.

Definition at line 238 of file rect.h.

void LRECT2D::Expand ( const INT32  xval,
const INT32  yval 
) [inline]

Expand the rectangle by 'value' amount.

Definition at line 259 of file rect.h.

void LRECT2D::Expand ( const INT32  value  )  [inline]

Expand the rectangle by 'value' amount.

Definition at line 254 of file rect.h.

void LRECT2D::Extend ( const INT32  xval,
const INT32  yval 
) [inline]

Extend rectangle to include specified X,Y point.

Definition at line 285 of file rect.h.

void LRECT2D::Extend ( const LPOINT2D pt  )  [inline]

Extend rectangle to include specified LPOINT2D point.

Definition at line 275 of file rect.h.

void LRECT2D::Extend ( const LRECT2D rect  )  [inline]

Extend rectangle to encompass both rectangles.

Definition at line 265 of file rect.h.

INT32 LRECT2D::GetArea (  )  const [inline]

Compute area of rectangle (Could be negative if invalid rectangle).

Definition at line 296 of file rect.h.

void LRECT2D::GetBottomLeft ( LPOINT2D ret  )  const [inline]

Return bottom left corner.

Definition at line 300 of file rect.h.

void LRECT2D::GetBottomRight ( LPOINT2D ret  )  const [inline]

Get bottom right corner.

Definition at line 305 of file rect.h.

void LRECT2D::GetCenter ( DPOINT2D ret  )  const [inline]

Get center point of rectangle.

Definition at line 314 of file rect.h.

DPOINT2D LRECT2D::GetCenter (  )  const [inline]

Return center point of rectangle.

Definition at line 310 of file rect.h.

void LRECT2D::GetCorners ( LPOINT2D corners,
bool  ClosePoly = false,
bool  OrientCCW = false 
) const [inline]

Get corners as array.

Parameters:
corners  Array of points to fill in
ClosePoly  Return "closed" polygon, corners[4] = corners[0]
OrientCCW  Orient points in counterclockwise order for right-hand cartesian

Definition at line 319 of file rect.h.

int LRECT2D::GetDimension (  )  const [inline]

Compute number of non zero dimensions (0, 1, or 2).

Definition at line 326 of file rect.h.

UINT32 LRECT2D::GetHeight (  )  const [inline]

Return height (Y size) of rectangle.

Definition at line 335 of file rect.h.

void LRECT2D::GetSize ( LPOINT2D ret  )  const [inline]

Get size of rectangle.

Definition at line 339 of file rect.h.

void LRECT2D::GetTopLeft ( LPOINT2D ret  )  const [inline]

Return top left point of rectangle.

Definition at line 344 of file rect.h.

void LRECT2D::GetTopRight ( LPOINT2D ret  )  const [inline]

Return top right point of rectangle.

Definition at line 349 of file rect.h.

UINT32 LRECT2D::GetWidth (  )  const [inline]

Return width (X size) of rectangle.

Definition at line 354 of file rect.h.

bool LRECT2D::IniRead ( INIHANDLE  IniHandle,
const char *  IniGroup,
const char *  IniName 
) [inline]

Read rectangle from INI file.

Definition at line 358 of file rect.h.

void LRECT2D::IniWrite ( INIHANDLE  IniHandle,
const char *  IniGroup,
const char *  IniName 
) const [inline]

Read rectangle from INI file.

Definition at line 365 of file rect.h.

void LRECT2D::Intersect ( const LRECT2D rect  )  [inline]

Intersect two DRECT2D's, may result in an invalid rectangle.

Definition at line 372 of file rect.h.

bool LRECT2D::IsValid (  )  const [inline]

Check if rectangle is valid.

Definition at line 388 of file rect.h.

void LRECT2D::Limit ( DPOINT2D point  )  const [inline]

Limit point (DPOINT2D) to extents specified by rectangle.

Definition at line 400 of file rect.h.

void LRECT2D::Limit ( LPOINT2D point  )  const [inline]

Limit point (LPOINT2D) to extents specified by rectangle.

Definition at line 392 of file rect.h.

bool LRECT2D::Overlaps ( const LRECT2D rhs  )  const [inline]

Check if rectangle overlaps.

Definition at line 408 of file rect.h.

void LRECT2D::Set ( INT32  x1,
INT32  y1,
INT32  x2,
INT32  y2 
) [inline]

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

Definition at line 415 of file rect.h.

void LRECT2D::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.

Definition at line 426 of file rect.h.

void LRECT2D::SwapBytes (  )  [inline]

Perform byte-order swapping.

Definition at line 430 of file rect.h.


Member Data Documentation

INT32 LRECT2D::xinit

Minimum X coordinate (inclusive).

Definition at line 214 of file rect.h.

INT32 LRECT2D::xlast

Maximum X coordinate (inclusive).

Definition at line 216 of file rect.h.

INT32 LRECT2D::yinit

Minimum Y coordinate (inclusive).

Definition at line 215 of file rect.h.

INT32 LRECT2D::ylast

Maximum Y coordinate (inclusive).

Definition at line 217 of file rect.h.


The documentation for this struct was generated from the following file:
Generated on Thu Apr 26 04:47:15 2007 for TNTsdk by  doxygen 1.5.2