#include <hikogui/geometry/rectangle.hpp>
|
|
constexpr | rectangle (rectangle const &rhs) noexcept=default |
|
constexpr rectangle & | operator= (rectangle const &rhs) noexcept=default |
|
constexpr | rectangle (rectangle &&rhs) noexcept=default |
|
constexpr rectangle & | operator= (rectangle &&rhs) noexcept=default |
| constexpr | rectangle (point3 origin, vector3 right, vector3 up) noexcept |
| | Create a rectangle from a corner point and two vectors.
|
| constexpr | rectangle (point3 origin, point3 right_bottom, point3 left_top, point3 right_top) noexcept |
| | Create a rectangle from 4 corner points.
|
|
constexpr | rectangle (aarectangle rhs) noexcept |
|
constexpr | rectangle (extent2 size) noexcept |
|
constexpr rectangle & | operator= (aarectangle rhs) noexcept |
|
constexpr | rectangle (point3 origin, extent2 extent) noexcept |
| | operator bool () const noexcept |
| | Check if the rectangle has an area.
|
| constexpr bool | is_rectangle () const noexcept |
| | Check if this is a rectangle.
|
| constexpr bool | is_axis_aligned () const noexcept |
| | Check if this is an axis aligned rectangle.
|
| float | width () const noexcept |
| | The width, or length of the right vector.
|
| float | height () const noexcept |
| | The height, or length of the up vector.
|
| constexpr extent2 | size () const noexcept |
| | The size, or length of the right and up vectors.
|
|
float | area () const noexcept |
|
constexpr point3 | operator[] (std::size_t i) const noexcept |
|
| constexpr friend aarectangle | bounding_rectangle (rectangle const &rhs) noexcept |
| | Return the axis-aligned bounding rectangle of this rectangle.
|
|
template<std::size_t I> |
| constexpr point3 | get (rectangle const &rhs) noexcept |
| constexpr rectangle | operator+ (rectangle const &lhs, extent2 rhs) noexcept |
| | Expand the rectangle by adding an absolute distance on each side.
|
| constexpr rectangle | operator- (rectangle const &lhs, extent2 rhs) noexcept |
| | Shrink the rectangle by subtracting an absolute distance from each side.
|
| constexpr rectangle | operator+ (rectangle const &lhs, float rhs) noexcept |
| | Expand the rectangle by adding an absolute distance on each side.
|
| constexpr rectangle | operator- (rectangle const &lhs, float rhs) noexcept |
| | Shrink the rectangle by subtracting an absolute distance from each side.
|
A rectangle / parallelogram in 3D space.
This class actually describes a parallelogram in 3D space using a point to the left bottom corner and a right & up vector.
◆ rectangle() [1/2]
| hi::v1::rectangle::rectangle |
( |
point3 | origin, |
|
|
vector3 | right, |
|
|
vector3 | up ) |
|
inlineconstexprnoexcept |
Create a rectangle from a corner point and two vectors.
- Parameters
-
| origin | The left-bottom corner. |
| right | The right vector. |
| up | The up vector. |
◆ rectangle() [2/2]
| hi::v1::rectangle::rectangle |
( |
point3 | origin, |
|
|
point3 | right_bottom, |
|
|
point3 | left_top, |
|
|
point3 | right_top ) |
|
inlineconstexprnoexcept |
Create a rectangle from 4 corner points.
- Parameters
-
| origin | The left-bottom corner. |
| right_bottom | The right-bottom corner. |
| left_top | The left-top corner. |
| right_top | The right-top corner. |
◆ height()
| float hi::v1::rectangle::height |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
The height, or length of the up vector.
◆ is_axis_aligned()
| bool hi::v1::rectangle::is_axis_aligned |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
Check if this is an axis aligned rectangle.
- Returns
- True if this is a axis aligned rectangle.
◆ is_rectangle()
| bool hi::v1::rectangle::is_rectangle |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
Check if this is a rectangle.
- Returns
- True if rectangle, false if another parallelogram.
◆ operator bool()
| hi::v1::rectangle::operator bool |
( |
| ) |
const |
|
inlineexplicitnodiscardnoexcept |
Check if the rectangle has an area.
- Returns
- True is there is a area.
◆ size()
| extent2 hi::v1::rectangle::size |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
The size, or length of the right and up vectors.
◆ width()
| float hi::v1::rectangle::width |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
The width, or length of the right vector.
◆ bounding_rectangle
| friend aarectangle bounding_rectangle |
( |
rectangle const & | rhs | ) |
|
|
friend |
Return the axis-aligned bounding rectangle of this rectangle.
◆ operator+ [1/2]
| rectangle operator+ |
( |
rectangle const & | lhs, |
|
|
extent2 | rhs ) |
|
friend |
Expand the rectangle by adding an absolute distance on each side.
The expansion is done by:
- translating the origin point in opposite direction of the right and up vectors.
- increase the size of the right and up vectors twice.
It is possible for the rectangle to flip, when the right-hand-side is negative.
- Parameters
-
| lhs | The rectangle to expand. |
| rhs | The size in 2D to expand the rectangle |
- Returns
- A new rectangle expanded in each side.
◆ operator+ [2/2]
| rectangle operator+ |
( |
rectangle const & | lhs, |
|
|
float | rhs ) |
|
friend |
Expand the rectangle by adding an absolute distance on each side.
The expansion is done by:
- translating the origin point in opposite direction of the right and up vectors.
- increase the size of the right and up vectors twice.
It is possible for the rectangle to flip, when the right-hand-side is negative.
- Parameters
-
| lhs | The rectangle to expand. |
| rhs | The scalar value which is added to the rectangle in each side. |
- Returns
- A new rectangle expanded in each side.
◆ operator- [1/2]
| rectangle operator- |
( |
rectangle const & | lhs, |
|
|
extent2 | rhs ) |
|
friend |
Shrink the rectangle by subtracting an absolute distance from each side.
The shrinking is done by:
- translating the origin point in the same direction of the right and up vectors.
- decrease the size of the right and up vectors twice.
It is possible for the rectangle to flip, when the right-hand-side is negative.
- Parameters
-
| lhs | The rectangle to shrink. |
| rhs | The size in 2D to shrink the rectangle |
- Returns
- A new rectangle expanded in each side.
◆ operator- [2/2]
| rectangle operator- |
( |
rectangle const & | lhs, |
|
|
float | rhs ) |
|
friend |
Shrink the rectangle by subtracting an absolute distance from each side.
The shrinking is done by:
- translating the origin point in the same direction of the right and up vectors.
- decrease the size of the right and up vectors twice.
It is possible for the rectangle to flip, when the right-hand-side is negative.
- Parameters
-
| lhs | The rectangle to shrink. |
| rhs | The scalar value which is added to the rectangle in each side. |
- Returns
- A new rectangle expanded in each side.
The documentation for this class was generated from the following file: