2026-07-23 05:27:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include "vde/core/point.h"
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
namespace vde::collision {
|
2026-07-23 08:19:24 +00:00
|
|
|
using core::Point3D;
|
|
|
|
|
using core::Vector3D;
|
2026-07-23 05:27:51 +00:00
|
|
|
|
|
|
|
|
using SupportFunc = std::function<Point3D(const Vector3D&)>;
|
|
|
|
|
|
|
|
|
|
struct GJKResult {
|
|
|
|
|
bool intersect;
|
|
|
|
|
double distance;
|
|
|
|
|
Point3D point_a;
|
|
|
|
|
Point3D point_b;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool gjk_intersect(const SupportFunc& shape_a, const SupportFunc& shape_b);
|
|
|
|
|
double gjk_distance(const SupportFunc& shape_a, const SupportFunc& shape_b);
|
|
|
|
|
GJKResult gjk_full(const SupportFunc& shape_a, const SupportFunc& shape_b);
|
|
|
|
|
|
|
|
|
|
} // namespace vde::collision
|