From d3a4d543c4d6eb4151b2acad892272cbc1ea3f45 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Wed, 15 Feb 2012 08:26:41 +0100 Subject: Synchronized 2geom to revision 2058 (bzr r10978) --- src/2geom/affine.cpp | 2 +- src/2geom/affine.h | 2 +- src/2geom/circle-circle.cpp | 2 -- src/2geom/conicsec.cpp | 4 ++-- src/2geom/conicsec.h | 2 +- src/2geom/convex-cover.cpp | 26 -------------------------- src/2geom/d2-sbasis.cpp | 1 - src/2geom/elliptical-arc.cpp | 2 +- src/2geom/line.cpp | 6 +++--- src/2geom/path-intersection.cpp | 4 ++-- src/2geom/pathvector.h | 2 +- src/2geom/piecewise.cpp | 2 +- src/2geom/sbasis-geometric.cpp | 7 ------- src/2geom/solve-bezier.cpp | 9 +++++---- src/2geom/svg-elliptical-arc.cpp | 18 ++++++++---------- 15 files changed, 26 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/2geom/affine.cpp b/src/2geom/affine.cpp index 1be5d9fe8..0ef6d2708 100644 --- a/src/2geom/affine.cpp +++ b/src/2geom/affine.cpp @@ -22,7 +22,7 @@ namespace Geom { \return The new Affine. */ //NOTE: Inkscape's version is broken, so when including this version, you'll have to search for code with this func -Affine from_basis(Point const x_basis, Point const y_basis, Point const offset) { +Affine from_basis(Point const &x_basis, Point const &y_basis, Point const &offset) { return Affine(x_basis[X], x_basis[Y], y_basis[X], y_basis[Y], offset [X], offset [Y]); diff --git a/src/2geom/affine.h b/src/2geom/affine.h index 22f8bd9f5..b17da1887 100644 --- a/src/2geom/affine.h +++ b/src/2geom/affine.h @@ -201,7 +201,7 @@ inline std::ostream &operator<< (std::ostream &out_file, const Geom::Affine &m) } // Affine factories -Affine from_basis(const Point x_basis, const Point y_basis, const Point offset=Point(0,0)); +Affine from_basis(const Point &x_basis, const Point &y_basis, const Point &offset=Point(0,0)); Affine elliptic_quadratic_form(Affine const &m); /** Given a matrix (ignoring the translation) this returns the eigen diff --git a/src/2geom/circle-circle.cpp b/src/2geom/circle-circle.cpp index 425ff0e9f..134fa33a2 100644 --- a/src/2geom/circle-circle.cpp +++ b/src/2geom/circle-circle.cpp @@ -106,8 +106,6 @@ int circle_circle_intersection(Point X0, double r0, void run_test(double x0, double y0, double r0, double x1, double y1, double r1) { - double x3, y3, x3_prime, y3_prime; - printf("x0=%F, y0=%F, r0=%F, x1=%F, y1=%F, r1=%F :\n", x0, y0, r0, x1, y1, r1); Geom::Point p0, p1; diff --git a/src/2geom/conicsec.cpp b/src/2geom/conicsec.cpp index 46793fb22..7625df2fb 100644 --- a/src/2geom/conicsec.cpp +++ b/src/2geom/conicsec.cpp @@ -1415,7 +1415,7 @@ Rect xAx::arc_bound (const Point & P1, const Point & Q, const Point & P2) const { // with c != 0 the setCoefficients rise an exception gl[0].setCoefficients (coeff(1), 2 * coeff(2), coeff(4)); } - catch(Geom::LogicalError e) + catch(Geom::LogicalError const &e) { empty[0] = true; } @@ -1424,7 +1424,7 @@ Rect xAx::arc_bound (const Point & P1, const Point & Q, const Point & P2) const { gl[1].setCoefficients (2 * coeff(0), coeff(1), coeff(3)); } - catch(Geom::LogicalError e) + catch(Geom::LogicalError const &e) { empty[1] = true; } diff --git a/src/2geom/conicsec.h b/src/2geom/conicsec.h index 1e87f9eb3..ec9a430d9 100644 --- a/src/2geom/conicsec.h +++ b/src/2geom/conicsec.h @@ -481,7 +481,7 @@ public: * * P: the point to compute the nearest one */ - Point nearestPoint (const Point P) const + Point nearestPoint (const Point &P) const { std::vector points = allNearestPoints (P); if ( !points.empty() ) diff --git a/src/2geom/convex-cover.cpp b/src/2geom/convex-cover.cpp index 550779f65..306060f7c 100644 --- a/src/2geom/convex-cover.cpp +++ b/src/2geom/convex-cover.cpp @@ -588,32 +588,6 @@ ConvexHull merge(ConvexHull a, ConvexHull b) { ret.boundary.push_back(chs[state][idx++]); } return ret; - - /* - ab[-1] = 0; - bb[-1] = 0; - - int i = -1; // XXX: i is int but refers to vector indices - - if(a.boundary[0][1] > b.boundary[0][1]) goto start_b; - while(true) { - for(; ab.count(i) == 0; i++) { - ret.boundary.push_back(a[i]); - if(i >= (int)a.boundary.size()) return ret; - } - if(ab[i] == 0 && i != -1) break; - i = ab[i]; - start_b: - - for(; bb.count(i) == 0; i++) { - ret.boundary.push_back(b[i]); - if(i >= (int)b.boundary.size()) return ret; - } - if(bb[i] == 0 && i != -1) break; - i = bb[i]; - } - */ - return ret; } ConvexHull graham_merge(ConvexHull a, ConvexHull b) { diff --git a/src/2geom/d2-sbasis.cpp b/src/2geom/d2-sbasis.cpp index 228e1ce24..7bfb7c6c5 100644 --- a/src/2geom/d2-sbasis.cpp +++ b/src/2geom/d2-sbasis.cpp @@ -256,7 +256,6 @@ std::vector > > fuse_nearby_ends(std::vector> 1 ? Y : X); + arc_extremes[i] = valueAtAngle(extremes[i], (i >> 1) ? Y : X); } } diff --git a/src/2geom/line.cpp b/src/2geom/line.cpp index 471ce256c..097365245 100644 --- a/src/2geom/line.cpp +++ b/src/2geom/line.cpp @@ -432,7 +432,7 @@ boost::optional clip (Line const& l, Rect const& r) points.push_back (l.pointAt (oc->tb)); } } - catch (InfiniteSolutions e) + catch (InfiniteSolutions const &e) { return opt_linesegment(ls); } @@ -459,7 +459,7 @@ boost::optional clip (Line const& l, Rect const& r) } } } - catch (InfiniteSolutions e) + catch (InfiniteSolutions const &e) { return opt_linesegment(ls); } @@ -481,7 +481,7 @@ Line make_angle_bisector_line(Line const& l1, Line const& l2) { crossing = intersection(l1, l2); } - catch(InfiniteSolutions e) + catch(InfiniteSolutions const &e) { return l1; } diff --git a/src/2geom/path-intersection.cpp b/src/2geom/path-intersection.cpp index c514991d4..494a25843 100644 --- a/src/2geom/path-intersection.cpp +++ b/src/2geom/path-intersection.cpp @@ -117,7 +117,7 @@ bool path_direction(Path const &p) { double y = p.initialPoint()[Y]; double x = p.initialPoint()[X]; Cmp res = cmp(p[0].finalPoint()[Y], y); - goto doh; + /*goto doh; for(unsigned i = 1; i < p.size(); i++) { Cmp final_to_ray = cmp(p[i].finalPoint()[Y], y); Cmp initial_to_ray = cmp(p[i].initialPoint()[Y], y); @@ -136,7 +136,7 @@ bool path_direction(Path const &p) { } return res < 0; - doh: + doh:*/ //Otherwise fallback on area Piecewise > pw = p.toPwSb(); diff --git a/src/2geom/pathvector.h b/src/2geom/pathvector.h index 2b690a005..791cb0703 100644 --- a/src/2geom/pathvector.h +++ b/src/2geom/pathvector.h @@ -117,7 +117,7 @@ boost::optional nearestPoint(PathVector const & path_in, Poi std::vector allNearestPoints(PathVector const & path_in, Point const& _point, double *distance_squared = NULL); inline -Point pointAt(PathVector const & path_in, PathVectorPosition const pvp) { +Point pointAt(PathVector const & path_in, PathVectorPosition const &pvp) { return path_in[pvp.path_nr].pointAt(pvp.t); } diff --git a/src/2geom/piecewise.cpp b/src/2geom/piecewise.cpp index ba1e60ea3..090da8e8d 100644 --- a/src/2geom/piecewise.cpp +++ b/src/2geom/piecewise.cpp @@ -238,7 +238,7 @@ std::vector level_set(Piecewise const &f, Interval const &leve Interval domj( a, b ); //Interval domj( f.mapToDomain(resulti[j].min(), i ), f.mapToDomain(resulti[j].max(), i ) ); - if ( j==0 && result.size() > 0 && result.back().intersects(domj) ){ + if ( j==0 && !result.empty() && result.back().intersects(domj) ){ result.back().unionWith(domj); }else{ result.push_back(domj); diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp index 0987953de..b228a8ca0 100644 --- a/src/2geom/sbasis-geometric.cpp +++ b/src/2geom/sbasis-geometric.cpp @@ -666,13 +666,6 @@ Geom::cubics_fitting_curvature(Point const &M0, Point const &M1, lambda1.push_back( a0*c1*c1 + c0 ); }else{ //find lamda0 by solving a deg 4 equation d0+d1*X+...+d4*X^4=0 - double a[5]; - a[0] = c1+a1*c0*c0; - a[1] = -1; - a[2] = 2*a1*a0*c0; - a[3] = 0; - a[4] = a1*a0*a0; - //vector solns=solve_poly(a,4); vector solns=solve_lambda0(a0,a1,c0,c1,insist_on_speed_signs); for (unsigned i=0;i &solutions, Bezier bz = *this; //convex_hull_marching(bz, bz, solutions, left_t, right_t); //return; - - //A constant bezier, even if identically zero, has no roots - if (bz.isConstant()) + + // a constant bezier, even if identically zero, has no roots + if (bz.isConstant()) { return; - + } + while(bz[0] == 0) { debug(std::cout << "deflate\n"); bz = bz.deflate(); diff --git a/src/2geom/svg-elliptical-arc.cpp b/src/2geom/svg-elliptical-arc.cpp index ae8a3192c..14a4b4f16 100644 --- a/src/2geom/svg-elliptical-arc.cpp +++ b/src/2geom/svg-elliptical-arc.cpp @@ -28,21 +28,19 @@ */ -#include <2geom/svg-elliptical-arc.h> -#include <2geom/ellipse.h> -#include <2geom/sbasis-geometric.h> #include <2geom/bezier-curve.h> +#include <2geom/ellipse.h> +#include <2geom/numeric/fitting-model.h> +#include <2geom/numeric/fitting-tool.h> +#include <2geom/numeric/vector.h> #include <2geom/poly.h> +#include <2geom/sbasis-geometric.h> +#include <2geom/svg-elliptical-arc.h> #include #include #include -#include <2geom/numeric/vector.h> -#include <2geom/numeric/fitting-tool.h> -#include <2geom/numeric/fitting-model.h> - - namespace Geom { @@ -211,7 +209,7 @@ bool make_elliptical_arc::make_elliptiarc() { e.set(1, coeff[0], coeff[1], coeff[2], coeff[3], coeff[4]); } - catch(LogicalError exc) + catch(LogicalError const &exc) { return false; } @@ -231,7 +229,7 @@ bool make_elliptical_arc::make_elliptiarc() e.arc(initial_point, inner_point, final_point, false) ); ea = *eap; } - catch(RangeError exc) + catch(RangeError const &exc) { return false; } -- cgit v1.2.3