8#include "geometry/extent.hpp"
27 tt_axiom(
min.is_valid() &&
max.is_valid());
28 tt_axiom(
min.width() <=
max.width());
29 tt_axiom(
min.height() <=
max.height());
53 [[nodiscard]]
static interval_extent2 make_minimum(
float x,
float y)
noexcept
55 return make_minimum(
extent2{x, y});
63 [[nodiscard]]
static interval_extent2 make_maximum(
float x,
float y)
noexcept
65 return make_maximum(
extent2{x, y});
73 [[nodiscard]]
static interval_extent2 make_zero_to_maximum(
float x,
float y)
noexcept
75 return make_zero_to_maximum(
extent2{x, y});
78 [[nodiscard]]
extent2 minimum()
const noexcept
80 return extent2{(-value).xy00()};
83 [[nodiscard]]
extent2 maximum()
const noexcept
88 [[nodiscard]]
finterval width()
const noexcept
93 [[nodiscard]]
finterval height()
const noexcept
106 value -= rhs.value.yxwz();
112 return make(lhs.value + rhs.value);
117 return make(lhs.value - rhs.value.yxwz());
122 return lhs.value == rhs.value;
129 return lhs.width() < rhs.minimum().
width() || lhs.height() < rhs.minimum().
height();
136 return lhs.width() > rhs.maximum().
width() || lhs.height() > rhs.maximum().
height();
140 return fmt::format(
"({}:{}, {}:{})", rhs.value.x(), rhs.value.z(), rhs.value.y(), rhs.value.w());
145 return lhs << to_string(rhs);
155 return make(
min(lhs.value, rhs.value));
163 return make(
max(lhs.value, rhs.value));
170 ttlet tmp_max =
max(lhs.value, rhs.value);
171 ttlet tmp_min =
min(lhs.value, rhs.value);
172 return make(tmp_max.xy00() + tmp_min._00zw());
179 ttlet tmp_max =
max(lhs.value, rhs.value);
180 ttlet tmp_min =
min(lhs.value, rhs.value);
181 return make(tmp_min.xy00() + tmp_max._00zw());
187 tt_axiom(-other.x() <= other.z());
188 tt_axiom(-other.y() <= other.w());
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent.hpp:91
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent.hpp:102
Definition interval.hpp:17
A 2D vector using interval arithmetic.
Definition interval_extent2.hpp:18
friend interval_extent2 merge(interval_extent2 const &lhs, interval_extent2 const &rhs) noexcept
Merge two intervals.
Definition interval_extent2.hpp:161
friend bool operator>>(extent2 const &lhs, interval_extent2 const &rhs) noexcept
Check if lhs.x or lhs.y is larger then rhs.maximum.
Definition interval_extent2.hpp:134
friend interval_extent2 max(interval_extent2 const &lhs, interval_extent2 const &rhs) noexcept
Get the minimum interval of both operants.
Definition interval_extent2.hpp:177
friend interval_extent2 intersect(interval_extent2 const &lhs, interval_extent2 const &rhs) noexcept
Intersect two intervals.
Definition interval_extent2.hpp:153
friend interval_extent2 min(interval_extent2 const &lhs, interval_extent2 const &rhs) noexcept
Get the maximum interval of both operants.
Definition interval_extent2.hpp:168
friend bool operator<<(extent2 const &lhs, interval_extent2 const &rhs) noexcept
Check if lhs.x or lhs.y is smaller then rhs.minimum.
Definition interval_extent2.hpp:127