removed nesting

This commit is contained in:
2025-12-14 11:08:06 +03:00
parent e10cbf9356
commit 90c4ea2036

View File

@@ -115,9 +115,9 @@ 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) const auto best = *std::ranges::min_element(faces, [](const auto& first, const auto& second)
{ return first.d < second.d; }); { return first.d < second.d; });
out.normal = best.n; out.normal = best.n;
@@ -129,8 +129,6 @@ namespace omath::collision
return out; return out;
} }
return std::nullopt;
}
private: private:
struct Face final struct Face final