zz::Rect_< _Tp > Class Template Reference

The 2D up-right rectangle class The class represents a 2D rectangle with coordinates of the specified data type. Normally, zz::Rect ~ zz::Rect_<int> is used. More...

#include <zupply.hpp>

Public Types

typedef _Tp value_type
 

Public Member Functions

 Rect_ ()
 Default constructor.
 
 Rect_ (_Tp _x, _Tp _y, _Tp _width, _Tp _height)
 Constructor with x, y, width and height. More...
 
 Rect_ (const Rect_ &r)
 Copy constructor. More...
 
 Rect_ (const Point_< _Tp > &org, const Size_< _Tp > &sz)
 Constructor with top-left point and its size(width, height) More...
 
 Rect_ (const Point_< _Tp > &pt1, const Point_< _Tp > &pt2)
 Constructor with top-left point and right-bottom point. More...
 
Rect_operator= (const Rect_ &r)
 Copy operator. More...
 
Point_< _Tp > tl () const
 Get top left corner point. More...
 
Point_< _Tp > br () const
 Get bottom right corner point. More...
 
Size_< _Tp > size () const
 Get size of rectangle. More...
 
_Tp area () const
 Get area of rectagle. More...
 
template<typename _Tp2 >
 operator Rect_< _Tp2 > () const
 Convert to another type.
 
bool contains (const Point_< _Tp > &pt) const
 Checks whether the rectangle contains the point. More...
 

Public Attributes

_Tp x
 
_Tp y
 
_Tp width
 
_Tp height
 the top-left corner, as well as width and height of the rectangle
 

Detailed Description

template<typename _Tp>
class zz::Rect_< _Tp >

The 2D up-right rectangle class The class represents a 2D rectangle with coordinates of the specified data type. Normally, zz::Rect ~ zz::Rect_<int> is used.

Constructor & Destructor Documentation

template<typename _Tp>
zz::Rect_< _Tp >::Rect_ ( _Tp  _x,
_Tp  _y,
_Tp  _width,
_Tp  _height 
)

Constructor with x, y, width and height.

Parameters
_x
_y
_width
_height
template<typename _Tp>
zz::Rect_< _Tp >::Rect_ ( const Rect_< _Tp > &  r)

Copy constructor.

Parameters
r
template<typename _Tp>
zz::Rect_< _Tp >::Rect_ ( const Point_< _Tp > &  org,
const Size_< _Tp > &  sz 
)

Constructor with top-left point and its size(width, height)

Parameters
org
sz
template<typename _Tp>
zz::Rect_< _Tp >::Rect_ ( const Point_< _Tp > &  pt1,
const Point_< _Tp > &  pt2 
)

Constructor with top-left point and right-bottom point.

Parameters
pt1
pt2

Member Function Documentation

template<typename _Tp>
_Tp zz::Rect_< _Tp >::area ( ) const

Get area of rectagle.

Returns
Area
template<typename _Tp>
Point_<_Tp> zz::Rect_< _Tp >::br ( ) const

Get bottom right corner point.

Returns
Bottom-right corner
template<typename _Tp>
bool zz::Rect_< _Tp >::contains ( const Point_< _Tp > &  pt) const

Checks whether the rectangle contains the point.

Parameters
pt
Returns
True if contains, false otherwise
template<typename _Tp>
Rect_& zz::Rect_< _Tp >::operator= ( const Rect_< _Tp > &  r)

Copy operator.

Parameters
r
Returns
template<typename _Tp>
Size_<_Tp> zz::Rect_< _Tp >::size ( ) const

Get size of rectangle.

Returns
Size(width, height) of the rectangle
template<typename _Tp>
Point_<_Tp> zz::Rect_< _Tp >::tl ( ) const

Get top left corner point.

Returns
Top-left corner

The documentation for this class was generated from the following file: