qxLib
Public Member Functions | List of all members
qx::basic_rect< vector_t > Class Template Reference

Public Member Functions

constexpr basic_rect (vector_t size, vector_t pos=vector_t(value_type(0.f))) noexcept
 basic_rect object constructor More...
 
constexpr basic_rect (value_type width, value_type height, value_type xPos=value_type(0.f), value_type yPos=value_type(0.f)) noexcept
 basic_rect object constructor More...
 
constexpr void expand (const vector_t &dSize) noexcept
 Expand rect. More...
 
constexpr void contract (const vector_t &dSize) noexcept
 Contract rect. More...
 
constexpr void set_size (const vector_t &size) noexcept
 Change rect size. More...
 
constexpr void set_pos (const vector_t &pos) noexcept
 Set rect position. More...
 
constexpr void shift (const vector_t &dPos) noexcept
 Shift rect position. More...
 
constexpr const vector_t & pos () const noexcept
 Get upper left corner pos. More...
 
constexpr const vector_t & min () const noexcept
 Get min rect pos. More...
 
constexpr vector_t max () const noexcept
 Get max rect pos. More...
 
constexpr const vector_t & size () const noexcept
 Get rect size. More...
 
constexpr value_type width () const noexcept
 Get rect width. More...
 
constexpr value_type height () const noexcept
 Get rect height. More...
 
constexpr value_type left () const noexcept
 Get rect left border coordinate (x) More...
 
constexpr value_type right () const noexcept
 rect right border coordinate (x) More...
 
constexpr value_type top () const noexcept
 rect top border coordinate (y) More...
 
constexpr value_type bottom () const noexcept
 rect bottom border coordinate (y) More...
 
constexpr vector_t center () const noexcept
 Get rect center pos. More...
 
constexpr bool empty () const noexcept
 Is rect empty. More...
 
constexpr value_type area () const noexcept
 Calc rect area. More...
 
constexpr bool contains (const vector_t &pos, const vector_t &originPos=vector_t(0.f)) const noexcept
 Is point inside rect. More...
 
constexpr bool contains (const basic_rect &other, const vector_t &originPos=vector_t(0.f)) const noexcept
 Is other rect inside this rect. More...
 
constexpr bool overlaps (const basic_rect &other) const noexcept
 Is this rect overlaps other rect. More...
 
constexpr std::optional< basic_rectoverlap (const basic_rect &other) const noexcept
 Get rect representing overlap this rect by other rect. More...
 

Detailed Description

template<class vector_t>
class qx::basic_rect< vector_t >

Definition at line 34 of file rect.h.

Constructor & Destructor Documentation

◆ basic_rect() [1/2]

template<class vector_t >
constexpr qx::basic_rect< vector_t >::basic_rect ( vector_t  size,
vector_t  pos = vector_t(value_type(0.f)) 
)
explicitconstexprnoexcept

basic_rect object constructor

Parameters
size- rect size
pos- upper left corner pos

Definition at line 14 of file rect.inl.

◆ basic_rect() [2/2]

template<class vector_t >
constexpr qx::basic_rect< vector_t >::basic_rect ( value_type  width,
value_type  height,
value_type  xPos = value_type(0.f),
value_type  yPos = value_type(0.f) 
)
constexprnoexcept

basic_rect object constructor

Parameters
width- rect width
height- rect height
xPos- rect upper left corner x pos
yPos- rect upper left corner y pos

Definition at line 20 of file rect.inl.

Member Function Documentation

◆ area()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::area
constexprnoexcept

Calc rect area.

Return values
-rect area

Definition at line 133 of file rect.inl.

◆ bottom()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::bottom
constexprnoexcept

rect bottom border coordinate (y)

Return values
-rect bottom border coordinate (y)

Definition at line 115 of file rect.inl.

◆ center()

template<class vector_t >
constexpr vector_t qx::basic_rect< vector_t >::center
constexprnoexcept

Get rect center pos.

Return values
-rect center pos

Definition at line 121 of file rect.inl.

◆ contains() [1/2]

template<class vector_t >
constexpr bool qx::basic_rect< vector_t >::contains ( const basic_rect< vector_t > &  other,
const vector_t &  originPos = vector_t(0.f) 
) const
constexprnoexcept

Is other rect inside this rect.

Parameters
other- other rect
originPos- coordinate system center pos
Return values
-true if other rect is inside this rect

Definition at line 148 of file rect.inl.

◆ contains() [2/2]

template<class vector_t >
constexpr bool qx::basic_rect< vector_t >::contains ( const vector_t &  pos,
const vector_t &  originPos = vector_t(0.f) 
) const
constexprnoexcept

Is point inside rect.

Parameters
pos- point pos
originPos- coordinate system center pos
Return values
-true if pos is inside rect

Definition at line 139 of file rect.inl.

◆ contract()

template<class vector_t >
constexpr void qx::basic_rect< vector_t >::contract ( const vector_t &  dSize)
constexprnoexcept

Contract rect.

Parameters
dSize- size to contract

Definition at line 37 of file rect.inl.

◆ empty()

template<class vector_t >
constexpr bool qx::basic_rect< vector_t >::empty
constexprnoexcept

Is rect empty.

Return values
-true if rect is empty

Definition at line 127 of file rect.inl.

◆ expand()

template<class vector_t >
constexpr void qx::basic_rect< vector_t >::expand ( const vector_t &  dSize)
constexprnoexcept

Expand rect.

Parameters
dSize- size to expand

Definition at line 31 of file rect.inl.

◆ height()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::height
constexprnoexcept

Get rect height.

Return values
-rect height

Definition at line 91 of file rect.inl.

◆ left()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::left
constexprnoexcept

Get rect left border coordinate (x)

Return values
-rect left border coordinate (x)

Definition at line 97 of file rect.inl.

◆ max()

template<class vector_t >
constexpr vector_t qx::basic_rect< vector_t >::max
constexprnoexcept

Get max rect pos.

Return values
-max rect pos

Definition at line 73 of file rect.inl.

◆ min()

template<class vector_t >
constexpr const vector_t & qx::basic_rect< vector_t >::min
constexprnoexcept

Get min rect pos.

same as pos()

Return values
-min rect pos

Definition at line 67 of file rect.inl.

◆ overlap()

template<class vector_t >
constexpr std::optional< basic_rect< vector_t > > qx::basic_rect< vector_t >::overlap ( const basic_rect< vector_t > &  other) const
constexprnoexcept

Get rect representing overlap this rect by other rect.

Parameters
other- other rect
Return values
-rect representing overlap this rect by other rect or nullopt

Definition at line 161 of file rect.inl.

◆ overlaps()

template<class vector_t >
constexpr bool qx::basic_rect< vector_t >::overlaps ( const basic_rect< vector_t > &  other) const
constexprnoexcept

Is this rect overlaps other rect.

Parameters
other- other rect
Return values
-true if this rect is overlaps other rect

Definition at line 154 of file rect.inl.

◆ pos()

template<class vector_t >
constexpr const vector_t & qx::basic_rect< vector_t >::pos
constexprnoexcept

Get upper left corner pos.

Return values
-upper left corner pos

Definition at line 61 of file rect.inl.

◆ right()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::right
constexprnoexcept

rect right border coordinate (x)

Return values
-rect right border coordinate (x)

Definition at line 103 of file rect.inl.

◆ set_pos()

template<class vector_t >
constexpr void qx::basic_rect< vector_t >::set_pos ( const vector_t &  pos)
constexprnoexcept

Set rect position.

Parameters
pos- rect position

Definition at line 49 of file rect.inl.

◆ set_size()

template<class vector_t >
constexpr void qx::basic_rect< vector_t >::set_size ( const vector_t &  size)
constexprnoexcept

Change rect size.

Parameters
size- new size

Definition at line 43 of file rect.inl.

◆ shift()

template<class vector_t >
constexpr void qx::basic_rect< vector_t >::shift ( const vector_t &  dPos)
constexprnoexcept

Shift rect position.

Parameters
dPos- position delta

Definition at line 55 of file rect.inl.

◆ size()

template<class vector_t >
constexpr const vector_t & qx::basic_rect< vector_t >::size
constexprnoexcept

Get rect size.

Return values
-rect size

Definition at line 79 of file rect.inl.

◆ top()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::top
constexprnoexcept

rect top border coordinate (y)

Return values
-rect top border coordinate (y)

Definition at line 109 of file rect.inl.

◆ width()

template<class vector_t >
constexpr basic_rect< vector_t >::value_type qx::basic_rect< vector_t >::width
constexprnoexcept

Get rect width.

Return values
-rect width

Definition at line 85 of file rect.inl.


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