13#include "../SIMD/SIMD.hpp"
14#include "../utility/utility.hpp"
15#include "../macros.hpp"
22hi_export_module(hikogui.geometry : extent3);
24hi_export
namespace hi {
inline namespace v1 {
36 using value_type = array_type::value_type;
71 return _v.x() != 0.0f
or _v.y() != 0.0f
or _v.z() != 0.0f;
76 return vector3{
static_cast<array_type
>(*this)};
188 return vector3{_v._0y00()};
193 return *
this = *
this + rhs;
203 return extent3{lhs._v + rhs._v};
213 return extent3{lhs._v - rhs._v};
223 return extent3{lhs._v * array_type::broadcast(rhs)};
228 return extent3{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
233 return extent3{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
238 return vector3{
static_cast<array_type
>(lhs) +
static_cast<array_type
>(rhs)};
250 r._v[i] = lhs._v[i] + rhs;
263 return extent3{array_type::broadcast(lhs) * rhs._v};
273 return equal(lhs._v, rhs._v);
276 [[
nodiscard]]
constexpr friend std::partial_ordering operator<=>(
extent3 const& lhs,
extent3 const& rhs)
noexcept
280 auto const equal = (lhs._v == rhs._v).mask() & mask;
283 return std::partial_ordering::equivalent;
286 auto const less = (lhs._v < rhs._v).mask() & mask;
287 if ((less | equal) == mask) {
289 return std::partial_ordering::less;
292 auto const greater = (lhs._v < rhs._v).mask() & mask;
293 if ((greater | equal) == mask) {
295 return std::partial_ordering::greater;
299 return std::partial_ordering::unordered;
340 return extent3{ceil(array_type{rhs})};
345 return extent3{floor(
static_cast<array_type
>(rhs))};
350 return extent3{round(
static_cast<array_type
>(rhs))};
355 return extent3{min(
static_cast<array_type
>(lhs),
static_cast<array_type
>(rhs))};
360 return extent3{max(
static_cast<array_type
>(lhs),
static_cast<array_type
>(rhs))};
365 return extent3{clamp(
static_cast<array_type
>(value),
static_cast<array_type
>(min),
static_cast<array_type
>(max))};
374 return _v.x() >= 0.0f
and _v.y() >= 0.0f
and _v.z() >= 0.0f
and _v.w() == 0.0f;
379 return std::format(
"[{}, {}, {}]", rhs._v.x(), rhs._v.y(), rhs._v.z());
384 return lhs << to_string(rhs);
395struct std::formatter<
hi::extent3, char> {
403 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_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378
A high-level geometric extent.
Definition extent2.hpp:32
A high-level geometric extent.
Definition extent3.hpp:33
constexpr extent3(extent2 const &other) noexcept
Construct a extent from a lower dimension extent.
Definition extent3.hpp:45
constexpr friend extent3 operator+(extent3 const &lhs, float const &rhs) noexcept
Add a scaler to the extent.
Definition extent3.hpp:246
constexpr float height() const noexcept
Access the y-as-height element from the extent.
Definition extent3.hpp:165
constexpr friend float rcp_hypot(extent3 const &rhs) noexcept
Get the length of the extent.
Definition extent3.hpp:324
constexpr extent3(float width, float height, float depth=0.0f) noexcept
Construct a 3D extent from width, height and depth.
Definition extent3.hpp:88
constexpr friend extent3 normalize(extent3 const &rhs) noexcept
Normalize a extent to a unit extent.
Definition extent3.hpp:333
constexpr friend extent3 operator-(extent3 const &lhs, extent3 const &rhs) noexcept
Subtract two extents from each other.
Definition extent3.hpp:211
constexpr friend extent3 operator*(extent3 const &lhs, float const &rhs) noexcept
Scale the extent by a scaler.
Definition extent3.hpp:221
constexpr float depth() const noexcept
Access the z-as-depth element from the extent.
Definition extent3.hpp:176
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent3.hpp:132
constexpr float & depth() noexcept
Access the z-as-depth element from the extent.
Definition extent3.hpp:143
constexpr float width() const noexcept
Access the x-as-width element from the extent.
Definition extent3.hpp:154
constexpr friend bool operator==(extent3 const &lhs, extent3 const &rhs) noexcept
Compare if two extents are equal.
Definition extent3.hpp:271
constexpr extent3() noexcept
Construct a empty extent / zero length.
Definition extent3.hpp:81
constexpr bool holds_invariant() const noexcept
Check if the extent is valid.
Definition extent3.hpp:372
constexpr friend extent3 operator*(float const &lhs, extent3 const &rhs) noexcept
Scale the extent by a scaler.
Definition extent3.hpp:261
friend float hypot(extent3 const &rhs) noexcept
Get the length of the extent.
Definition extent3.hpp:315
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent3.hpp:121
hi_force_inline constexpr friend float squared_hypot(extent3 const &rhs) noexcept
Get the squared length of the extent.
Definition extent3.hpp:306
constexpr friend extent3 operator+(extent3 const &lhs, extent3 const &rhs) noexcept
Add two extents from each other.
Definition extent3.hpp:201
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector2.hpp:26
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:26
Definition simd_intf.hpp:18
T signaling_NaN(T... args)