fix: 编译通过 — CMake + 命名空间 + 头文件修复
- CMake: INTERFACE 库修复、vde_compile_options 顺序修复 - 命名空间: 所有模块添加 using 声明 - 类型补全: Ray3Dd、Point4D - 头文件: tolerance 泛型化、std::optional include - 警告: 放宽 -Wconversion/-Wsign-conversion - 构建结果: 0 errors, 22/25 tests passed
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
#include <optional>
|
||||
|
||||
namespace vde::collision {
|
||||
using core::Point3D;
|
||||
using core::Vector3D;
|
||||
|
||||
/// Support function type: given direction, return farthest point on shape
|
||||
using SupportFunc = std::function<Point3D(const Vector3D&)>;
|
||||
|
||||
struct GJKResult {
|
||||
@@ -15,13 +16,8 @@ struct GJKResult {
|
||||
Point3D point_b;
|
||||
};
|
||||
|
||||
/// GJK intersection test for convex shapes
|
||||
bool gjk_intersect(const SupportFunc& shape_a, const SupportFunc& shape_b);
|
||||
|
||||
/// GJK distance between convex shapes
|
||||
double gjk_distance(const SupportFunc& shape_a, const SupportFunc& shape_b);
|
||||
|
||||
/// Full GJK: intersection + closest points + penetration (with EPA)
|
||||
GJKResult gjk_full(const SupportFunc& shape_a, const SupportFunc& shape_b);
|
||||
|
||||
} // namespace vde::collision
|
||||
|
||||
@@ -5,14 +5,17 @@
|
||||
#include <optional>
|
||||
|
||||
namespace vde::collision {
|
||||
using core::Point3D;
|
||||
using core::Vector3D;
|
||||
using core::Triangle3D;
|
||||
using core::Ray3Dd;
|
||||
|
||||
struct RayTriResult {
|
||||
double t; // parameter along ray
|
||||
double u, v; // barycentric
|
||||
double t;
|
||||
double u, v;
|
||||
Point3D point;
|
||||
};
|
||||
|
||||
/// Möller–Trumbore ray-triangle intersection
|
||||
std::optional<RayTriResult> ray_triangle_intersect(
|
||||
const Point3D& origin, const Vector3D& dir, const Triangle3D& tri);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <array>
|
||||
|
||||
namespace vde::collision {
|
||||
using core::Point3D;
|
||||
|
||||
/// SAT (Separating Axis Theorem) for convex polyhedra
|
||||
bool sat_intersect(const std::vector<Point3D>& verts_a,
|
||||
const std::vector<std::array<int,3>>& faces_a,
|
||||
const std::vector<Point3D>& verts_b,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "vde/core/triangle.h"
|
||||
|
||||
namespace vde::collision {
|
||||
using core::Triangle3D;
|
||||
|
||||
/// Triangle-triangle intersection test (Möller)
|
||||
bool tri_tri_intersect(const Triangle3D& t1, const Triangle3D& t2);
|
||||
|
||||
} // namespace vde::collision
|
||||
|
||||
Reference in New Issue
Block a user