13#include "../SIMD/module.hpp"
14#include "../utility/utility.hpp"
15#include "../macros.hpp"
21namespace hi {
inline namespace v1 {
33 using value_type = array_type::value_type;
68 return _v.x() != 0.0f
or _v.y() != 0.0f
or _v.z() != 0.0f;
73 return vector3{
static_cast<array_type
>(*this)};
185 return vector3{_v._0y00()};
190 return *
this = *
this + rhs;
200 return extent3{lhs._v + rhs._v};
210 return extent3{lhs._v - rhs._v};
225 return extent3{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
230 return extent3{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
235 return vector3{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
247 r._v[i] = lhs._v[i] + rhs;
270 return equal(lhs._v, rhs._v);
273 [[
nodiscard]]
constexpr friend std::partial_ordering operator<=>(
extent3 const& lhs,
extent3 const& rhs)
noexcept
277 hilet equal = (lhs._v == rhs._v).mask() & mask;
280 return std::partial_ordering::equivalent;
283 hilet less = (lhs._v < rhs._v).mask() & mask;
284 if ((less | equal) == mask) {
286 return std::partial_ordering::less;
289 hilet greater = (lhs._v < rhs._v).mask() & mask;
290 if ((greater | equal) == mask) {
292 return std::partial_ordering::greater;
296 return std::partial_ordering::unordered;
337 return extent3{ceil(array_type{rhs})};
342 return extent3{floor(
static_cast<array_type
>(rhs))};
347 return extent3{round(
static_cast<array_type
>(rhs))};
352 return extent3{min(
static_cast<array_type
>(lhs),
static_cast<array_type
>(rhs))};
357 return extent3{max(
static_cast<array_type
>(lhs),
static_cast<array_type
>(rhs))};
362 return extent3{clamp(
static_cast<array_type
>(value),
static_cast<array_type
>(min),
static_cast<array_type
>(max))};
371 return _v.x() >= 0.0f
and _v.y() >= 0.0f
and _v.z() >= 0.0f
and _v.w() == 0.0f;
376 return std::format(
"[{}, {}, {}]", rhs._v.x(), rhs._v.y(), rhs._v.z());
381 return lhs << to_string(rhs);
390template<
typename CharT>
391struct std::formatter<
hi::extent3, CharT> {
399 return std::vformat_to(fc.out(),
"[{}, {}, {}]", std::make_format_args(t.
width(), t.
height(), t.
depth()));
Defined the geo::extent, extent2 and extent3 types.
@ 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
A high-level geometric extent.
Definition extent3.hpp:30
constexpr extent3(extent2 const &other) noexcept
Construct a extent from a lower dimension extent.
Definition extent3.hpp:42
constexpr friend extent3 operator+(extent3 const &lhs, float const &rhs) noexcept
Add a scaler to the extent.
Definition extent3.hpp:243
constexpr float height() const noexcept
Access the y-as-height element from the extent.
Definition extent3.hpp:162
constexpr friend float rcp_hypot(extent3 const &rhs) noexcept
Get the length of the extent.
Definition extent3.hpp:321
constexpr extent3(float width, float height, float depth=0.0f) noexcept
Construct a 3D extent from width, height and depth.
Definition extent3.hpp:85
constexpr friend extent3 normalize(extent3 const &rhs) noexcept
Normalize a extent to a unit extent.
Definition extent3.hpp:330
constexpr friend extent3 operator-(extent3 const &lhs, extent3 const &rhs) noexcept
Subtract two extents from each other.
Definition extent3.hpp:208
constexpr friend extent3 operator*(extent3 const &lhs, float const &rhs) noexcept
Scale the extent by a scaler.
Definition extent3.hpp:218
constexpr float depth() const noexcept
Access the z-as-depth element from the extent.
Definition extent3.hpp:173
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent3.hpp:129
constexpr float & depth() noexcept
Access the z-as-depth element from the extent.
Definition extent3.hpp:140
constexpr float width() const noexcept
Access the x-as-width element from the extent.
Definition extent3.hpp:151
constexpr friend bool operator==(extent3 const &lhs, extent3 const &rhs) noexcept
Compare if two extents are equal.
Definition extent3.hpp:268
constexpr extent3() noexcept
Construct a empty extent / zero length.
Definition extent3.hpp:78
constexpr bool holds_invariant() const noexcept
Check if the extent is valid.
Definition extent3.hpp:369
constexpr friend extent3 operator*(float const &lhs, extent3 const &rhs) noexcept
Scale the extent by a scaler.
Definition extent3.hpp:258
friend float hypot(extent3 const &rhs) noexcept
Get the length of the extent.
Definition extent3.hpp:312
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent3.hpp:118
hi_force_inline constexpr friend float squared_hypot(extent3 const &rhs) noexcept
Get the squared length of the extent.
Definition extent3.hpp:303
constexpr friend extent3 operator+(extent3 const &lhs, extent3 const &rhs) noexcept
Add two extents from each other.
Definition extent3.hpp:198
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector2.hpp:19
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:20
T signaling_NaN(T... args)