LRECT2D Struct Reference

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

#include <mi32/rect.h>

Inheritance diagram for LRECT2D:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 LRECT2D (INT32 xi, INT32 yi, INT32 xl, INT32 yl)
 LRECT2D (const LPOINT2D pt)
 LRECT2D (INT32 xsize, INT32 ysize)
 LRECT2D ()
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
LPOINT2D GetMaxXMaxY () const
LPOINT2D GetMaxXMinY () const
LPOINT2D GetMinXMaxY () const
LPOINT2D GetMinXMinY () 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 IsNonEmpty () const
bool IsValid () const
void Limit (DPOINT2D &point) const
void Limit (LPOINT2D &point) const
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.


Constructor & Destructor Documentation

LRECT2D::LRECT2D (  )  [inline]

Default constructor, initializes to invalid (empty) rectangle.

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

Construct rectangle of specified size.

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

Construct from LPOINT2D.

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

Construction from X/Y ranges.


Member Function Documentation

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

Check if contains specified rectangle.

Reimplemented in LRECT3D.

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

Check if contains specified point.

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

Check if contains specified point.

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

Expand rectangle by specified amounts.

Reimplemented in LRECT3D.

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

Expand rectangle by specified amount.

Reimplemented in LRECT3D.

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

Extend rectangle to include specified X,Y point.

Reimplemented in LRECT3D.

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

Extend rectangle to include specified LPOINT2D point.

Reimplemented in LRECT3D.

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

Extend rectangle to encompass both rectangles.

Reimplemented in LRECT3D.

INT32 LRECT2D::GetArea (  )  const [inline]

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

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

Return bottom left corner.

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

Get bottom right corner.

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

Get center point of rectangle.

DPOINT2D LRECT2D::GetCenter (  )  const [inline]

Return center point of rectangle.

Reimplemented in LRECT3D.

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
int LRECT2D::GetDimension (  )  const [inline]

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

Reimplemented in LRECT3D.

UINT32 LRECT2D::GetHeight (  )  const [inline]

Return height (Y size) of rectangle.

LPOINT2D LRECT2D::GetMaxXMaxY (  )  const [inline]

Get maximum X, maximum Y values.

LPOINT2D LRECT2D::GetMaxXMinY (  )  const [inline]

Get maximum X, minimum Y values.

LPOINT2D LRECT2D::GetMinXMaxY (  )  const [inline]

Get minimum X, maximum Y values.

LPOINT2D LRECT2D::GetMinXMinY (  )  const [inline]

Get minimum X, minimum Y values.

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

Get size of rectangle.

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

Return top left point of rectangle.

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

Return top right point of rectangle.

UINT32 LRECT2D::GetWidth (  )  const [inline]

Return width (X size) of rectangle.

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

Read rectangle from INI file.

Reimplemented in LRECT3D.

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

Read rectangle from INI file.

Reimplemented in LRECT3D.

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

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

Reimplemented in LRECT3D.

bool LRECT2D::IsNonEmpty (  )  const [inline]

Check if rectangle is non-empty (has positive area).

bool LRECT2D::IsValid (  )  const [inline]

Check if rectangle is valid.

Reimplemented in LRECT3D.

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

Limit point (DPOINT2D) to extents specified by rectangle.

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

Limit point (LPOINT2D) to extents specified by rectangle.

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

Check if rectangle overlaps.

Reimplemented in LRECT3D.

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

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

Reimplemented in LRECT3D.

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.

Reimplemented in LRECT3D.

void LRECT2D::SwapBytes (  )  [inline]

Perform byte-order swapping.

Reimplemented in LRECT3D.


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:33:33 2012 for TNTsdk 2012 by  doxygen 1.6.1