9#include "../SIMD/module.hpp"
10#include "../macros.hpp"
13namespace hi {
inline namespace v1 {
48 constexpr rectangle(point3 origin, point3 right_bottom, point3 left_top, point3 right_top)
noexcept :
49 rectangle(origin, right_bottom - origin, left_top - origin)
69 constexpr rectangle& operator=(aarectangle rhs)
noexcept
81 constexpr rectangle(point3 origin, extent2 extent)
noexcept : rectangle(origin, extent.right(), extent.up()) {}
90 hilet p0 = rhs.origin;
91 left_bottom = min(left_bottom,
static_cast<f32x4>(p0));
92 right_top = max(right_top,
static_cast<f32x4>(p0));
94 hilet p1 = p0 + rhs.right;
95 left_bottom = min(left_bottom,
static_cast<f32x4>(p1));
96 right_top = max(right_top,
static_cast<f32x4>(p1));
98 hilet p2 = p0 + rhs.up;
99 left_bottom = min(left_bottom,
static_cast<f32x4>(p2));
100 right_top = max(right_top,
static_cast<f32x4>(p2));
102 hilet p3 = p2 + rhs.right;
103 left_bottom = min(left_bottom,
static_cast<f32x4>(p3));
104 right_top = max(right_top,
static_cast<f32x4>(p3));
106 return aarectangle{left_bottom.xy00() | right_top._00xy()};
125 hilet
dp = dot(right, up);
162 return hypot(cross(right, up));
181 template<std::
size_t I>
182 [[
nodiscard]]
friend constexpr point3 get(rectangle
const& rhs)
noexcept
184 static_assert(I < 4);
185 if constexpr (I == 0) {
187 }
else if constexpr (I == 1) {
188 return rhs.origin + rhs.right;
189 }
else if constexpr (I == 2) {
190 return rhs.origin + rhs.up;
192 return rhs.origin + rhs.right + rhs.up;
255 return lhs +
extent2{rhs, rhs};
273 return lhs -
extent2{rhs, rhs};
types and utilities for alignment.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:29
A high-level geometric extent.
Definition extent2.hpp:29
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent2.hpp:104
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent2.hpp:115
A rectangle / parallelogram in 3D space.
Definition rectangle.hpp:21
constexpr bool is_axis_aligned() const noexcept
Check if this is an axis aligned rectangle.
Definition rectangle.hpp:133
float height() const noexcept
The height, or length of the up vector.
Definition rectangle.hpp:148
friend constexpr rectangle operator-(rectangle const &lhs, float rhs) noexcept
Shrink the rectangle by subtracting an absolute distance from each side.
Definition rectangle.hpp:271
friend constexpr rectangle operator-(rectangle const &lhs, extent2 rhs) noexcept
Shrink the rectangle by subtracting an absolute distance from each side.
Definition rectangle.hpp:231
friend constexpr rectangle operator+(rectangle const &lhs, extent2 rhs) noexcept
Expand the rectangle by adding an absolute distance on each side.
Definition rectangle.hpp:209
constexpr friend aarectangle bounding_rectangle(rectangle const &rhs) noexcept
Return the axis-aligned bounding rectangle of this rectangle.
Definition rectangle.hpp:85
friend constexpr rectangle operator+(rectangle const &lhs, float rhs) noexcept
Expand the rectangle by adding an absolute distance on each side.
Definition rectangle.hpp:253
constexpr rectangle(point3 origin, point3 right_bottom, point3 left_top, point3 right_top) noexcept
Create a rectangle from 4 corner points.
Definition rectangle.hpp:48
float width() const noexcept
The width, or length of the right vector.
Definition rectangle.hpp:141
constexpr extent2 size() const noexcept
The size, or length of the right and up vectors.
Definition rectangle.hpp:155
constexpr bool is_rectangle() const noexcept
Check if this is a rectangle.
Definition rectangle.hpp:123
constexpr rectangle(point3 origin, vector3 right, vector3 up) noexcept
Create a rectangle from a corner point and two vectors.
Definition rectangle.hpp:39
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:20