fixed naming

This commit is contained in:
2025-12-06 14:49:30 +03:00
parent 3831bc0999
commit 27c1d147c5
2 changed files with 13 additions and 12 deletions

View File

@@ -6,10 +6,10 @@
#include <cstdint>
#include <limits>
#include <memory>
#include <memory_resource>
#include <queue>
#include <utility>
#include <vector>
#include <memory_resource>
namespace omath::collision
{
@@ -23,11 +23,11 @@ namespace omath::collision
{ a / s } -> std::same_as<V>;
};
template<class ColliderType>
template<class ColliderInterfaceType>
class Epa final
{
public:
using VectorType = ColliderType::VectorType;
using VectorType = ColliderInterfaceType::VectorType;
static_assert(EpaVector<VectorType>, "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<Result> solve(const ColliderType& a, const ColliderType& b,
static std::optional<Result> solve(const ColliderInterfaceType& a, const ColliderInterfaceType& b,
const Simplex<VectorType>& simplex, const Params params = {},
std::shared_ptr<std::pmr::memory_resource> mem_resource = {
std::shared_ptr<void>{}, 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);
}

View File

@@ -14,29 +14,29 @@ namespace omath::collision
Simplex<VertexType> simplex; // valid only if hit == true and size==4
};
template<class ColliderType>
template<class ColliderInterfaceType>
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<VectorType> is_collide_with_simplex_info(const ColliderType& collider_a,
const ColliderType& collider_b)
static GjkHitInfo<VectorType> 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});