X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fbezier.cpp;h=1c112351b0c910f369b29d95de87b41adc0232da;hp=19d89afcb8ab92a1790b74a472796bb065dc239d;hb=d68c91a7a2a3a4b3a312a50cbab5a7539d4cd7d5;hpb=216bf86aee4c7a1f3392051a457e7e5933f40fbd diff --git a/src/bezier.cpp b/src/bezier.cpp index 19d89af..1c11235 100644 --- a/src/bezier.cpp +++ b/src/bezier.cpp @@ -96,12 +96,16 @@ vector SolveCubic(const BReal & a, const BReal & b, const BReal & c, cons //Debug("%u turning points", turns.size()); for (unsigned i = 1; i < turns.size(); ++i) { - tu = turns[i]; + if (tl > max) break; + tu = std::min(turns[i],tu); CubicSolveSegment(roots, a, b, c, d, tl, tu,delta); tl = turns[i]; } - tu = max; - CubicSolveSegment(roots, a, b, c, d, tl, tu,delta); + if (tu < max) + { + tu = max; + CubicSolveSegment(roots, a, b, c, d, tl, tu,delta); + } return roots; }