Refactors EPA algorithm loop

Replaces the `for(;;)` loop in the EPA algorithm with a `while(true)` loop for improved readability and clarity.

This change enhances the maintainability of the code without altering its functionality.
This commit is contained in:
2025-11-13 16:06:18 +03:00
parent 2699053102
commit 40e26be72e

View File

@@ -11,7 +11,8 @@
namespace omath::collision namespace omath::collision
{ {
template<class V> template<class V>
concept EpaVector = requires(const V& a, const V& b, float s) { concept EpaVector = requires(const V& a, const V& b, float s)
{
{ a - b } -> std::same_as<V>; { a - b } -> std::same_as<V>;
{ a.cross(b) } -> std::same_as<V>; { a.cross(b) } -> std::same_as<V>;
{ a.dot(b) } -> std::same_as<float>; { a.dot(b) } -> std::same_as<float>;
@@ -280,7 +281,7 @@ namespace omath::collision
simplex.push_front(support); simplex.push_front(support);
auto direction = -support; auto direction = -support;
for (;;) while (true)
{ {
support = find_support_vertex(a, b, direction); support = find_support_vertex(a, b, direction);
if (support.dot(direction) <= 0.f) if (support.dot(direction) <= 0.f)