comments
This commit is contained in:
parent
4d12dabb5f
commit
0f19eaf6e1
@ -79,6 +79,9 @@ namespace util { namespace polynomial {
|
|||||||
const float _c = coeffs[2];
|
const float _c = coeffs[2];
|
||||||
const float _d = coeffs[3];
|
const float _d = coeffs[3];
|
||||||
|
|
||||||
|
// Take care of degenerate quadratic cases. We can also pass off if 'd'
|
||||||
|
// is zero, but the benefit isn't clear given we have to merge results
|
||||||
|
// at the end anyway.
|
||||||
if (almost_zero (_a)) {
|
if (almost_zero (_a)) {
|
||||||
auto s = solve<2> ({_b, _c, _d});
|
auto s = solve<2> ({_b, _c, _d});
|
||||||
return {s[0], s[1], std::numeric_limits<float>::quiet_NaN () };
|
return {s[0], s[1], std::numeric_limits<float>::quiet_NaN () };
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
namespace polynomial {
|
namespace polynomial {
|
||||||
|
// Invalid solutions are represented by NaN. They are guaranteed to
|
||||||
|
// be at the end of the solution list, so they are safe to skip on the
|
||||||
|
// first instance.
|
||||||
template <size_t S>
|
template <size_t S>
|
||||||
std::array<float,S>
|
std::array<float,S>
|
||||||
solve (std::array<float,S+1>);
|
solve (std::array<float,S+1>);
|
||||||
|
Loading…
Reference in New Issue
Block a user