mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
fix
This commit is contained in:
@@ -32,7 +32,7 @@ namespace omath::collision
|
|||||||
|
|
||||||
struct Result final
|
struct Result final
|
||||||
{
|
{
|
||||||
VectorType normal{}; // outward normal (from B to A)
|
VectorType normal{}; // from A to B
|
||||||
VectorType penetration_vector;
|
VectorType penetration_vector;
|
||||||
float depth{0.0f};
|
float depth{0.0f};
|
||||||
int iterations{0};
|
int iterations{0};
|
||||||
@@ -86,17 +86,17 @@ namespace omath::collision
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
const int fidx = heap.top().idx;
|
const int fidx = heap.top().idx;
|
||||||
const Face f = faces[fidx];
|
const Face face = faces[fidx];
|
||||||
|
|
||||||
// Get the furthest point in face normal direction
|
// Get the furthest point in face normal direction
|
||||||
const VectorType p = support_point(a, b, f.n);
|
const VectorType p = support_point(a, b, face.n);
|
||||||
const float p_dist = f.n.dot(p);
|
const float p_dist = face.n.dot(p);
|
||||||
|
|
||||||
// Converged if we can’t push the face closer than tolerance
|
// Converged if we can’t push the face closer than tolerance
|
||||||
if (p_dist - f.d <= params.tolerance)
|
if (p_dist - face.d <= params.tolerance)
|
||||||
{
|
{
|
||||||
out.normal = f.n;
|
out.normal = face.n;
|
||||||
out.depth = f.d; // along unit normal
|
out.depth = face.d; // along unit normal
|
||||||
out.iterations = it + 1;
|
out.iterations = it + 1;
|
||||||
out.num_vertices = static_cast<int>(vertexes.size());
|
out.num_vertices = static_cast<int>(vertexes.size());
|
||||||
out.num_faces = static_cast<int>(faces.size());
|
out.num_faces = static_cast<int>(faces.size());
|
||||||
|
|||||||
Reference in New Issue
Block a user