2026-07-23 05:27:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include "vde/core/triangle.h"
|
2026-07-23 12:36:39 +00:00
|
|
|
#include "vde/core/aabb.h"
|
2026-07-23 05:27:51 +00:00
|
|
|
|
|
|
|
|
namespace vde::collision {
|
2026-07-23 08:19:24 +00:00
|
|
|
using core::Triangle3D;
|
2026-07-23 12:36:39 +00:00
|
|
|
using core::AABB3D;
|
|
|
|
|
using core::Point3D;
|
2026-07-23 05:27:51 +00:00
|
|
|
|
2026-07-23 12:36:39 +00:00
|
|
|
// Separating-axis test for two triangles
|
2026-07-23 05:27:51 +00:00
|
|
|
bool tri_tri_intersect(const Triangle3D& t1, const Triangle3D& t2);
|
|
|
|
|
|
2026-07-23 12:36:39 +00:00
|
|
|
// Detailed tri-tri intersection — returns the intersection segment
|
|
|
|
|
struct TriTriIntersection {
|
|
|
|
|
bool intersects;
|
|
|
|
|
Point3D p0, p1;
|
|
|
|
|
};
|
|
|
|
|
TriTriIntersection tri_tri_intersect_detailed(const Triangle3D& t1,
|
|
|
|
|
const Triangle3D& t2);
|
|
|
|
|
|
|
|
|
|
// Fast SAT test: triangle vs AABB (13 separating axes)
|
|
|
|
|
bool tri_aabb_overlap(const Triangle3D& tri, const AABB3D& box);
|
|
|
|
|
|
2026-07-23 05:27:51 +00:00
|
|
|
} // namespace vde::collision
|