X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fbezier.h;h=01da9225093a6c001520933909b2b35f243879bc;hp=b04126027152c9b6c7b12ff2c0c8ef55e4e667fb;hb=3917214a11bf76381ddc528e3fe51de9ec038d42;hpb=ea748154f1bc7dbc81cb52611a52865e63109439 diff --git a/src/bezier.h b/src/bezier.h index b041260..01da922 100644 --- a/src/bezier.h +++ b/src/bezier.h @@ -15,7 +15,7 @@ namespace IPDF extern std::vector SolveQuadratic(const Real & a, const Real & b, const Real & c, const Real & min = 0, const Real & max = 1); - extern std::vector SolveCubic(const Real & a, const Real & b, const Real & c, const Real & d, const Real & min = 0, const Real & max = 1, const Real & delta = 1e-4); + extern std::vector SolveCubic(const Real & a, const Real & b, const Real & c, const Real & d, const Real & min = 0, const Real & max = 1, const Real & delta = 1e-9); /** A _cubic_ bezier. **/ struct Bezier @@ -256,17 +256,21 @@ namespace IPDF // Find its roots. std::vector x_intersection = SolveXParam(r.x); + Debug("Found %d intersections on left edge", x_intersection.size()); // And for the other side. std::vector x_intersection_pt2 = SolveXParam(r.x + r.w); x_intersection.insert(x_intersection.end(), x_intersection_pt2.begin(), x_intersection_pt2.end()); + Debug("Found %d intersections on right edge (total x: %d)", x_intersection_pt2.size(), x_intersection.size()); // Find its roots. std::vector y_intersection = SolveYParam(r.y); + Debug("Found %d intersections on top edge", y_intersection.size()); std::vector y_intersection_pt2 = SolveYParam(r.y+r.h); y_intersection.insert(y_intersection.end(), y_intersection_pt2.begin(), y_intersection_pt2.end()); + Debug("Found %d intersections on bottom edge (total y: %d)", y_intersection_pt2.size(), y_intersection.size()); // Merge and sort. x_intersection.insert(x_intersection.end(), y_intersection.begin(), y_intersection.end());