X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fbezier.cpp;fp=src%2Fbezier.cpp;h=88d9c1ce4255eb55053a43863c766e04b4163be3;hp=3ace267978b86e88d437d3d1b3d41de1bcbf4dbe;hb=f0b6c9b6b95fde134927c395afbfbbbc057868e6;hpb=6c0dfe752994312ee58d307b383948bfeb2d6e2e diff --git a/src/bezier.cpp b/src/bezier.cpp index 3ace267..88d9c1c 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; }