Flat 2D axis-aligned square shape with a position and width.
More...
#include <GREM/core/geometry.hpp>
|
| using | Component = T |
| | Scalar coordinate component type.
|
|
| template<typename U> |
| GREM_ALWAYS_INLINE constexpr | operator Square< U > () const noexcept |
| | Convert this square to an equivalent square of another scalar type.
|
| constexpr | operator Rectangle< T > () const noexcept |
| | Convert this square to an equivalent rectangle.
|
| constexpr | operator Box< 2, T > () const noexcept |
| | Convert this square to an equivalent 2D axis-aligned box.
|
| bool | operator== (const Square &other) const =default |
| | Compare this square to another for equality.
|
| constexpr bool | contains (const Point< 2, T > &point) const noexcept |
| | Check if a given point is contained within the extents of this square.
|
| constexpr bool | intersects (const Ray< 2, T > &ray) const noexcept |
| | Check if this square intersects a given ray.
|
| constexpr RaycastResult< 2, T > | raycast (const Ray< 2, T > &ray) const noexcept |
| | Find the closest intersection of this square with a given ray.
|
| constexpr Box< 2, T > | getBoundingBox () const noexcept |
| | Get the axis-aligned bounding box of the square.
|
| constexpr Box< 2, T > | toBox () const noexcept |
| | Convert this shape to an equivalent axis-aligned bounding box.
|
|
| Point< 2, T > | position |
| | Position of the bottom left corner of the square.
|
| T | width |
| | Width and height of the square.
|
|
| static constexpr size_t | RANK = 2 |
| | Number of dimensions of the vector space.
|
template<typename T>
struct grem::Square< T >
Flat 2D axis-aligned square shape with a position and width.
- Template Parameters
-
| T | scalar coordinate component type. |
◆ Component
Scalar coordinate component type.
◆ operator Square< U >()
template<typename T>
template<typename U>
|
|
inlineexplicitconstexprnoexcept |
Convert this square to an equivalent square of another scalar type.
- Returns
- the converted square.
◆ operator Rectangle< T >()
Convert this square to an equivalent rectangle.
- Returns
- the square as a rectangle.
◆ operator Box< 2, T >()
Convert this square to an equivalent 2D axis-aligned box.
- Returns
- the square as an axis-aligned box.
◆ operator==()
Compare this square to another for equality.
- Parameters
-
| other | the square to compare this square to. |
- Returns
- true if the squares are equal, false otherwise.
◆ contains()
template<typename T>
|
|
inlinenodiscardconstexprnoexcept |
Check if a given point is contained within the extents of this square.
- Parameters
-
- Returns
- true if the square contains the given point, false otherwise.
◆ intersects()
template<typename T>
|
|
inlinenodiscardconstexprnoexcept |
Check if this square intersects a given ray.
- Parameters
-
- Returns
- true if an intersection was found, false otherwise.
◆ raycast()
template<typename T>
|
|
inlinenodiscardconstexprnoexcept |
Find the closest intersection of this square with a given ray.
- Parameters
-
- Returns
- the result of the raycast.
◆ getBoundingBox()
template<typename T>
|
|
inlinenodiscardconstexprnoexcept |
Get the axis-aligned bounding box of the square.
- Returns
- an axis-aligned box that contains the entire square.
◆ toBox()
template<typename T>
|
|
inlinenodiscardconstexprnoexcept |
Convert this shape to an equivalent axis-aligned bounding box.
- Returns
- an axis-aligned box that is equivalent to this shape.
◆ RANK
Number of dimensions of the vector space.
◆ position
Position of the bottom left corner of the square.
◆ width
Width and height of the square.
The documentation for this struct was generated from the following file: