7#include "translate2.hpp"
9#include "../macros.hpp"
14hi_export_module(hikogui.geometry : translate3);
16hi_export
namespace hi {
inline namespace v1 {
19[[nodiscard]]
constexpr point3
operator*(translate3
const& lhs, point3
const& rhs)
noexcept;
25 using value_type = array_type::value_type;
32 [[nodiscard]]
constexpr translate3() noexcept : _v(0.0f, 0.0f, 0.0f, 0.0f) {}
34 [[nodiscard]]
constexpr explicit operator array_type()
const noexcept
41 hi_axiom(holds_invariant());
45 _v(
static_cast<array_type
>(get<0>(
other)).xy00())
50 : _v(
static_cast<array_type
>(get<0>(
other)).xy00())
64 [[nodiscard]]
constexpr explicit operator translate2()
const noexcept
72 : _v(
static_cast<array_type
>(
other))
76 [[nodiscard]]
constexpr explicit translate3(point3
const&
other) noexcept
77 : _v(
static_cast<array_type
>(
other).xyz0())
81 [[nodiscard]]
constexpr translate3(
float x,
float y,
float z = 0.0f) noexcept
86 [[nodiscard]]
constexpr float x()
const noexcept
91 [[nodiscard]]
constexpr float y()
const noexcept
96 [[nodiscard]]
constexpr float z()
const noexcept
101 [[nodiscard]]
constexpr float& x()
noexcept
106 [[nodiscard]]
constexpr float& y()
noexcept
111 [[nodiscard]]
constexpr float& z()
noexcept
129 x = dst_rectangle.left();
132 x = dst_rectangle.right() - src_rectangle.width();
135 x = dst_rectangle.center() - src_rectangle.width() * 0.5f;
143 y = dst_rectangle.bottom();
146 y = dst_rectangle.top() - src_rectangle.height();
149 y = dst_rectangle.middle() - src_rectangle.height() * 0.5f;
155 return translate3{x - src_rectangle.left(), y - src_rectangle.bottom()};
158 [[nodiscard]]
constexpr friend bool operator==(
translate3 const& lhs,
translate3 const& rhs)
noexcept
160 return equal(lhs._v, rhs._v);
163 [[nodiscard]]
constexpr translate3 operator~() const noexcept
168 [[nodiscard]]
constexpr bool holds_invariant() const noexcept
170 return _v.w() == 0.0f;
173 [[nodiscard]]
friend constexpr translate3 round(translate3
const& rhs)
noexcept
175 return translate3{round(rhs._v)};
182[[nodiscard]]
constexpr translate3 translate_z(
float z)
noexcept
184 return translate3{0.0f, 0.0f, z};
@ middle
Align to the vertical-middle.
@ bottom
Align to the bottom.
@ right
Align the text to the right side.
@ left
Align the text to the left side.
@ center
Align the text in the center.
@ other
The gui_event does not have associated data.
The HikoGUI namespace.
Definition array_generic.hpp:20
constexpr matrix2 operator*(matrix2 const &lhs, matrix2 const &rhs) noexcept
Matrix/Matrix multiplication.
Definition transform.hpp:69
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Definition simd_intf.hpp:18
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:33
Horizontal/Vertical alignment combination.
Definition alignment.hpp:244
Definition translate2.hpp:18
Definition translate3.hpp:22
static constexpr translate3 align(aarectangle src_rectangle, aarectangle dst_rectangle, alignment alignment) noexcept
Align a rectangle within another rectangle.
Definition translate3.hpp:122
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:26