This class defines a rectangle in the drawing plane.
![]() | PRect ( PORDINATE x = 0, PORDINATE y = 0, PDIMENSION dx = 0, PDIMENSION dy = 0 ) Create a rectangle given the top left corner and width and height. |
![]() | PRect ( const PDim & dim ) Create a rectangle at 0,0 and the dimensions specified. |
![]() | PRect ( const PPoint & p1, const PPoint & p2 ) Create a rectangle given the 2 points as opposite corners. |
![]() | PRect ( const PPoint & topLeft, const PDim & dim ) Create a rectangle given the top left corner and dimensions. |
![]() | Clone () const Create a new copy of the rectangle. |
![]() | Compare ( const PObject & obj ) const Determine if the two rectangles are identical. |
![]() | Top () const Get the top side of the rectangle. |
![]() | Left () const Get the left side of the rectangle. |
![]() | Bottom () const Get the bottom side of the rectangle. |
![]() | Right () const Get the right side of the rectangle. |
![]() | X () const Get the horizontal position of the origin of the rectangle. |
![]() | Y () const Get the vertical position of the origin of the rectangle. |
![]() | Width () const Get the horizontal dimension of the rectagle. |
![]() | Height () const Get the vertical dimension of the rectagle. |
![]() | SetTop ( PORDINATE top ) Set the Y value of the top of the rectagle. |
![]() | SetLeft ( PORDINATE left ) Set the X value of the left of the rectagle. |
![]() | SetBottom ( PORDINATE bottom ) Set the Y value of the bottom of the rectagle. |
![]() | SetRight ( PORDINATE right ) Set the X value of the right of the rectagle. |
![]() | SetX ( PORDINATE x ) Set the X value of the left of the rectagle. |
![]() | SetY ( PORDINATE ny ) Set the Y value of the top of the rectagle. |
![]() | SetWidth ( PDIMENSION dx ) Set the width of the rectagle. |
![]() | SetHeight ( PDIMENSION dy ) Set the height of the rectagle. |
![]() | Origin () const Get the origin or top left corner of the rectangle. |
![]() | Corner () const Get the bottom right corner of the rectangle. |
![]() | Centre () const Get the coordinates of the centre of the rectangle. |
![]() | Dimensions () const Get the width and height of the rectangle. |
![]() | SetOrigin ( PORDINATE nx, PORDINATE ny ) Set the top left corner of the rectangle. |
![]() | SetCorner ( PORDINATE nx, PORDINATE ny ) Set the top left corner of the rectangle. |
![]() | SetDimensions ( PDIMENSION dx, PDIMENSION dy ) Set the width and height of the rectangle. |
![]() | IsEmpty () const Determine if the width and height of the rectangle are zero. |
![]() | Inflate ( PORDINATE dx, PORDINATE dy ) Increase the size of the rectangle by expanding in all four directions by the amount specified. |
![]() | Offset ( PORDINATE dx, PORDINATE dy ) Move the rectangle the specified delta amount. |
![]() | ContainsPoint (const PPoint & pt) const Determine if the point is contained within the bounds of the rectangle. |
![]() | Intersection (const PRect & rect) const Calculate the rectangle that is the intersection of the object and the specified rectangle. |
![]() | Union (const PRect & rect) const Calculate the rectangle that is the union of the object and the specified rectangle. |
![]() | Overrides from class PObject |
![]() | New functions for class |
Run Time Type functions
Comparison functions
I/O functions
Miscellaneous functions
This class defines a rectangle in the drawing plane. A rectangle is defined by two points on the plane. A rectangle is always "normalised". That is the left is always less then the right and the top is always less than the bottom.
PRect( const PDim & dim )
PRect( const PPoint & p1, const PPoint & p2 )
p2 - Second, opposite, corner of rectangle. PRect( const PPoint & topLeft, const PDim & dim )
dim - Dimensions of the rectangle. Overrides from class PObject
virtual PObject* Clone() const
virtual Comparison Compare( const PObject & obj ) const
New functions for class
PORDINATE Top() const
PORDINATE Left() const
PORDINATE Bottom() const
PORDINATE Right() const
PORDINATE X() const
PORDINATE Y() const
PDIMENSION Width() const
PDIMENSION Height() const
void SetTop( PORDINATE top )
void SetLeft( PORDINATE left )
void SetBottom( PORDINATE bottom )
void SetRight( PORDINATE right )
void SetX( PORDINATE x )
void SetY( PORDINATE ny )
void SetWidth( PDIMENSION dx )
void SetHeight( PDIMENSION dy )
PPoint Origin() const
PPoint Corner() const
PPoint Centre() const
PDim Dimensions() const
void SetOrigin( PORDINATE nx, PORDINATE ny )
ny - New y position for the rectangle.void SetCorner( PORDINATE nx, PORDINATE ny )
ny - New y position for bottom right corner of the rectangle.void SetDimensions( PDIMENSION dx, PDIMENSION dy )
dy - New height for rectangle.BOOL IsEmpty() const
void Inflate( PORDINATE dx, PORDINATE dy )
dy - Amount to increase the vertical.void Offset( PORDINATE dx, PORDINATE dy )
dy - Amount to move the rectangle vertically.BOOL ContainsPoint(const PPoint & pt) const
PRect Intersection(const PRect & rect) const
PRect Union(const PRect & rect) const
Alphabetic index HTML hierarchy of classes or Java