12#include "../SIMD/module.hpp"
13#include "../utility/utility.hpp"
14#include "../macros.hpp"
20namespace hi {
inline namespace v1 {
32 using value_type = array_type::value_type;
58 return vector2{
static_cast<array_type
>(*this)};
95 return _v.x() != 0.0f
or _v.y() != 0.0f
or _v.z() != 0.0f;
149 return vector2{_v._0y00()};
154 return *
this = *
this + rhs;
164 return extent2{lhs._v + rhs._v};
174 return extent2{lhs._v - rhs._v};
189 return extent2{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
194 return vector2{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
206 r._v[i] = lhs._v[i] + rhs;
229 return equal(lhs._v, rhs._v);
232 [[
nodiscard]]
constexpr friend std::partial_ordering operator<=>(
extent2 const& lhs,
extent2 const& rhs)
noexcept
236 hilet equal = (lhs._v == rhs._v).mask() & mask;
239 return std::partial_ordering::equivalent;
242 hilet less = (lhs._v < rhs._v).mask() & mask;
243 if ((less | equal) == mask) {
245 return std::partial_ordering::less;
248 hilet greater = (lhs._v > rhs._v).mask() & mask;
249 if ((greater | equal) == mask) {
251 return std::partial_ordering::greater;
255 return std::partial_ordering::unordered;
296 return extent2{ceil(array_type{rhs})};
301 return extent2{floor(
static_cast<array_type
>(rhs))};
306 return extent2{round(
static_cast<array_type
>(rhs))};
311 return extent2{min(
static_cast<array_type
>(lhs),
static_cast<array_type
>(rhs))};
316 return extent2{max(
static_cast<array_type
>(lhs),
static_cast<array_type
>(rhs))};
321 return extent2{clamp(
static_cast<array_type
>(value),
static_cast<array_type
>(min),
static_cast<array_type
>(max))};
330 return _v.x() >= 0.0f
and _v.y() >= 0.0f
and _v.z() == 0.0f
and _v.w() == 0.0f;
335 return std::format(
"[{}, {}]", rhs._v.x(), rhs._v.y());
340 return lhs << to_string(rhs);
349template<
typename CharT>
350struct std::formatter<
hi::extent2, CharT> {
358 return std::vformat_to(fc.out(),
"[{}, {}]", std::make_format_args(t.
width(), t.
height()));
@ other
The gui_event does not have associated data.
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
A high-level geometric extent.
Definition extent2.hpp:29
constexpr float width() const noexcept
Access the x-as-width element from the extent.
Definition extent2.hpp:126
friend float hypot(extent2 const &rhs) noexcept
Get the length of the extent.
Definition extent2.hpp:271
constexpr friend extent2 operator*(float const &lhs, extent2 const &rhs) noexcept
Scale the extent by a scaler.
Definition extent2.hpp:217
constexpr float height() const noexcept
Access the y-as-height element from the extent.
Definition extent2.hpp:137
hi_force_inline constexpr friend float squared_hypot(extent2 const &rhs) noexcept
Get the squared length of the extent.
Definition extent2.hpp:262
constexpr friend extent2 operator+(extent2 const &lhs, float const &rhs) noexcept
Add a scaler to the extent.
Definition extent2.hpp:202
constexpr friend extent2 operator*(extent2 const &lhs, float const &rhs) noexcept
Scale the extent by a scaler.
Definition extent2.hpp:182
constexpr friend bool operator==(extent2 const &lhs, extent2 const &rhs) noexcept
Compare if two extents are equal.
Definition extent2.hpp:227
constexpr friend extent2 operator-(extent2 const &lhs, extent2 const &rhs) noexcept
Subtract two extents from each other.
Definition extent2.hpp:172
constexpr friend float rcp_hypot(extent2 const &rhs) noexcept
Get the length of the extent.
Definition extent2.hpp:280
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent2.hpp:104
constexpr extent2() noexcept
Construct a empty extent / zero length.
Definition extent2.hpp:63
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent2.hpp:115
constexpr friend extent2 operator+(extent2 const &lhs, extent2 const &rhs) noexcept
Add two extents from each other.
Definition extent2.hpp:162
constexpr bool holds_invariant() const noexcept
Check if the extent is valid.
Definition extent2.hpp:328
constexpr friend extent2 normalize(extent2 const &rhs) noexcept
Normalize a extent to a unit extent.
Definition extent2.hpp:289
constexpr extent2(float width, float height) noexcept
Construct a 3D extent from width, height and depth.
Definition extent2.hpp:70
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector2.hpp:19
T signaling_NaN(T... args)