diff --git a/include/omath/collision/epa_algorithm.hpp b/include/omath/collision/epa_algorithm.hpp index c2ae8c2..e98cf05 100644 --- a/include/omath/collision/epa_algorithm.hpp +++ b/include/omath/collision/epa_algorithm.hpp @@ -6,10 +6,10 @@ #include #include #include +#include #include #include #include -#include namespace omath::collision { @@ -23,11 +23,11 @@ namespace omath::collision { a / s } -> std::same_as; }; - template + template class Epa final { public: - using VectorType = ColliderType::VectorType; + using VectorType = ColliderInterfaceType::VectorType; static_assert(EpaVector, "VertexType must satisfy EpaVector concept"); struct Result final @@ -48,7 +48,7 @@ namespace omath::collision // Precondition: simplex.size()==4 and contains the origin. [[nodiscard]] - static std::optional solve(const ColliderType& a, const ColliderType& b, + static std::optional solve(const ColliderInterfaceType& a, const ColliderInterfaceType& b, const Simplex& simplex, const Params params = {}, std::shared_ptr mem_resource = { std::shared_ptr{}, std::pmr::get_default_resource()}) @@ -245,7 +245,8 @@ namespace omath::collision } [[nodiscard]] - static VectorType support_point(const ColliderType& a, const ColliderType& b, const VectorType& dir) + static VectorType support_point(const ColliderInterfaceType& a, const ColliderInterfaceType& b, + const VectorType& dir) { return a.find_abs_furthest_vertex_position(dir) - b.find_abs_furthest_vertex_position(-dir); } diff --git a/include/omath/collision/gjk_algorithm.hpp b/include/omath/collision/gjk_algorithm.hpp index 8cce66d..b29bd25 100644 --- a/include/omath/collision/gjk_algorithm.hpp +++ b/include/omath/collision/gjk_algorithm.hpp @@ -14,29 +14,29 @@ namespace omath::collision Simplex simplex; // valid only if hit == true and size==4 }; - template + template class GjkAlgorithm final { - using VectorType = ColliderType::VectorType; + using VectorType = ColliderInterfaceType::VectorType; public: [[nodiscard]] - static VectorType find_support_vertex(const ColliderType& collider_a, const ColliderType& collider_b, - const VectorType& direction) + static VectorType find_support_vertex(const ColliderInterfaceType& collider_a, + const ColliderInterfaceType& collider_b, const VectorType& direction) { return collider_a.find_abs_furthest_vertex_position(direction) - collider_b.find_abs_furthest_vertex_position(-direction); } [[nodiscard]] - static bool is_collide(const ColliderType& collider_a, const ColliderType& collider_b) + static bool is_collide(const ColliderInterfaceType& collider_a, const ColliderInterfaceType& collider_b) { return is_collide_with_simplex_info(collider_a, collider_b).hit; } [[nodiscard]] - static GjkHitInfo is_collide_with_simplex_info(const ColliderType& collider_a, - const ColliderType& collider_b) + static GjkHitInfo is_collide_with_simplex_info(const ColliderInterfaceType& collider_a, + const ColliderInterfaceType& collider_b) { auto support = find_support_vertex(collider_a, collider_b, VectorType{1, 0, 0});