10#include "../macros.hpp"
12namespace hi {
inline namespace v1 {
16 using array_type = simd<float, 4>;
17 using value_type = array_type::value_type;
21 constexpr scale3& operator=(
scale3 const&)
noexcept =
default;
22 constexpr scale3& operator=(
scale3&&)
noexcept =
default;
26 [[nodiscard]]
constexpr explicit operator scale2()
const noexcept
33 [[nodiscard]]
constexpr explicit operator f32x4()
const noexcept
38 [[nodiscard]]
constexpr explicit scale3(f32x4
const& v) noexcept : _v(v)
40 hi_axiom(holds_invariant());
43 [[nodiscard]]
constexpr explicit scale3(
vector3 const& v) noexcept : _v(
static_cast<f32x4
>(v).xyz1()) {}
45 [[nodiscard]]
constexpr scale3() noexcept : _v(1.0f, 1.0f, 1.0f, 1.0f) {}
47 [[nodiscard]]
constexpr scale3(
float value) noexcept : _v(value, value, value, 1.0f) {}
49 [[nodiscard]]
constexpr scale3(
float x,
float y,
float z = 1.0f) noexcept : _v(x, y, z, 1.0f) {}
58 hilet non_uniform_scale =
static_cast<f32x4
>(dst_extent).xyzx() /
static_cast<f32x4
>(src_extent).xyzx();
59 hilet uniform_scale =
std::min({non_uniform_scale.x(), non_uniform_scale.y(), non_uniform_scale.z()});
60 return scale3{uniform_scale};
63 [[nodiscard]]
constexpr friend bool operator==(
scale3 const& lhs,
scale3 const& rhs)
noexcept
65 return equal(lhs._v, rhs._v);
68 [[nodiscard]]
constexpr bool holds_invariant() const noexcept
70 return _v.w() == 1.0f;
73 [[nodiscard]]
constexpr float& x() noexcept
78 [[nodiscard]]
constexpr float& y() noexcept
83 [[nodiscard]]
constexpr float& z() noexcept
88 [[nodiscard]]
constexpr float x() const noexcept
93 [[nodiscard]]
constexpr float y() const noexcept
98 [[nodiscard]]
constexpr float z() const noexcept
109 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.
Definition gui_event_variant.hpp:22
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
A high-level geometric extent.
Definition extent3.hpp:30
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:56
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:20