Illustrates a rectangle.
More...
#include <rect.hpp>
|
constexpr auto | operator<=> (const rect &) const noexcept=default |
|
constexpr Number | right () const noexcept |
|
constexpr Number | bottom () const noexcept |
|
constexpr Number | area () const noexcept |
|
template<typename T >
requires bottom_right_rect<std::decay_t<T>> |
constexpr | operator T () const noexcept(nothrow_bottom_right_rect< std::decay_t< T > >) |
| Converts to a compatible rectangle that contains member variables left, top, right, bottom.
|
|
template<typename T >
requires equivalent_rect<std::decay_t<T>> |
constexpr | operator T () const noexcept(nothrow_equivalent_rect< std::decay_t< T > >) |
| Converts to an equivalent rectangle that contains member variables x, y, width, height.
|
|
template<width_height_pair T> |
constexpr T | to_extent () const noexcept(nothrow_width_height_pair< T >) |
| Retrieves the width-height pair.
|
|
template<width_height_pair T> |
constexpr void | assign_from_extent (const T &pair) noexcept |
| Sets the width and height from a width-height pair.
|
|
constexpr bool | collapsed () const noexcept |
| Checks whether the area of the rectangle is zero (i.e. collapsed to a zero-dimensional point).
|
|
|
template<bottom_right_rect T> |
static constexpr rect | from (const T &bottom_right_rect) noexcept |
| Makes a rectangle from a compatible rectangle that contains member variables x, y, width, height.
|
|
template<equivalent_rect T> |
static constexpr rect | from (const T &equivalent_rect) noexcept |
| Makes a rectangle from an equivalent rectangle that contains member variables x, y, bottom, right.
|
|
|
Number | x {} |
|
Number | y {} |
|
Number | width {} |
|
Number | height {} |
|
template<typename Number>
requires std::is_arithmetic_v<Number>
struct essence::rect< Number >
Illustrates a rectangle.
- Template Parameters
-
Number | The numeric type of the member variables. |
◆ assign_from_extent()
template<typename Number >
template<width_height_pair T>
void essence::rect< Number >::assign_from_extent |
( |
const T & | pair | ) |
|
|
inlineconstexprnoexcept |
Sets the width and height from a width-height pair.
- Template Parameters
-
T | The type of the pair that contains member variables width and height. |
- Parameters
-
pair | The weight-height pair. |
◆ collapsed()
template<typename Number >
|
inlinenodiscardconstexprnoexcept |
Checks whether the area of the rectangle is zero (i.e. collapsed to a zero-dimensional point).
- Returns
- True if the area is zero; otherwise false.
◆ from() [1/2]
template<typename Number >
template<bottom_right_rect T>
|
inlinestaticconstexprnoexcept |
Makes a rectangle from a compatible rectangle that contains member variables x, y, width, height.
- Template Parameters
-
T | The type of the compatible rectangle. |
- Parameters
-
- Returns
- The rectangle.
◆ from() [2/2]
template<typename Number >
template<equivalent_rect T>
|
inlinestaticconstexprnoexcept |
Makes a rectangle from an equivalent rectangle that contains member variables x, y, bottom, right.
- Template Parameters
-
T | The type of the equivalent rectangle. |
- Parameters
-
- Returns
- The rectangle.
◆ operator T() [1/2]
template<typename Number >
template<typename T >
requires bottom_right_rect<std::decay_t<T>>
Converts to a compatible rectangle that contains member variables left, top, right, bottom.
- Template Parameters
-
T | The type of the compatible rectangle. |
◆ operator T() [2/2]
template<typename Number >
template<typename T >
requires equivalent_rect<std::decay_t<T>>
Converts to an equivalent rectangle that contains member variables x, y, width, height.
- Template Parameters
-
T | The type of the equivalent rectangle. |
◆ to_extent()
template<typename Number >
template<width_height_pair T>
Retrieves the width-height pair.
- Template Parameters
-
T | The type of the pair that contains member variables width and height. |
- Returns
- The weight-height pair.
The documentation for this struct was generated from the following file: