23 rect(
rect const &rhs)
noexcept =
default;
24 rect &operator=(
rect const &rhs)
noexcept =
default;
26 rect &operator=(
rect &&rhs)
noexcept =
default;
29 corners({corner0, corner1, corner2, corner3}) {}
35 corners[0] = rhs.
corner<0>();
36 corners[1] = rhs.
corner<1>();
37 corners[2] = rhs.
corner<2>();
38 corners[3] = rhs.
corner<3>();
45 corner0 + extent.x000(),
46 corner0 + extent._0y00(),
47 corner0 + extent.xy00()
50 tt_axiom(corner0.is_point());
51 tt_axiom(extent.is_vector());
52 tt_axiom(extent.z() == 0.0);
58 return corner<1>() - corner<0>();
64 return corner<2>() - corner<0>();
67 float width() const noexcept {
71 float height() const noexcept {
75 f32x4 extent() const noexcept {
76 return {width(), height()};
79 aarect aabb() const noexcept {
81 return aarect::p0p3(std::get<0>(corners).xy01(), std::get<3>(corners).xy01());
91 static_assert(I <= 3);
92 return std::get<I>(corners);
95 [[nodiscard]]
friend rect expand(
rect const &lhs,
float rhs)
noexcept {
96 ttlet rightDirection = normalize<0b0111>(lhs.right_vector());
97 ttlet upDirection = normalize<0b0111>(lhs.up_vector());
100 lhs.corner<0>() + rhs * -rightDirection + rhs * -upDirection,
101 lhs.corner<1>() + rhs * rightDirection + rhs * -upDirection,
102 lhs.
corner<2>() + rhs * -rightDirection + rhs * upDirection,
103 lhs.corner<3>() + rhs * rightDirection + rhs * upDirection