22 tt_force_inline
rect(
rect const &rhs)
noexcept =
default;
23 tt_force_inline
rect &operator=(
rect const &rhs)
noexcept =
default;
24 tt_force_inline
rect(
rect &&rhs)
noexcept =
default;
25 tt_force_inline
rect &operator=(
rect &&rhs)
noexcept =
default;
28 corners({corner0, corner1, corner2, corner3}) {}
34 corners[0] = rhs.
corner<0>();
35 corners[1] = rhs.
corner<1>();
36 corners[2] = rhs.
corner<2>();
37 corners[3] = rhs.
corner<3>();
44 corner0 + extent.x000(),
45 corner0 + extent._0y00(),
46 corner0 + extent.xy00()
49 tt_assume(corner0.is_point());
50 tt_assume(extent.is_vector());
51 tt_assume(extent.z() == 0.0);
57 return corner<1>() - corner<0>();
63 return corner<2>() - corner<0>();
66 float width() const noexcept {
67 return length(
right());
70 float height() const noexcept {
74 vec extent() const noexcept {
75 return {width(), height()};
84 [[nodiscard]] tt_force_inline
vec corner() const noexcept {
85 static_assert(I <= 3);
86 return std::get<I>(corners);
89 [[nodiscard]]
friend rect expand(
rect const &lhs,
float rhs)
noexcept {
90 ttlet rightDirection = normalize(lhs.right());
91 ttlet upDirection = normalize(lhs.up());
94 lhs.corner<0>() + rhs * -rightDirection + rhs * -upDirection,
95 lhs.corner<1>() + rhs * rightDirection + rhs * -upDirection,
96 lhs.
corner<2>() + rhs * -rightDirection + rhs * upDirection,
97 lhs.corner<3>() + rhs * rightDirection + rhs * upDirection