10#include "../macros.hpp"
15hi_export_module(hikogui.geometry : scale3);
17hi_export
namespace hi {
inline namespace v1 {
22 using value_type = array_type::value_type;
26 constexpr scale3& operator=(
scale3 const&)
noexcept =
default;
27 constexpr scale3& operator=(
scale3&&)
noexcept =
default;
31 [[nodiscard]]
constexpr explicit operator scale2()
const noexcept
38 [[nodiscard]]
constexpr explicit operator f32x4()
const noexcept
43 [[nodiscard]]
constexpr explicit scale3(
f32x4 const& v) noexcept : _v(v)
45 hi_axiom(holds_invariant());
48 [[nodiscard]]
constexpr explicit scale3(
vector3 const& v) noexcept : _v(
static_cast<f32x4>(v).xyz1()) {}
50 [[nodiscard]]
constexpr scale3() noexcept : _v(1.0f, 1.0f, 1.0f, 1.0f) {}
52 [[nodiscard]]
constexpr scale3(
float value) noexcept : _v(value, value, value, 1.0f) {}
54 [[nodiscard]]
constexpr scale3(
float x,
float y,
float z = 1.0f) noexcept : _v(x, y, z, 1.0f) {}
63 auto const non_uniform_scale =
static_cast<f32x4>(dst_extent).xyzx() /
static_cast<f32x4>(src_extent).xyzx();
64 auto const uniform_scale =
std::min({non_uniform_scale.x(), non_uniform_scale.y(), non_uniform_scale.z()});
65 return scale3{uniform_scale};
68 [[nodiscard]]
constexpr friend bool operator==(
scale3 const& lhs,
scale3 const& rhs)
noexcept
70 return equal(lhs._v, rhs._v);
73 [[nodiscard]]
constexpr bool holds_invariant() const noexcept
75 return _v.w() == 1.0f;
78 [[nodiscard]]
constexpr float& x() noexcept
83 [[nodiscard]]
constexpr float& y() noexcept
88 [[nodiscard]]
constexpr float& z() noexcept
93 [[nodiscard]]
constexpr float x() const noexcept
98 [[nodiscard]]
constexpr float y() const noexcept
103 [[nodiscard]]
constexpr float z() const noexcept
112[[nodiscard]]
constexpr scale3 operator/(extent3
const& lhs, extent3
const& rhs)
noexcept
114 return scale3{f32x4{lhs}.xyz1() / f32x4{rhs}.xyz1()};
Defined the geo::extent, extent2 and extent3 types.
@ other
The gui_event does not have associated data.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Definition simd_intf.hpp:18
A high-level geometric extent.
Definition extent3.hpp:33
static constexpr scale3 uniform(extent3 src_extent, extent3 dst_extent) noexcept
Get a uniform-scale-transform to scale an extent to another extent.
Definition scale3.hpp:61
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:26