Pixel Dust Game Engine  v0.9.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | Public Attributes | List of all members
RotatedRectT Class Reference
Inheritance diagram for RotatedRectT:
Inheritance graph
[legend]
Collaboration diagram for RotatedRectT:
Collaboration graph
[legend]

Public Member Functions

void setCenterOffset (const PointT< T > &centerPtOffset)
 
void setRotation (float rotationRadians)
 
void setRotation (float rotationRadians, const PointT< T > &centerPtOffset)
 
void rotate (float rotateRadians)
 
QuadT< T > getQuad () const
 
RectT< T > getBounds () const
 
 operator QuadT< T > ()
 
 RotatedRectT ()
 create a rotated rect from an unrotated rect, along with a rotation in radians and an optional center point offset
 
 RotatedRectT (const RectT< T > &r, float rotationRadians=0.0f, const OffsetT< T > &centerPtOffset=OffsetT< T >(0, 0))
 
- Public Member Functions inherited from RectT< T >
bool empty () const
 return true if this rectangle is empty (no width or no height)
 
bool contains (const PointT< T > &p) const
 return true if the point is inside this rectangle
 
bool contains (const RectT< T > &r) const
 return true if the rectangle passed in is entirely inside this rectangle
 
bool overlaps (const RectT< T > &r) const
 return true if this rectangle overlaps the other rectangle at all (sharing an edge is not overlapping)
 
PointT< T > leftTop () const
 get the top left corner point of the rectangle
 
PointT< T > rightTop () const
 get the top right corner point of the rectangle
 
PointT< T > leftBottom () const
 get the bottom left corner point of the rectangle
 
PointT< T > rightBottom () const
 get the bottom right corner point of the rectangle
 
PointT< T > centerPoint () const
 get the center point of the rectangle, rounds down if fractional
 
x1 () const
 get the 1st x coordinate (leftmost)
 
y1 () const
 get the 1st y coordinate (topmost)
 
x2 () const
 get the 2nd x coordinate (rightmost)
 
y2 () const
 get the 2nd y coordinate (bottom-most)
 
width () const
 get the width of the rectangle
 
height () const
 get the height of the rectangle
 
RectT< T > intersection (const RectT< T > &r) const
 get a new rectangle that is the overlapping area of the the rectangles
 
RectT< T > unionWith (const RectT< T > &r) const
 get the smallest possible new rectangle that contains both rectangles
 
RectT< T > & moveLeft (T delta)
 move the rectangle to the left by some amount
 
RectT< T > & moveRight (T delta)
 move the rectangle to the right by some amount
 
RectT< T > & moveUp (T delta)
 move the rectangle up by some amount
 
RectT< T > & moveDown (T delta)
 move the rectangle down by some amount
 
RectT< T > & moveXTo (T x)
 move the rectangle to a particular x location, leaving y unchanged
 
RectT< T > & moveYTo (T y)
 move the rectangle to a particular y location, leaving x unchanged
 
RectT< T > & moveTo (T x, T y)
 move the rectangle to a particular (x, y) location
 
RectT< T > & moveTo (PointT< T > p)
 move the rectangle to a particular point
 
RectT< T > & center (PointT< T > p)
 move the rectangle to be centered over a particular point
 
RectT< T > & center (RectT< T > r)
 move the rectangle to be centered within/relative to another rectangle
 
RectT< T > & setSize (T n)
 set the size (width & height) of the rectangle
 
RectT< T > & setWidth (T w)
 set the width of the rectangle
 
RectT< T > & setHeight (T h)
 set the height of the rectangle
 
RectT< T > & horzShrink (T delta)
 reduce the width of the rectangle while leaving the center point unchanged
 
RectT< T > & vertShrink (T delta)
 reduce the height of the rectangle while leaving the center point unchanged
 
RectT< T > & horzGrow (T delta)
 increase the width of the rectangle while leaving the center point unchanged
 
RectT< T > & vertGrow (T delta)
 increase the height of the rectangle while leaving the center point unchanged
 
RectT< T > & shrink (T delta)
 reduce the height and width of the rectangle while leaving the center point unchanged
 
RectT< T > & grow (T delta)
 increase the height and width of the rectangle while leaving the center point unchanged
 
RectT< T > & horzScale (float f)
 change the x coordinates of the rectangle by a multiplier
 
RectT< T > & vertScale (float f)
 change the y coordinates of the rectangle by a multiplier
 
RectT< T > & scale (float f)
 change the coordinates of the rectangle by a multiplier
 
RectT< T > & round ()
 round the coordinates to closest whole number
 
 operator QuadT< T > ()
 
bool operator== (const RectT< T > &r2)
 return true if this rectangle is equal to the other
 
bool operator!= (const RectT< T > &r2)
 return true if this rectangle is not equal to the other
 
RectT< T > & operator= (const RectT< T > &r2)
 set rectangle equal to another
 
RectT< T > & operator+= (const PointT< T > &p1)
 offset this rectangle's location by adding x & y coordinates of the point
 
RectT< T > & operator+= (const RectT< T > &r2)
 add another rectangle to this one by adding coordinates
 
RectT< T > & operator-= (const PointT< T > &p1)
 offset this rectangle's location by subtracting x & y coordinates of the point
 
RectT< T > & operator-= (const RectT< T > &r2)
 subtract another rectangle from this one by subtracting coordinates
 
RectT< T > operator+ (const PointT< T > &p1)
 get a rectangle offset by adding the x & y coordinates of a point
 
RectT< T > operator+ (const RectT< T > &r2)
 add two rectangles together by adding coordinates
 
RectT< T > operator- (const PointT< T > &p1)
 get a rectangle offset by subtracting the x & y coordinates of a point
 
RectT< T > operator- (const RectT< T > &r2)
 subtract one rectangle from another by subtracting coordinates
 
 RectT (T wid, T hgt)
 create a rectangle with origin at (0,0) and set its height and width values
 
 RectT (T lft, T tp, T rgt, T bot)
 create a rectangle with left, top, right, and bottom coordinates (x1, y1, x2, y2) specified
 
 RectT (const PointT< T > &lftTop, const PointT< T > &rgtBot)
 create a rectangle given its top left and bottom right corner points
 
 RectT (const PointT< T > &lftTop, T wid, T hgt)
 create a rectangle given its top teft corner point and a height and width
 
 RectT ()
 create an empty rectangle with origin at (0,0)
 

Public Attributes

float radians
 
OffsetT< T > centerOffset
 
- Public Attributes inherited from RectT< T >
left
 leftmost coordinate of a rectangle on a grid or screen
 
top
 topmost coordinate of a rectangle on a grid or screen
 
right
 rightmost coordinate of a rectangle on a grid or screen
 
bottom
 bottom-most coordinate of a rectangle on a grid or screen
 

Detailed Description

Rectangle with rotation for 2D coordinate system. RotatedRect is a class that provides support for dealing with rotating rectangles in 2 dimensional space.

Constructor & Destructor Documentation

RotatedRectT ( )
inline

create a rotated rect from an unrotated rect, along with a rotation in radians and an optional center point offset

RotatedRectT ( const RectT< T > &  r,
float  rotationRadians = 0.0f,
const OffsetT< T > &  centerPtOffset = OffsetT<T>(0,0) 
)
inline

Member Function Documentation

RectT<T> getBounds ( ) const
inline
QuadT<T> getQuad ( ) const
operator QuadT< T > ( )
inline
void rotate ( float  rotateRadians)
inline
void setCenterOffset ( const PointT< T > &  centerPtOffset)
inline
void setRotation ( float  rotationRadians)
inline
void setRotation ( float  rotationRadians,
const PointT< T > &  centerPtOffset 
)
inline

Member Data Documentation

OffsetT<T> centerOffset
float radians