LRECT2D Struct Reference

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

#include <rect.h>

List of all members.

Public Member Functions

 LRECT2D ()
 LRECT2D (INT32 xsize, INT32 ysize)
 LRECT2D (INT32 xi, INT32 yi, INT32 xl, INT32 yl)
bool Contains (INT32 x, INT32 y) const
bool Contains (const LPOINT2D &pt) const
bool Contains (const LRECT2D &rhs) const
void Expand (const INT32 value)
void Expand (const INT32 xval, const INT32 yval)
void Extend (const LRECT2D &rect)
void Extend (const LPOINT2D &pt)
void Extend (const INT32 xval, const INT32 yval)
INT32 GetArea () const
void GetBottomLeft (LPOINT2D &ret) const
void GetBottomRight (LPOINT2D &ret) const
DPOINT2D GetCenter () const
void GetCenter (DPOINT2D &ret) 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 (LPOINT2D &point) const
void Limit (DPOINT2D &point) const
bool Overlaps (const LRECT2D &rhs) const
void Set (INT32 x1, INT32 y1, INT32 x2, INT32 y2)
void SetInvalid ()
void SwapBytes ()
 CHECKSIZE (16)

Public Attributes

INT32 xinit
INT32 yinit
INT32 xlast
INT32 ylast


Detailed Description

2D rectangle using 32-bit integer coordinates.

Definition at line 180 of file rect.h.


Constructor & Destructor Documentation

LRECT2D::LRECT2D  )  [inline]
 

Default constructor, initializes to invalid (empty) rectangle.

Definition at line 188 of file rect.h.

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

Construct rectangle of specified size.

Definition at line 192 of file rect.h.

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

Construction from X/Y ranges.

Definition at line 198 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 217 of file rect.h.

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

Check if contains specified point.

Definition at line 212 of file rect.h.

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

Check if contains specified point.

Definition at line 206 of file rect.h.

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

Expand the rectangle by 'value' amount.

Definition at line 227 of file rect.h.

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

Expand the rectangle by 'value' amount.

Definition at line 222 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 253 of file rect.h.

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

Extend rectangle to include specified LPOINT2D point.

Definition at line 243 of file rect.h.

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

Extend rectangle to encompass both rectangles.

Definition at line 233 of file rect.h.

INT32 LRECT2D::GetArea  )  const [inline]
 

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

Definition at line 264 of file rect.h.

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

Return bottom left corner.

Definition at line 268 of file rect.h.

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

Get bottom right corner.

Definition at line 273 of file rect.h.

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

Get center point of rectangle.

Definition at line 282 of file rect.h.

DPOINT2D LRECT2D::GetCenter  )  const [inline]
 

Return center point of rectangle.

Definition at line 278 of file rect.h.

void LRECT2D::GetCorners LPOINT2D corners,
bool  ClosePoly = false,
bool  OrientCCW = false
const
 

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).

Definition at line 294 of file rect.h.

UINT32 LRECT2D::GetHeight  )  const [inline]
 

Return height (Y size) of rectangle.

Definition at line 303 of file rect.h.

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

Get size of rectangle.

Definition at line 307 of file rect.h.

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

Return top left point of rectangle.

Definition at line 312 of file rect.h.

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

Return top right point of rectangle.

Definition at line 317 of file rect.h.

UINT32 LRECT2D::GetWidth  )  const [inline]
 

Return width (X size) of rectangle.

Definition at line 322 of file rect.h.

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

Read rectangle from INI file.

Definition at line 326 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 333 of file rect.h.

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

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

Definition at line 340 of file rect.h.

bool LRECT2D::IsValid  )  const [inline]
 

Check if rectangle is valid.

Definition at line 356 of file rect.h.

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

Limit point (DPOINT2D) to extents specified by rectangle.

Definition at line 368 of file rect.h.

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

Limit point (LPOINT2D) to extents specified by rectangle.

Definition at line 360 of file rect.h.

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

Check if rectangle overlaps.

Definition at line 376 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 383 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 394 of file rect.h.

void LRECT2D::SwapBytes  )  [inline]
 

Perform byte-order swapping.

Definition at line 398 of file rect.h.


Member Data Documentation

INT32 LRECT2D::xinit
 

Minimum X coordinate (inclusive).

Definition at line 182 of file rect.h.

INT32 LRECT2D::xlast
 

Maximum X coordinate (inclusive).

Definition at line 184 of file rect.h.

INT32 LRECT2D::yinit
 

Minimum Y coordinate (inclusive).

Definition at line 183 of file rect.h.

INT32 LRECT2D::ylast
 

Maximum Y coordinate (inclusive).

Definition at line 185 of file rect.h.


The documentation for this struct was generated from the following file:
Generated on Thu Aug 12 06:26:55 2004 for TNTsdk by doxygen 1.3.4-20031026