DRECT2D Struct Reference

2D rectangle using 'double' precision coordinates. More...

#include <mi32/rect.h>

Inheritance diagram for DRECT2D:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 CHECKSIZE (32)
void ClipTo (const DRECT2D &rect)
bool ComputeEdgePoint (const DPOINT2D &OutsidePt, DPOINT2D &EdgePt) const
bool Contains (const DRECT2D &rhs) const
bool Contains (const DPOINT2D &pt) const
bool Contains (double x, double y) const
 DRECT2D (const LRECT2D &rect)
 DRECT2D (double xi, double yi, double xl, double yl)
 DRECT2D (const DPOINT2D &pt1, const DPOINT2D &pt2)
 DRECT2D (const DPOINT2D &pt)
 DRECT2D (const FPOINT2D &pt)
 DRECT2D ()
void Expand (const double xval, const double yval)
void Expand (const double value)
void Extend (const DPOINT2D &pt)
void Extend (const DRECT2D &rect)
void Extend (const double xval, const double yval)
double GetArea () const
void GetBottomLeft (DPOINT2D &ret) const
void GetBottomRight (DPOINT2D &ret) const
void GetCenter (DPOINT2D &ret) const
DPOINT2D GetCenter () const
void GetCorners (DPOINT3D *corners, bool ClosePoly=false, bool OrientCCW=false) const
void GetCorners (DPOINT2D *corners, bool ClosePoly=false, bool OrientCCW=false) const
int GetDimension () const
double GetDistance (const DRECT2D &rect) const
double GetHeight () const
double GetMaxDistance (const DRECT2D &rect) const
double GetMaxDistanceSquared (const DRECT2D &rect) const
void GetRect (LRECT2D &rect) const
void GetRectTruncate (LRECT2D &rect) const
void GetSize (DPOINT2D &ret) const
void GetTopLeft (DPOINT2D &ret) const
void GetTopRight (DPOINT2D &ret) const
double GetWidth () const
bool IniRead (INIHANDLE IniHandle, const char *IniGroup, const char *IniName, const DRECT2D &dft)
bool IniRead (INIHANDLE IniHandle, const char *IniGroup, const char *IniName)
void IniWrite (INIHANDLE IniHandle, const char *IniGroup, const char *IniName) const
void Intersect (const DRECT2D &rect)
bool IsEquivalentTo (const DRECT2D &rhs, double threshold=0.0) const
bool IsValid () const
void Limit (DPOINT2D &point) const
DRECT2Doperator= (const LRECT2D &rhs)
DRECT2Doperator= (const DPOINT2D &pt)
bool Overlaps (const DRECT2D &rhs) const
void Set (double x1, double y1, double x2, double y2)
void SetInvalid ()
void SwapBytes ()

Public Attributes

double xinit
double xlast
double yinit
double ylast

Detailed Description

2D rectangle using 'double' precision coordinates.

Definition at line 453 of file rect.h.


Constructor & Destructor Documentation

DRECT2D::DRECT2D  )  [inline]
 

Default constructor, initialize to "invalid" area.

Definition at line 461 of file rect.h.

DRECT2D::DRECT2D const FPOINT2D pt  )  [inline]
 

Construct from FPOINT2D (or FPOINT3D).

Definition at line 466 of file rect.h.

DRECT2D::DRECT2D const DPOINT2D pt  )  [inline]
 

Construct from DPOINT2D (or DPOINT3D).

Definition at line 471 of file rect.h.

DRECT2D::DRECT2D const DPOINT2D pt1,
const DPOINT2D pt2
[inline]
 

Construct from two DPOINT2D's (or DPOINT3D's).

A regular ctor from DPOINT2D and then a call to ::Extend(DPOINT2D&) would use 6 assignments and 4 comparisons, this uses 2 compares and 4 assignments

Definition at line 478 of file rect.h.

DRECT2D::DRECT2D double  xi,
double  yi,
double  xl,
double  yl
[inline]
 

Definition at line 500 of file rect.h.

DRECT2D::DRECT2D const LRECT2D rect  )  [inline]
 

Implicit conversion from LRECT2D.

Definition at line 508 of file rect.h.


Member Function Documentation

DRECT2D::CHECKSIZE 32   ) 
 

Make compiler validate structure size.

void DRECT2D::ClipTo const DRECT2D rect  )  [inline]
 

Clip this rectangle to specified rectangle.

Definition at line 523 of file rect.h.

bool DRECT2D::ComputeEdgePoint const DPOINT2D OutsidePt,
DPOINT2D EdgePt
const [inline]
 

Given the center point of the DRECT2D and the 'TestPt' which is outside the box, compute the point on the edge of the box which falls between the center point and the 'TestPt'.

Returns:
'true' if the point is found, false if the 'TestPt' is inside the box or the box is invalid
Parameters:
OutsidePt  Point outside of 'this'
EdgePt  Point on the rectangle edge RETURNED if 'true' returned, center of the box if 'false' is returned

Definition at line 537 of file rect.h.

bool DRECT2D::Contains const DRECT2D rhs  )  const [inline]
 

Check if contains specified point.

Definition at line 554 of file rect.h.

bool DRECT2D::Contains const DPOINT2D pt  )  const [inline]
 

Check if contains specified point.

Definition at line 549 of file rect.h.

bool DRECT2D::Contains double  x,
double  y
const [inline]
 

Check if contains specified point.

Definition at line 543 of file rect.h.

void DRECT2D::Expand const double  xval,
const double  yval
[inline]
 

Expand the rectangle by 'value' amount.

Reimplemented in DRECT3D.

Definition at line 564 of file rect.h.

void DRECT2D::Expand const double  value  )  [inline]
 

Expand the rectangle by 'value' amount.

Reimplemented in DRECT3D.

Definition at line 559 of file rect.h.

void DRECT2D::Extend const DPOINT2D pt  )  [inline]
 

Extend rectangle to include specified DPOINT2D point.

Reimplemented in DRECT3D.

Definition at line 593 of file rect.h.

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

Extend rectangle to encompass both rectangles.

Definition at line 582 of file rect.h.

void DRECT2D::Extend const double  xval,
const double  yval
[inline]
 

Extend rectangle to include specified X,Y point.

Reimplemented in DRECT3D.

Definition at line 570 of file rect.h.

double DRECT2D::GetArea  )  const [inline]
 

Compute area of rectangle.

Definition at line 604 of file rect.h.

void DRECT2D::GetBottomLeft DPOINT2D ret  )  const [inline]
 

Return bottom left point of rectangle.

Definition at line 608 of file rect.h.

void DRECT2D::GetBottomRight DPOINT2D ret  )  const [inline]
 

Return bottom right point of rectangle.

Definition at line 613 of file rect.h.

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

Return center point of rectangle.

Definition at line 622 of file rect.h.

DPOINT2D DRECT2D::GetCenter  )  const [inline]
 

Return center point of rectangle.

Reimplemented in DRECT3D.

Definition at line 618 of file rect.h.

void DRECT2D::GetCorners DPOINT3D 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 634 of file rect.h.

void DRECT2D::GetCorners DPOINT2D 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 627 of file rect.h.

int DRECT2D::GetDimension  )  const [inline]
 

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

Reimplemented in DRECT3D.

Definition at line 641 of file rect.h.

double DRECT2D::GetDistance const DRECT2D rect  )  const [inline]
 

Compute the distance between two disjoint rectangles.

Returns:
Distance between two disjoint rectangles, 0.0 if they overlap.

Definition at line 651 of file rect.h.

double DRECT2D::GetHeight  )  const [inline]
 

Return height of rectangle.

Definition at line 656 of file rect.h.

double DRECT2D::GetMaxDistance const DRECT2D rect  )  const [inline]
 

Compute the maximum distance between two rectangles Uses Extend() and then computes the diagonal distance.

Returns:
Max distance between two rectangles

Definition at line 662 of file rect.h.

double DRECT2D::GetMaxDistanceSquared const DRECT2D rect  )  const [inline]
 

Compute the maximum distance between two rectangles Uses Extend() and then computes the diagonal distance.

Returns:
Max distance between two rectangles

Definition at line 669 of file rect.h.

void DRECT2D::GetRect LRECT2D rect  )  const [inline]
 

Get the rectangle as an LRECT2D (with rounding).

Definition at line 674 of file rect.h.

void DRECT2D::GetRectTruncate LRECT2D rect  )  const [inline]
 

Get the rectangle as an LRECT2D (with truncating towards 0).

Definition at line 685 of file rect.h.

void DRECT2D::GetSize DPOINT2D ret  )  const [inline]
 

Get size of rectangle.

Definition at line 696 of file rect.h.

void DRECT2D::GetTopLeft DPOINT2D ret  )  const [inline]
 

Return top left point of rectangle.

Definition at line 701 of file rect.h.

void DRECT2D::GetTopRight DPOINT2D ret  )  const [inline]
 

Return top right point of rectangle.

Definition at line 706 of file rect.h.

double DRECT2D::GetWidth  )  const [inline]
 

Return width of rectangle.

Definition at line 711 of file rect.h.

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

Read rectangle from INI file with default.

Definition at line 722 of file rect.h.

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

Read rectangle from INI file.

Reimplemented in DRECT3D.

Definition at line 715 of file rect.h.

void DRECT2D::IniWrite INIHANDLE  IniHandle,
const char *  IniGroup,
const char *  IniName
const [inline]
 

Read rectangle from INI file.

Reimplemented in DRECT3D.

Definition at line 730 of file rect.h.

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

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

Definition at line 737 of file rect.h.

bool DRECT2D::IsEquivalentTo const DRECT2D rhs,
double  threshold = 0.0
const [inline]
 

Determine if the two rectangles are equivalent This method uses "Fuzzy" edge comparisons Specify a different threshold to allow greater distances.

Returns:
'True' if they are, 'False' if not
Parameters:
threshold  Default threshold is max absolute value of rectangle coordinate * 1.0E-13

Definition at line 756 of file rect.h.

bool DRECT2D::IsValid  )  const [inline]
 

Check if rectangle is valid.

Reimplemented in DRECT3D.

Definition at line 762 of file rect.h.

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

Limit point to extents specified by rectangle.

Definition at line 766 of file rect.h.

DRECT2D& DRECT2D::operator= const LRECT2D rhs  )  [inline]
 

Assignment from LRECT2D.

Definition at line 518 of file rect.h.

DRECT2D& DRECT2D::operator= const DPOINT2D pt  )  [inline]
 

Assignment from DPOINT2D.

Definition at line 513 of file rect.h.

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

Check if rectangle overlaps.

Definition at line 775 of file rect.h.

void DRECT2D::Set double  x1,
double  y1,
double  x2,
double  y2
[inline]
 

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

Reimplemented in DRECT3D.

Definition at line 780 of file rect.h.

void DRECT2D::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 DRECT3D.

Definition at line 791 of file rect.h.

void DRECT2D::SwapBytes  )  [inline]
 

Perform byte-order swapping.

Reimplemented in DRECT3D.

Definition at line 795 of file rect.h.


Member Data Documentation

double DRECT2D::xinit
 

Minimum X coordinate (inclusive).

Definition at line 455 of file rect.h.

double DRECT2D::xlast
 

Maximum X coordinate (inclusive).

Definition at line 457 of file rect.h.

double DRECT2D::yinit
 

Minimum Y coordinate (inclusive).

Definition at line 456 of file rect.h.

double DRECT2D::ylast
 

Maximum Y coordinate (inclusive).

Definition at line 458 of file rect.h.


The documentation for this struct was generated from the following file:
Generated on Tue Dec 14 13:19:42 2004 for TNTsdk by  doxygen 1.3.8-20040913