7#include "translate2.hpp"
9#include "../macros.hpp"
12namespace hi {
inline namespace v1 {
15[[nodiscard]]
constexpr point3 operator*(
translate3 const& lhs, point3
const& rhs)
noexcept;
20 using array_type = simd<float, 4>;
21 using value_type = array_type::value_type;
28 [[nodiscard]]
constexpr translate3() noexcept : _v(0.0f, 0.0f, 0.0f, 0.0f) {}
30 [[nodiscard]]
constexpr explicit operator array_type()
const noexcept
37 hi_axiom(holds_invariant());
41 _v(
static_cast<array_type
>(get<0>(
other)).xy00())
46 : _v(
static_cast<array_type
>(get<0>(
other)).xy00())
60 [[nodiscard]]
constexpr explicit operator translate2()
const noexcept
68 : _v(
static_cast<array_type
>(
other))
72 [[nodiscard]]
constexpr explicit translate3(point3
const&
other) noexcept
73 : _v(
static_cast<array_type
>(
other).xyz0())
77 [[nodiscard]]
constexpr translate3(
float x,
float y,
float z = 0.0f) noexcept
82 [[nodiscard]]
constexpr float x()
const noexcept
87 [[nodiscard]]
constexpr float y()
const noexcept
92 [[nodiscard]]
constexpr float z()
const noexcept
97 [[nodiscard]]
constexpr float& x()
noexcept
102 [[nodiscard]]
constexpr float& y()
noexcept
107 [[nodiscard]]
constexpr float& z()
noexcept
118 [[nodiscard]]
constexpr static translate3
align(
125 x = dst_rectangle.left();
128 x = dst_rectangle.right() - src_rectangle.width();
131 x = dst_rectangle.center() - src_rectangle.width() * 0.5f;
139 y = dst_rectangle.bottom();
142 y = dst_rectangle.top() - src_rectangle.height();
145 y = dst_rectangle.middle() - src_rectangle.height() * 0.5f;
151 return translate3{x - src_rectangle.left(), y - src_rectangle.bottom()};
154 [[nodiscard]]
constexpr friend bool operator==(
translate3 const& lhs,
translate3 const& rhs)
noexcept
156 return equal(lhs._v, rhs._v);
159 [[nodiscard]]
constexpr translate3 operator~() const noexcept
164 [[nodiscard]]
constexpr bool holds_invariant() const noexcept
166 return _v.w() == 0.0f;
169 [[nodiscard]]
friend constexpr translate3 round(translate3
const& rhs)
noexcept
171 return translate3{round(rhs._v)};
178[[nodiscard]]
constexpr translate3 translate_z(
float z)
noexcept
@ middle
Align to the vertical-middle.
Definition alignment.hpp:33
@ bottom
Align to the bottom.
Definition alignment.hpp:37
@ top
Align to the top.
Definition alignment.hpp:29
@ right
Align the text to the right side.
Definition alignment.hpp:137
@ left
Align the text to the left side.
Definition alignment.hpp:119
@ center
Align the text in the center.
Definition alignment.hpp:125
@ 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
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:29
Horizontal/Vertical alignment combination.
Definition alignment.hpp:242
Definition translate2.hpp:14
Definition translate3.hpp:18
static constexpr translate3 align(aarectangle src_rectangle, aarectangle dst_rectangle, alignment alignment) noexcept
Align a rectangle within another rectangle.
Definition translate3.hpp:118
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:20