TMCRealRect Class Reference
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) |
Public Attributes |
union { |
real l |
real left |
real fLeft |
}; | |
union { |
real t |
real top |
real fTop |
}; | |
union { |
real r |
real right |
real fRight |
}; | |
union { |
real b |
real bottom |
real fBottom |
}; | |
Static Public Attributes |
static const TMCRealRect | kZero |
| (0, 0, 0, 0);
|
static const TMCRealRect | kEmpty |
| (0, 0, 0, 0);
|
static 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:
- The member component ordering is: l,t,r,b (x0,y0,x1,y1)
- This class cannot have virtual functions for C size compatability
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.
Compare the components of the two rectangles and return TRUE if they are all the same.
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.
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.
TMCRealRect& TMCRealRect::operator= |
( |
const int32 |
i |
) |
[inline] |
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.
PtInside determines whether a point is enclosed within the specified rectangle, and returns TRUE if so and FALSE if not.
PtToRect returns the smallest rectangle which encloses the two input points.
real TMCRealRect::R |
( |
void |
|
) |
const [inline] |
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.
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 |
) |
|
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] |
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
(FLT_MAX, FLT_MAX, FLT_MIN, FLT_MIN);
The documentation for this class was generated from the following file: