ClanLib
2.3.7
|
2D (left,top,right,bottom) rectangle structure. More...
#include <line.h>
Public Member Functions | |
Construction | |
CL_Rectx () | |
Constructs an rectangle. More... | |
CL_Rectx (const CL_Sizex< Type > &s) | |
Constructs an rectangle. More... | |
CL_Rectx (Type new_left, Type new_top, Type new_right, Type new_bottom) | |
Constructs an rectangle. More... | |
CL_Rectx (const CL_Pointx< Type > &p, const CL_Sizex< Type > &size) | |
Constructs an rectangle. More... | |
CL_Rectx (Type new_left, Type new_top, const CL_Sizex< Type > &size) | |
Constructs an rectangle. More... | |
CL_Rectx (const CL_Rectx< int > &rect) | |
Constructs an rectangle. More... | |
CL_Rectx (const CL_Rectx< float > &rect) | |
Constructs an rectangle. More... | |
CL_Rectx (const CL_Rectx< double > &rect) | |
Constructs an rectangle. More... | |
bool | operator== (const CL_Rectx< Type > &r) const |
Rect == Rect operator. More... | |
bool | operator!= (const CL_Rectx< Type > &r) const |
Rect != Rect operator. More... | |
Operations | |
CL_Rectx< Type > & | set_top_left (const CL_Vec2< Type > &p) |
Sets the top-left point of the rectangle. More... | |
CL_Rectx< Type > & | set_top_right (const CL_Vec2< Type > &p) |
Sets the top-right point of the rectangle. More... | |
CL_Rectx< Type > & | set_bottom_right (const CL_Vec2< Type > &p) |
Sets the bottom-right point of the rectangle. More... | |
CL_Rectx< Type > & | set_bottom_left (const CL_Vec2< Type > &p) |
Sets the bottom-left point of the rectangle. More... | |
CL_Rectx< Type > & | set_width (Type width) |
Sets the width of the rectangle. More... | |
CL_Rectx< Type > & | set_height (Type height) |
Sets the height of the rectangle. More... | |
CL_Rectx< Type > & | shrink (const Type &left, const Type &top, const Type &right, const Type &bottom) |
Shrink the rectangle. More... | |
CL_Rectx< Type > & | shrink (const Type &left_right, const Type &top_bottom) |
Shrink the rectangle. More... | |
CL_Rectx< Type > & | shrink (const Type &shrink) |
Shrink the rectangle. More... | |
CL_Rectx< Type > & | expand (const Type &left, const Type &top, const Type &right, const Type &bottom) |
Expand the rectangle. More... | |
CL_Rectx< Type > & | expand (const Type &left_and_right, const Type &top_and_bottom) |
Expand the rectangle. More... | |
CL_Rectx< Type > & | expand (const Type &expand) |
Expand the rectangle. More... | |
CL_Rectx< Type > & | translate (const CL_Vec2< Type > &p) |
Translate the rect. More... | |
CL_Rectx< Type > & | translate (const CL_Rectx< Type > &p) |
Translate the rect by another rect (only uses the left and top coords). More... | |
CL_Rectx< Type > & | translate (Type x, Type y) |
Translate the rect. More... | |
CL_Rectx< Type > & | set_size (const CL_Sizex< Type > &size) |
Sets the size of the rectangle, maintaining top/left position. More... | |
CL_Rectx< Type > & | overlap (const CL_Rectx< Type > &rect) |
Calculates the intersection of two rectangles. More... | |
CL_Rectx< Type > & | bounding_rect (const CL_Rectx< Type > &rect) |
Calculates the bounding rectangle of the rectangles. More... | |
CL_Rectx< Type > & | normalize () |
Normalize rectangle. Ensures that left is less than right and top is less than bottom. More... | |
CL_Rectx< Type > & | apply_alignment (CL_Origin origin, Type x, Type y) |
Applies an origin and offset pair to this rectangle. More... | |
CL_Rectx< Type > & | clip (const CL_Rectx< Type > &cr) |
Clip according to the specified clip rectangle. More... | |
Attributes | |
Type | left |
X1-coordinate. More... | |
Type | top |
Y1-coordinate. More... | |
Type | right |
X2-coordinate. More... | |
Type | bottom |
Y2-coordinate. More... | |
Type | get_width () const |
Returns the width of the rectangle. More... | |
Type | get_height () const |
Returns the height of the rectangle. More... | |
CL_Sizex< Type > | get_size () const |
Returns the size of the rectangle. More... | |
bool | contains (const CL_Vec2< Type > &p) const |
Returns true if the rectangle contains the point. More... | |
CL_Pointx< Type > | get_top_left () const |
Returns the top-left point of the rectangle. More... | |
CL_Pointx< Type > | get_top_right () const |
Returns the top-right point of the rectangle. More... | |
CL_Pointx< Type > | get_bottom_right () const |
Returns the bottom-right point of the rectangle. More... | |
CL_Pointx< Type > | get_bottom_left () const |
Returns the bottom-left point of the rectangle. More... | |
bool | is_overlapped (const CL_Rectx< Type > &r) const |
Returns true if rectangle passed is overlapping or inside this rectangle. More... | |
bool | is_inside (const CL_Rectx< Type > &r) const |
Returns true if rectangle passed is inside this rectangle. More... | |
CL_Rectx< Type > | get_rot_bounds (const CL_Vec2< Type > &hotspot, const CL_Angle &angle) const |
Returns another CL_Rectx<Type> containing a rotated version of this one. More... | |
CL_Rectx< Type > | get_rot_bounds (CL_Origin origin, Type x, Type y, const CL_Angle &angle) const |
Returns another CL_Rectx<Type> containing a rotated version of this one. More... | |
CL_Pointx< Type > | get_center () const |
Returns the center point of the rectangle. More... | |
2D (left,top,right,bottom) rectangle structure.
These line templates are defined for: int (CL_Rect), float (CL_Rectf), double (CL_Rectd)
Constructs an rectangle.
Initialised to zero
Constructs an rectangle.
s | = Size |
|
inline |
Constructs an rectangle.
new_left | Initial left position of rectangle. |
new_top | Initial top position of rectangle. |
new_right | Initial right position of rectangle. |
new_bottom | Initial bottom position of rectangle. |
|
inline |
Constructs an rectangle.
p | = Initial top-left position of rectangle. |
size | Initial size of rectangle. |
|
inline |
Constructs an rectangle.
new_left | Initial left position of rectangle. |
new_top | Initial top position of rectangle. |
size | Initial size of rectangle. |
|
inline |
Applies an origin and offset pair to this rectangle.
origin | The new origin to adjust to from default upper-left position |
x,y | Offsets applied negatively to each corner of the rectangle |
|
inline |
Calculates the bounding rectangle of the rectangles.
Rect values become: min left, min top, max right, max bottom.
|
inline |
Clip according to the specified clip rectangle.
Returns true if the rectangle contains the point.
|
inline |
Expand the rectangle.
|
inline |
Expand the rectangle.
Expand the rectangle.
Returns the bottom-left point of the rectangle.
Returns the bottom-right point of the rectangle.
Returns the center point of the rectangle.
|
inline |
Returns the height of the rectangle.
CL_Rectx<Type> CL_Rectx< Type >::get_rot_bounds | ( | const CL_Vec2< Type > & | hotspot, |
const CL_Angle & | angle | ||
) | const |
Returns another CL_Rectx<Type> containing a rotated version of this one.
hotspot | Point to rotate around. |
angle | Angle to rotate. |
CL_Rectx<Type> CL_Rectx< Type >::get_rot_bounds | ( | CL_Origin | origin, |
Type | x, | ||
Type | y, | ||
const CL_Angle & | angle | ||
) | const |
Returns another CL_Rectx<Type> containing a rotated version of this one.
origin | Determines the hotspot point within the rectangle |
x | Offsets applied negatively to the hotspot point |
y | Offsets applied negatively to the hotspot point |
angle | Angle |
Returns the size of the rectangle.
Returns the top-left point of the rectangle.
Returns the top-right point of the rectangle.
|
inline |
Returns the width of the rectangle.
Returns true if rectangle passed is inside this rectangle.
|
inline |
Returns true if rectangle passed is overlapping or inside this rectangle.
Normalize rectangle. Ensures that left is less than right and top is less than bottom.
|
inline |
Rect != Rect operator.
|
inline |
Rect == Rect operator.
|
inline |
Calculates the intersection of two rectangles.
Rect values become: max left, max top, min right, min bottom.
|
inline |
Sets the bottom-left point of the rectangle.
|
inline |
Sets the bottom-right point of the rectangle.
Sets the height of the rectangle.
|
inline |
Sets the size of the rectangle, maintaining top/left position.
|
inline |
Sets the top-left point of the rectangle.
|
inline |
Sets the top-right point of the rectangle.
Sets the width of the rectangle.
|
inline |
Shrink the rectangle.
|
inline |
Shrink the rectangle.
Shrink the rectangle.
|
inline |
Translate the rect.
|
inline |
Translate the rect by another rect (only uses the left and top coords).
Translate the rect.
Type CL_Rectx< Type >::bottom |
Y2-coordinate.
Referenced by CL_Rectx< int >::bounding_rect(), CL_Quadx< int >::CL_Quadx(), CL_Rectx< Type >::CL_Rectx(), CL_Rectx< int >::CL_Rectx(), CL_Rectx< int >::clip(), CL_Rectx< int >::is_inside(), CL_Rectx< int >::is_overlapped(), CL_Rectx< int >::operator!=(), CL_Rectx< int >::operator==(), and CL_Rectx< int >::overlap().
Type CL_Rectx< Type >::left |
X1-coordinate.
Referenced by CL_Rectx< int >::bounding_rect(), CL_Quadx< int >::CL_Quadx(), CL_Rectx< Type >::CL_Rectx(), CL_Rectx< int >::CL_Rectx(), CL_Rectx< int >::clip(), CL_Rectx< int >::is_inside(), CL_Rectx< int >::is_overlapped(), CL_Rectx< int >::operator!=(), CL_Rectx< int >::operator==(), CL_Rectx< int >::overlap(), and CL_Rectx< int >::translate().
Type CL_Rectx< Type >::right |
X2-coordinate.
Referenced by CL_Rectx< int >::bounding_rect(), CL_Quadx< int >::CL_Quadx(), CL_Rectx< Type >::CL_Rectx(), CL_Rectx< int >::CL_Rectx(), CL_Rectx< int >::clip(), CL_Rectx< int >::is_inside(), CL_Rectx< int >::is_overlapped(), CL_Rectx< int >::operator!=(), CL_Rectx< int >::operator==(), and CL_Rectx< int >::overlap().
Type CL_Rectx< Type >::top |
Y1-coordinate.
Referenced by CL_Rectx< int >::bounding_rect(), CL_Quadx< int >::CL_Quadx(), CL_Rectx< Type >::CL_Rectx(), CL_Rectx< int >::CL_Rectx(), CL_Rectx< int >::clip(), CL_Rectx< int >::is_inside(), CL_Rectx< int >::is_overlapped(), CL_Rectx< int >::operator!=(), CL_Rectx< int >::operator==(), CL_Rectx< int >::overlap(), and CL_Rectx< int >::translate().