2D (left,top,right,bottom) rectangle structure. More...
#include <line.h>
Public Member Functions | |
Rectx () | |
Constructs an rectangle. More... | |
Rectx (const Sizex< Type > &s) | |
Constructs an rectangle. More... | |
Rectx (Type new_left, Type new_top, Type new_right, Type new_bottom) | |
Constructs an rectangle. More... | |
Rectx (const Pointx< Type > &p, const Sizex< Type > &size) | |
Constructs an rectangle. More... | |
Rectx (Type new_left, Type new_top, const Sizex< Type > &size) | |
Constructs an rectangle. More... | |
Rectx (const Rectx< int > &rect) | |
Constructs an rectangle. More... | |
Rectx (const Rectx< float > &rect) | |
Constructs an rectangle. More... | |
Rectx (const Rectx< double > &rect) | |
Constructs an rectangle. More... | |
template<> | |
Rectx (const Rectx< float > &rect) | |
template<> | |
Rectx (const Rectx< double > &rect) | |
Rectx< Type > & | apply_alignment (Origin origin, Type x, Type y) |
Applies an origin and offset pair to this rectangle. More... | |
Pointx< Type > | bottom_left () const |
Returns the bottom-left point outside the rectangle. More... | |
Pointx< Type > | bottom_right () const |
Returns the bottom-right point outside the rectangle. More... | |
Rectx< Type > & | bounding_rect (const Rectx< Type > &rect) |
Calculates the bounding rectangle of the rectangles. More... | |
Pointx< Type > | center () const |
Returns the center point of the rectangle. More... | |
Rectx< Type > & | clip (const Rectx< Type > &cr) |
Clip according to the specified clip rectangle. More... | |
bool | contains (const Vec2< Type > &p) const |
Returns true if the rectangle contains the point. More... | |
Rectx< Type > & | expand (const Type &expand_left, const Type &expand_top, const Type &expand_right, const Type &expand_bottom) |
Expand the rectangle. More... | |
Rectx< Type > & | expand (const Type &left_and_right, const Type &top_and_bottom) |
Expand the rectangle. More... | |
Rectx< Type > & | expand (const Type &expand) |
Expand the rectangle. More... | |
Type | height () const |
Returns the height of the rectangle. More... | |
bool | is_inside (const Rectx< Type > &r) const |
Returns true if rectangle passed is inside this rectangle. More... | |
bool | is_overlapped (const Rectx< Type > &r) const |
Returns true if rectangle passed is overlapping or inside this rectangle. More... | |
Rectx< Type > & | normalize () |
Normalize rectangle. More... | |
bool | operator!= (const Rectx< Type > &r) const |
Rect != Rect operator. More... | |
Rectx< Type > | operator* (const Type &s) const |
Rect * operator. More... | |
Rectx< Type > & | operator*= (const Type &s) |
Rect *= operator. More... | |
bool | operator== (const Rectx< Type > &r) const |
Rect == Rect operator. More... | |
Rectx< Type > & | overlap (const Rectx< Type > &rect) |
Calculates the intersection of two rectangles. More... | |
Pointx< Type > | position () const |
Returns the position of the rectangle. More... | |
Rectx< Type > | rot_bounds (const Vec2< Type > &hotspot, float angle) const |
Returns another Rectx<Type> containing a rotated version of this one. More... | |
Rectx< Type > | rot_bounds (Origin origin, Type x, Type y, float angle) const |
Returns another Rectx<Type> containing a rotated version of this one. More... | |
Rectx< Type > & | set_height (Type height) |
Sets the height of the rectangle. More... | |
Rectx< Type > & | set_position (const Vec2< Type > &p) |
Sets the position of the rectangle. More... | |
Rectx< Type > & | set_size (const Sizex< Type > &size) |
Sets the size of the rectangle, maintaining top/left position. More... | |
Rectx< Type > & | set_width (Type width) |
Sets the width of the rectangle. More... | |
Rectx< Type > & | shrink (const Type &new_left, const Type &new_top, const Type &new_right, const Type &new_bottom) |
Shrink the rectangle. More... | |
Rectx< Type > & | shrink (const Type &left_right, const Type &top_bottom) |
Shrink the rectangle. More... | |
Rectx< Type > & | shrink (const Type &shrink) |
Shrink the rectangle. More... | |
Sizex< Type > | size () const |
Returns the size of the rectangle. More... | |
Pointx< Type > | top_left () const |
Returns the top-left point inside the rectangle. More... | |
Pointx< Type > | top_right () const |
Returns the top-right point outside the rectangle. More... | |
Rectx< Type > & | translate (const Vec2< Type > &p) |
Translate the rect. More... | |
Rectx< Type > & | translate (const Sizex< Type > &p) |
Translate the rect. More... | |
Rectx< Type > & | translate (const Rectx< Type > &p) |
Translate the rect by another rect (only uses the left and top coords). More... | |
Rectx< Type > & | translate (Type x, Type y) |
Translate the rect. More... | |
Type | width () const |
Returns the width of the rectangle. More... | |
Type | x () const |
X position of rectangle. More... | |
Type | y () const |
Y position of rectangle. More... | |
Static Public Member Functions | |
static Rectx< Type > | ltrb (Type left, Type top, Type right, Type bottom) |
static Rectx< Type > | wh (Type width, Type height) |
static Rectx< Type > | wh (const Sizex< Type > &size) |
static Rectx< Type > | xywh (Type x, Type y, Type width, Type height) |
static Rectx< Type > | xywh (const Pointx< Type > &pos, const Sizex< Type > &size) |
Public Attributes | |
Type | bottom |
Y2-coordinate (point outside the rectange) More... | |
Type | left |
X1-coordinate (left point inside the rectangle) More... | |
Type | right |
X2-coordinate (point outside the rectangle) More... | |
Type | top |
Y1-coordinate (top point inside the rectangle) More... | |
2D (left,top,right,bottom) rectangle structure.
These line templates are defined for: int (Rect), float (Rectf), double (Rectd)
|
inline |
Constructs an rectangle.
Initialised to zero
|
inline |
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 |
Constructs an rectangle.
rect | Initial rectangle position and size. |
References uicore::left, and uicore::right.
|
inline |
Constructs an rectangle.
rect | Initial rectangle position and size. |
References uicore::left, and uicore::right.
|
inline |
Constructs an rectangle.
rect | Initial rectangle position and size. |
References uicore::left, and uicore::right.
|
inline |
References uicore::f, uicore::left, and uicore::right.
|
inline |
References uicore::left, and uicore::right.
|
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 |
Returns the bottom-left point outside the rectangle.
|
inline |
Returns the bottom-right point outside the rectangle.
|
inline |
Calculates the bounding rectangle of the rectangles.
Rect values become: min left, min top, max right, max bottom.
|
inline |
Returns the center point of the rectangle.
|
inline |
Clip according to the specified clip rectangle.
|
inline |
Returns true if the rectangle contains the point.
|
inline |
|
inline |
Expand the rectangle.
|
inline |
Expand the rectangle.
|
inline |
Returns the height of the rectangle.
Referenced by uicore::Texture2D::copy_image_from(), uicore::Texture2D::copy_subimage_from(), uicore::Rectx< int >::set_height(), uicore::Rectx< int >::set_position(), uicore::Rectx< int >::wh(), and uicore::Rectx< int >::xywh().
|
inline |
Returns true if rectangle passed is inside this rectangle.
|
inline |
Returns true if rectangle passed is overlapping or inside this rectangle.
|
inlinestatic |
|
inline |
Normalize rectangle.
Sets the width to 0 if found a negative width Sets the height to 0 if found a negative height
|
inline |
|
inline |
Rect * operator.
|
inline |
Rect *= operator.
|
inline |
|
inline |
Calculates the intersection of two rectangles.
Rect values become: max left, max top, min right, min bottom.
|
inline |
Returns the position of the rectangle.
Rectx<Type> uicore::Rectx< Type >::rot_bounds | ( | const Vec2< Type > & | hotspot, |
float | angle | ||
) | const |
Returns another Rectx<Type> containing a rotated version of this one.
hotspot | Point to rotate around. |
angle | Angle to rotate. |
Rectx<Type> uicore::Rectx< Type >::rot_bounds | ( | Origin | origin, |
Type | x, | ||
Type | y, | ||
float | angle | ||
) | const |
Returns another 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 |
|
inline |
Sets the height of the rectangle.
|
inline |
Sets the position of the rectangle.
|
inline |
Sets the size of the rectangle, maintaining top/left position.
|
inline |
Sets the width of the rectangle.
|
inline |
|
inline |
Shrink the rectangle.
|
inline |
Shrink the rectangle.
|
inline |
Returns the size of the rectangle.
Referenced by uicore::Rectx< int >::apply_alignment().
|
inline |
Returns the top-left point inside the rectangle.
|
inline |
Returns the top-right point outside the rectangle.
|
inline |
Translate the rect.
|
inline |
Translate the rect.
|
inline |
Translate the rect by another rect (only uses the left and top coords).
|
inline |
Translate the rect.
|
inlinestatic |
|
inlinestatic |
|
inline |
Returns the width of the rectangle.
Referenced by uicore::Texture2D::copy_image_from(), uicore::Texture2D::copy_subimage_from(), uicore::Rectx< int >::set_position(), uicore::Rectx< int >::set_width(), uicore::Rectx< int >::wh(), and uicore::Rectx< int >::xywh().
|
inline |
X position of rectangle.
Referenced by uicore::Rectx< int >::apply_alignment(), uicore::Rectx< int >::translate(), and uicore::Rectx< int >::xywh().
|
inlinestatic |
|
inlinestatic |
|
inline |
Y position of rectangle.
Referenced by uicore::Rectx< int >::apply_alignment(), uicore::Rectx< int >::translate(), and uicore::Rectx< int >::xywh().
Type uicore::Rectx< Type >::bottom |
Y2-coordinate (point outside the rectange)
Referenced by uicore::Rectx< int >::bottom_left(), uicore::Rectx< int >::bottom_right(), uicore::Rectx< int >::contains(), uicore::Rectx< int >::ltrb(), uicore::Rectx< int >::operator!=(), uicore::Rectx< int >::operator*(), uicore::Rectx< int >::operator*=(), and uicore::Rectx< int >::operator==().
Type uicore::Rectx< Type >::left |
X1-coordinate (left point inside the rectangle)
Referenced by uicore::Rectx< int >::bottom_left(), uicore::Texture2D::copy_image_from(), uicore::Texture2D::copy_subimage_from(), uicore::Rectx< int >::ltrb(), uicore::Rectx< int >::normalize(), uicore::Rectx< int >::operator!=(), uicore::Rectx< int >::operator*(), uicore::Rectx< int >::operator*=(), uicore::Rectx< int >::operator==(), uicore::Rectx< int >::position(), uicore::Rectx< int >::size(), uicore::Rectx< int >::top_left(), uicore::Rectx< int >::width(), and uicore::Rectx< int >::x().
Type uicore::Rectx< Type >::right |
X2-coordinate (point outside the rectangle)
Referenced by uicore::Rectx< int >::bottom_right(), uicore::Rectx< int >::center(), uicore::Rectx< int >::ltrb(), uicore::Rectx< int >::operator!=(), uicore::Rectx< int >::operator*(), uicore::Rectx< int >::operator*=(), uicore::Rectx< int >::operator==(), and uicore::Rectx< int >::top_right().
Type uicore::Rectx< Type >::top |
Y1-coordinate (top point inside the rectangle)
Referenced by uicore::Texture2D::copy_image_from(), uicore::Texture2D::copy_subimage_from(), uicore::Rectx< int >::height(), uicore::Rectx< int >::ltrb(), uicore::Rectx< int >::normalize(), uicore::Rectx< int >::operator!=(), uicore::Rectx< int >::operator*(), uicore::Rectx< int >::operator*=(), uicore::Rectx< int >::operator==(), uicore::Rectx< int >::position(), uicore::Rectx< int >::size(), uicore::Rectx< int >::top_left(), uicore::Rectx< int >::top_right(), and uicore::Rectx< int >::y().