class XRect

Geometrical two-dimensional rectangle

Public Fields

[more]XPoint a
Upper left corner
[more]XPoint b
Lower right corner

Public Methods

[more] XRect()
Constructs a clean rectangle with the corners a(0, 0), b(0, 0)
[more] XRect(unsigned __xa, unsigned __ya, unsigned __xb, unsigned __yb)
Constructs a new point with the corners a(__xa, __ya), b(__xb, __yb)
[more] XRect(XPoint __a, XPoint __b)
Constructs a new point with the specified corners
[more]void Assign(XPoint __a, XPoint __b)
Assigns the specified corners to the rectangle
[more]void Assign(unsigned __xa, unsigned __ya, unsigned __xb, unsigned __yb)
Assigns the specified coordinates to the rectangle
[more]void Move(XPoint __delta)
Moves the rectangle relatively by the specified coordinates
[more]void Grow(XPoint __delta)
Grows the rectangle by adjusting the lower-right corner with the specified coordinates
[more]void Intersect(XRect __r)
Assigns the rectangle the intersection with another rectangle
[more]bool IsValid()
Checks if the coordinates can form a rectangle
[more]void Union(XRect __r)
Assigns the rectangle the union with another rectangle
[more]bool Contains(XPoint __p)
Returns true if the rectangle contains the specified point
[more]XRect& operator = (XRect __r)
Assigns the rectangle the corners of the specified rectangle
[more]bool operator == (XRect __r)
Compares to rectangles and returns true if they are equal
[more]bool operator != (XRect __r)
Compares to rectangles and returns false if they are equal
[more]XRect& operator += (XPoint __delta)
Positively translates the rectangle by adjusting the lower-right corner with the specified coordinates
[more]XRect& operator -= (XPoint __delta)
Negatively translates the rectangle by adjusting the lower-right corner with the specified coordinates


Documentation

The XRect class is the two dimensional representation of a geometrical rectangle with the upper left corner a and the lower left corner b. Methods to assign corners and operators for mathematical calculation are included.
oXPoint a
Upper left corner

oXPoint b
Lower right corner

o XRect()
Constructs a clean rectangle with the corners a(0, 0), b(0, 0)

o XRect(unsigned __xa, unsigned __ya, unsigned __xb, unsigned __yb)
Constructs a new point with the corners a(__xa, __ya), b(__xb, __yb)
Parameters:
__xa - x and
__ya - y coordinate of upper left corner
__xb - x and
__yb - y coordinate of lower right corner

o XRect(XPoint __a, XPoint __b)
Constructs a new point with the specified corners
Parameters:
__a - upper left corner
__b - lower right corner

ovoid Assign(XPoint __a, XPoint __b)
Assigns the specified corners to the rectangle
Parameters:
__a - upper left corner
__b - lower right corner

ovoid Assign(unsigned __xa, unsigned __ya, unsigned __xb, unsigned __yb)
Assigns the specified coordinates to the rectangle
Parameters:
__xa - x and
__ya - y coordinate of upper left corner
__xb - x and
__yb - y coordinate of lower right corner

ovoid Move(XPoint __delta)
Moves the rectangle relatively by the specified coordinates
Parameters:
__delta - translation vector

ovoid Grow(XPoint __delta)
Grows the rectangle by adjusting the lower-right corner with the specified coordinates
Parameters:
__delta - translation vector

ovoid Intersect(XRect __r)
Assigns the rectangle the intersection with another rectangle
Parameters:
__r - other rectangle

obool IsValid()
Checks if the coordinates can form a rectangle
Parameters:
true - if coordinates are valid

ovoid Union(XRect __r)
Assigns the rectangle the union with another rectangle
Parameters:
__r - other rectangle

obool Contains(XPoint __p)
Returns true if the rectangle contains the specified point
Returns:
true if point in rectangle
Parameters:
__p - point

oXRect& operator = (XRect __r)
Assigns the rectangle the corners of the specified rectangle
Returns:
assigned rectangle
Parameters:
__r - value to assign

obool operator == (XRect __r)
Compares to rectangles and returns true if they are equal
Returns:
true if equal
Parameters:
__r - right operand

obool operator != (XRect __r)
Compares to rectangles and returns false if they are equal
Returns:
false if equal
Parameters:
__r - right operand

oXRect& operator += (XPoint __delta)
Positively translates the rectangle by adjusting the lower-right corner with the specified coordinates
Returns:
translated rectangle
Parameters:
__delta - translation vector

oXRect& operator -= (XPoint __delta)
Negatively translates the rectangle by adjusting the lower-right corner with the specified coordinates
Returns:
translated rectangle
Parameters:
__delta - translation vector


This class has no child classes.

Go to the hierarchy of classes.


Copyright ©1998 Bernd Kalbfuss
Last update on October 27, 2001

This page was generated with the help of DOC++.