mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
removed nesting
This commit is contained in:
@@ -115,21 +115,19 @@ namespace omath::collision
|
|||||||
out.iterations = it + 1;
|
out.iterations = it + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: pick closest face as best-effort answer
|
if (faces.empty())
|
||||||
if (!faces.empty())
|
return std::nullopt;
|
||||||
{
|
|
||||||
const auto best = *std::ranges::min_element(faces, [](const auto& first, const auto& second)
|
|
||||||
{ return first.d < second.d; });
|
|
||||||
out.normal = best.n;
|
|
||||||
out.depth = best.d;
|
|
||||||
out.num_vertices = static_cast<int>(vertexes.size());
|
|
||||||
out.num_faces = static_cast<int>(faces.size());
|
|
||||||
|
|
||||||
out.penetration_vector = out.normal * out.depth;
|
const auto best = *std::ranges::min_element(faces, [](const auto& first, const auto& second)
|
||||||
|
{ return first.d < second.d; });
|
||||||
|
out.normal = best.n;
|
||||||
|
out.depth = best.d;
|
||||||
|
out.num_vertices = static_cast<int>(vertexes.size());
|
||||||
|
out.num_faces = static_cast<int>(faces.size());
|
||||||
|
|
||||||
return out;
|
out.penetration_vector = out.normal * out.depth;
|
||||||
}
|
|
||||||
return std::nullopt;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user