TMCRealRect Class Reference

Inheritance diagram for TMCRealRect:

ShRect List of all members.

Public Member Functions

 TMCRealRect (void)
 TMCRealRect (const real l, const real t, const real r, const real b)
real L (void) const
real T (void) const
real R (void) const
real B (void) const
void CenterInside (const TMCRealRect &inRect)
boolean EqualDimensions (const TMCRealRect &inRect) const
boolean Empty (void) const
boolean Invalid (void) const
boolean Equal (const TMCRealRect &inRect) const
real GetWidth (void) const
real GetHeight (void) const
TVector2 GetCenter (void) const
real GetArea (void) const
void Inset (const real dx, const real dy)
boolean Intersect (const TMCRealRect &inRect, const boolean inSetEmpty=1)
void Offset (const real dx, const real dy)
void Proportion (const TMCRealRect &inRect)
void PtToRect (const TVector2 &pt1, const TVector2 &pt2)
boolean PtInside (const TVector2 &inPt) const
TVector2 PinPoint (const TVector2 &inPt) const
boolean RectInside (const TMCRealRect &inRect) const
boolean RectInRect (const TMCRealRect &inRect) const
void Scale (const float inScale)
void Set (const real l, const real t, const real r, const real b)
void SetEmpty (void)
void SetInvalid (void)
void Union (const TMCRealRect &inRect)
void UnionPt (const TVector2 &inPt)
void ConvertIntToFloat (const TMCRect &inIntegerRect)
void ConvertFromIntRect (const TMCRect &inIntegerRect)
void InitIntFromFloat (TMCRect &inIntegerRect)
boolean operator== (const TMCRealRect &rr) const
boolean operator!= (const TMCRealRect &rr) const
TMCRealRect & operator= (const int32 i)

Static Public Attributes

const TMCRealRect kZero
 (0, 0, 0, 0);
const TMCRealRect kEmpty
 (0, 0, 0, 0);
const TMCRealRect kInvalid
 (FLT_MAX, FLT_MAX, FLT_MIN, FLT_MIN);

Detailed Description

A rectangle class that uses floating point numbers instead of integers like TMCRect.
Note:


Constructor & Destructor Documentation

TMCRealRect::TMCRealRect (  void   )  [inline]
 

TMCRealRect::TMCRealRect (  const real  l,
const real  t,
const real  r,
const real  b
)  [inline]
 


Member Function Documentation

real TMCRealRect::B (  void   )  const [inline]
 

void TMCRealRect::CenterInside (  const TMCRealRect &  inRect  ) 
 

Positions "centerRect" at the center of srcRect.

void TMCRealRect::ConvertFromIntRect (  const TMCRect &  inIntegerRect  ) 
 

Convert the passed in integer rect to an floating point rect.

void TMCRealRect::ConvertIntToFloat (  const TMCRect &  inIntegerRect  ) 
 

NOTE: This function is going away please use ConvertFromIntRect() Convert the passed in integer rect to an floating point rect.

boolean TMCRealRect::Empty (  void   )  const
 

Return TRUE if the rectangle has no width or height.

boolean TMCRealRect::Equal (  const TMCRealRect &  inRect  )  const
 

Compare the components of the two rectangles and return TRUE if they are all the same.

boolean TMCRealRect::EqualDimensions (  const TMCRealRect &  inRect  )  const
 

Compare the components of the two rectangles and return TRUE if they are the same width and height.

real TMCRealRect::GetArea (  void   )  const
 

Calculate and return the area of the rectangle.

TVector2 TMCRealRect::GetCenter (  void   )  const
 

Calculate and return the center of the rectangle.

real TMCRealRect::GetHeight (  void   )  const [inline]
 

Calculate and return the height of the rectangle. May return a negative width.

real TMCRealRect::GetWidth (  void   )  const [inline]
 

Calculate and return the width of the rectangle. May return a negative width.

void TMCRealRect::InitIntFromFloat (  TMCRect &  inIntegerRect  ) 
 

Fill out the passed in integer rect according to this floating point rect.

void TMCRealRect::Inset (  const real  dx,
const real  dy
) 
 

InsetRect shrinks or expands the rectangle. The left and right sides are moved by dx; the top and bottom sides are moved by dy. Note: The rectangle is not set to an empty rect (0,0,0,0) if the resulting width or height is less than zero.

boolean TMCRealRect::Intersect (  const TMCRealRect &  inRect,
const boolean  inSetEmpty = 1
) 
 

Intersect calculates the rectangle that is the intersection of "this" and the input rectangle, and returns TRUE if they indeed intersect or FALSE if they do not. If the rectangles do not intersect, the rect is set either empty or invalid based on the "inSetEmpty" flag.

boolean TMCRealRect::Invalid (  void   )  const
 

Return TRUE if either the horizontal or vertical bounds are invalid

real TMCRealRect::L (  void   )  const [inline]
 

void TMCRealRect::Offset (  const real  dx,
const real  dy
) 
 

Offset moves the rectangle by adding dx to the horizontal coordinates, and adding dy to the vertical coordinates.

boolean TMCRealRect::operator!= (  const TMCRealRect &  rr  )  const [inline]
 

TMCRealRect& TMCRealRect::operator= (  const int32  i  )  [inline]
 

boolean TMCRealRect::operator== (  const TMCRealRect &  rr  )  const [inline]
 

TVector2 TMCRealRect::PinPoint (  const TVector2 &  inPt  )  const
 

Pin the passed in point to within the rectangle and return the resulting point.

void TMCRealRect::Proportion (  const TMCRealRect &  inRect  ) 
 

Proportionally map src rect into dst. Warning: zero width or zero height rects are dangerous.

boolean TMCRealRect::PtInside (  const TVector2 &  inPt  )  const
 

PtInside determines whether a point is enclosed within the specified rectangle, and returns TRUE if so and FALSE if not.

void TMCRealRect::PtToRect (  const TVector2 &  pt1,
const TVector2 &  pt2
) 
 

PtToRect returns the smallest rectangle which encloses the two input points.

real TMCRealRect::R (  void   )  const [inline]
 

boolean TMCRealRect::RectInRect (  const TMCRealRect &  inRect  )  const
 

Note: similar to above, but ignores empty rects.

This routine interprets rectangles in the same way that QD does. A rectangle will hit if any of the bits in the bitmap it encloses overlap with any of the bits in the bitmap enclosed by the other rectangle.

boolean TMCRealRect::RectInside (  const TMCRealRect &  inRect  )  const
 

RectInside determines whether a rectangle is enclosed within a second rectangle, and returns TRUE if so and FALSE if not.

void TMCRealRect::Scale (  const float  inScale  ) 
 

Scales each term.

void TMCRealRect::Set (  const real  l,
const real  t,
const real  r,
const real  b
)  [inline]
 

Set assigns the four boundary coordinates to a rectangle. The result is a rectangle with coordinates (left,top,right,bottom).

void TMCRealRect::SetEmpty (  void   ) 
 

Set the rectangle to no width or height.

void TMCRealRect::SetInvalid (  void   ) 
 

Set the rectangle to have negative width or height. This is useful for initializing a rectangle to be the union of a set of rectangles

real TMCRealRect::T (  void   )  const [inline]
 

void TMCRealRect::Union (  const TMCRealRect &  inRect  ) 
 

Union calculates the smallest rectangle which encloses both input rectangles.

void TMCRealRect::UnionPt (  const TVector2 &  inPt  ) 
 

UnionPt expands the input rectangle to enclose the input point. If the point is already within the rectangle, nothing is changed.


Member Data Documentation

real TMCRealRect::b
 

real TMCRealRect::bottom
 

real TMCRealRect::fBottom
 

real TMCRealRect::fLeft
 

real TMCRealRect::fRight
 

real TMCRealRect::fTop
 

const TMCRealRect TMCRealRect::kEmpty [static]
 

(0, 0, 0, 0);

const TMCRealRect TMCRealRect::kInvalid [static]
 

(FLT_MAX, FLT_MAX, FLT_MIN, FLT_MIN);

const TMCRealRect TMCRealRect::kZero [static]
 

(0, 0, 0, 0);

real TMCRealRect::l
 

real TMCRealRect::left
 

real TMCRealRect::r
 

real TMCRealRect::right
 

real TMCRealRect::t
 

real TMCRealRect::top
 


The documentation for this class was generated from the following file:
Generated on Mon Mar 14 12:29:09 2005 for Carrara SDK Doc by  doxygen 1.3.9.1