22 #ifndef PLAYRHO_COLLISION_AABB_HPP
23 #define PLAYRHO_COLLISION_AABB_HPP
56 template <std::
size_t N>
74 template<
typename... Tail>
76 Tail... tail) noexcept:
77 ranges{head, LengthInterval(tail)...}
90 for (
auto i = decltype(N){0}; i < N; ++i)
92 ranges[i] = LengthInterval{p[i]};
101 for (
auto i = decltype(N){0}; i < N; ++i)
103 ranges[i] = LengthInterval{a[i], b[i]};
114 template <std::
size_t N>
117 for (
auto i = decltype(N){0}; i < N; ++i)
119 if (lhs.ranges[i] != rhs.ranges[i])
130 template <std::
size_t N>
133 return !(lhs == rhs);
138 template <std::
size_t N>
141 return std::lexicographical_compare(cbegin(lhs.ranges), cend(lhs.ranges),
142 cbegin(rhs.ranges), cend(rhs.ranges),
143 std::less<LengthInterval>{});
148 template <std::
size_t N>
151 const auto lhsEnd = cend(lhs.ranges);
152 const auto rhsEnd = cend(rhs.ranges);
153 const auto diff = std::mismatch(cbegin(lhs.ranges), lhsEnd,
154 cbegin(rhs.ranges), rhsEnd);
160 template <std::
size_t N>
163 return std::lexicographical_compare(cbegin(lhs.ranges), cend(lhs.ranges),
164 cbegin(rhs.ranges), cend(rhs.ranges),
165 std::greater<LengthInterval>{});
170 template <std::
size_t N>
173 const auto lhsEnd = cend(lhs.ranges);
174 const auto rhsEnd = cend(rhs.ranges);
175 const auto diff = std::mismatch(cbegin(lhs.ranges), lhsEnd,
176 cbegin(rhs.ranges), rhsEnd);
183 template <std::
size_t N>
186 for (
auto i = decltype(N){0}; i < N; ++i)
197 template <std::
size_t N>
201 for (
auto i = decltype(N){0}; i < N; ++i)
210 template <std::
size_t N>
214 for (
auto i = decltype(N){0}; i < N; ++i)
223 template <std::
size_t N>
227 for (
auto i = decltype(N){0}; i < N; ++i)
229 result[i] =
GetSize(aabb.ranges[i]);
236 template <std::
size_t N>
251 template <std::
size_t N>
254 for (
auto i = decltype(N){0}; i < N; ++i)
266 template <std::
size_t N>
269 for (
auto i = decltype(N){0}; i < N; ++i)
271 var.ranges[i].Include(value[i]);
281 template <std::
size_t N>
284 for (
auto i = decltype(N){0}; i < N; ++i)
286 var.ranges[i].Include(val.ranges[i]);
292 template <std::
size_t N>
295 for (
auto i = decltype(N){0}; i < N; ++i)
297 var.ranges[i].Move(value[i]);
304 template <std::
size_t N>
307 for (
auto i = decltype(N){0}; i < N; ++i)
309 var.ranges[i].ExpandEqually(amount);
317 template <std::
size_t N>
320 for (
auto i = decltype(N){0}; i < N; ++i)
322 aabb.
ranges[i].Expand(displacement[i]);
329 template <std::
size_t N>
332 return Fatten(aabb, amount);
337 template <std::
size_t N>
340 return Move(aabb, value);
345 template <std::
size_t N>
353 template <std::
size_t N>
357 for (
auto i = decltype(N){0}; i < N; ++i)
359 result[i] = aabb.ranges[i].GetMin();
366 template <std::
size_t N>
370 for (
auto i = decltype(N){0}; i < N; ++i)
372 result[i] = aabb.ranges[i].GetMax();
378 template <std::
size_t N>
382 auto multiple =
false;
383 for (
const auto& range: value.
ranges)
408 struct Transformation;
435 AABB ComputeAABB(
const DistanceProxy& proxy,
const Transformation& xf) noexcept;
447 const Transformation& xfm0,
const Transformation& xfm1) noexcept;
451 AABB ComputeAABB(
const Shape& shape,
const Transformation& xf) noexcept;
485 return d2::AABB{LengthInterval{GetInvalid<Length>()}, LengthInterval{GetInvalid<Length>()}};
490 #endif // PLAYRHO_COLLISION_AABB_HPP