17namespace osc {
struct Sphere; }
24 return 0.5f * (aabb.
min + aabb.
max);
30 return aabb.
max - aabb.
min;
43 return dims.
x() * dims.
y() * dims.
z();
49 return aabb.
min == aabb.
max;
70 return AABB{.
min = x, .max = x};
94 constexpr std::optional<AABB>
bounding_aabb_of(std::optional<AABB> x, std::optional<AABB> y)
113 template<std::ranges::input_range R,
class Proj = std::
identity>
114 requires std::convertible_to<typename std::projected<std::ranges::iterator_t<R>, Proj>::value_type,
const Vector3&>
117 auto it = std::ranges::begin(r);
118 const auto last = std::ranges::end(r);
121 while (++it != last) {
129 template<std::ranges::input_range R,
class Proj = std::
identity>
130 requires std::convertible_to<typename std::projected<std::ranges::iterator_t<R>, Proj>::value_type,
const Vector3&>
133 if (std::ranges::begin(r) != std::ranges::end(r)) {
141 template<InputRangeWithSizeGreaterThan<0> R,
class Proj = std::
identity>
142 requires std::convertible_to<typename std::projected<std::ranges::iterator_t<R>, Proj>::value_type,
const Vector3&>
149 template<std::ranges::input_range Range,
class Proj = std::
identity>
150 requires std::convertible_to<typename std::projected<std::ranges::iterator_t<Range>, Proj>::value_type,
const AABB&>
153 auto it = std::ranges::begin(r);
154 auto const last = std::ranges::end(r);
159 AABB rv = std::invoke(proj, *it);
160 while (++it != last) {
169 template<std::ranges::input_range Range,
class Proj = std::
identity>
171 std::convertible_to<typename std::projected<std::ranges::iterator_t<Range>, Proj>::value_type,
const std::optional<AABB>&>
172 and (not std::convertible_to<
typename std::projected<std::ranges::iterator_t<Range>, Proj>::value_type,
const AABB&>)
175 auto it = std::ranges::begin(r);
176 const auto last = std::ranges::end(r);
179 std::optional<AABB> rv;
180 while (!rv && it != last) {
181 rv = std::invoke(proj, *it++);
188 for (; it != last; ++it) {
constexpr reference x()
Returns (*this)[0]
Definition vector.h:157
constexpr reference z()
Returns (*this)[2]
Definition vector.h:167
constexpr reference y()
Returns (*this)[1]
Definition vector.h:162
constexpr AABB bounding_aabb_of_nonempty_range(R &&r, Proj proj={})
Definition aabb_functions.h:115
Definition custom_decoration_generator.h:5
constexpr bool has_zero_volume(const AABB &aabb)
Definition aabb_functions.h:53
constexpr Vector3 half_widths_of(const AABB &aabb)
Definition aabb_functions.h:34
constexpr Vector3 centroid_of(const AABB &aabb)
Definition aabb_functions.h:22
constexpr Vector3 dimensions_of(const AABB &aabb)
Definition aabb_functions.h:28
constexpr bool is_point(const AABB &aabb)
Definition aabb_functions.h:47
constexpr AABB bounding_aabb_of(const Vector3 &x)
Definition aabb_functions.h:68
AABB transform_aabb(const Matrix4x4 &m, const AABB &aabb)
std::optional< Rect > loosely_project_into_ndc(const AABB &aabb, const Matrix4x4 &view_mat, const Matrix4x4 &proj_mat, float znear, float zfar)
Vector< float, 3 > Vector3
Definition vector.h:644
constexpr Vector< T, N > elementwise_max(const Vector< T, N > &x, const Vector< T, N > &y)
Definition common_functions.h:125
constexpr Vector< T, N > elementwise_min(const Vector< T, N > &x, const Vector< T, N > &y)
Definition common_functions.h:111
and
Definition algorithms.h:158
std::array< Vector3, 8 > corner_vertices_of(const AABB &aabb)
constexpr float volume_of(const AABB &aabb)
Definition aabb_functions.h:40
Vector3 min
Definition aabb.h:18
Vector3 max
Definition aabb.h:19