From: johanengelen Date: Thu, 22 May 2008 19:51:50 +0000 (+0000) Subject: update to really latest 2geom X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0c670557d9bedbc7e9990341751b4a25f6c248a5;p=inkscape.git update to really latest 2geom --- diff --git a/src/2geom/elliptical-arc.cpp b/src/2geom/elliptical-arc.cpp index b18991c88..b4a882f09 100644 --- a/src/2geom/elliptical-arc.cpp +++ b/src/2geom/elliptical-arc.cpp @@ -31,7 +31,7 @@ #include "path.h" #include "angle.h" -#include +#include "poly.h" #include @@ -160,7 +160,7 @@ EllipticalArc::roots(double v, Dim2 d) const if ( initialPoint()[d] == v && finalPoint()[d] == v ) { - THROW_EXCEPTION("infinite solutions"); + THROW_INFINITESOLUTIONS(0); } if ( (initialPoint()[d] < finalPoint()[d]) && (initialPoint()[d] > v || finalPoint()[d] < v) ) @@ -717,7 +717,7 @@ allNearestPoints( Point const& p, double from, double to ) const Point r = p - center(); if ( are_near(r, Point(0,0)) ) { - THROW_EXCEPTION("infinite nearest points"); + THROW_INFINITESOLUTIONS(0); } // TODO: implement case r != 0 // Point np = ray(X) * unit_vector(r); @@ -762,7 +762,8 @@ allNearestPoints( Point const& p, double from, double to ) const double cosrot = std::cos( rotation_angle() ); double sinrot = std::sin( rotation_angle() ); double expr1 = ray(X) * (p_c[X] * cosrot + p_c[Y] * sinrot); - double coeff[5]; + Poly coeff; + coeff.resize(5); coeff[4] = ray(Y) * ( p_c[Y] * cosrot - p_c[X] * sinrot ); coeff[3] = 2 * ( rx2_ry2 + expr1 ); coeff[2] = 0; @@ -791,16 +792,20 @@ allNearestPoints( Point const& p, double from, double to ) const } else { - double sol[8]; - gsl_poly_complex_workspace * w = gsl_poly_complex_workspace_alloc(5); - gsl_poly_complex_solve(coeff, 5, w, sol ); - gsl_poly_complex_workspace_free(w); - - for ( unsigned int i = 0; i < 4; ++i ) - { - if ( sol[2*i+1] == 0 ) real_sol.push_back(sol[2*i]); - } + real_sol = solve_reals(coeff); } +// else +// { +// double sol[8]; +// gsl_poly_complex_workspace * w = gsl_poly_complex_workspace_alloc(5); +// gsl_poly_complex_solve(coeff, 5, w, sol ); +// gsl_poly_complex_workspace_free(w); +// +// for ( unsigned int i = 0; i < 4; ++i ) +// { +// if ( sol[2*i+1] == 0 ) real_sol.push_back(sol[2*i]); +// } +// } for ( unsigned int i = 0; i < real_sol.size(); ++i ) { diff --git a/src/2geom/forward.h b/src/2geom/forward.h index 454f9bf15..5ed7ee1ff 100644 --- a/src/2geom/forward.h +++ b/src/2geom/forward.h @@ -42,6 +42,7 @@ template<> class BezierCurve<0>; typedef BezierCurve<2> QuadraticBezier; typedef BezierCurve<1> LineSegment; typedef BezierCurve<3> CubicBezier; +class EllipticalArc; typedef double Coord; class Point; @@ -78,7 +79,6 @@ typedef D2 Rect; class Shape; class Region; -class EllipticalArc; class SVGPathSink; template class SVGPathGenerator; diff --git a/src/2geom/pathvector.cpp b/src/2geom/pathvector.cpp index 2e3de3f50..696ccad77 100644 --- a/src/2geom/pathvector.cpp +++ b/src/2geom/pathvector.cpp @@ -59,7 +59,7 @@ PathVector operator* (PathVector const & path_in, Matrix const &m) PathVector reverse_paths_and_order (PathVector const & path_in) { PathVector path_out; - for (PathVector::const_reverse_iterator it = path_in.rbegin(); it != path_in.rend(); it++) { + for (PathVector::const_reverse_iterator it = path_in.rbegin(); it != path_in.rend(); ++it) { path_out.push_back( (*it).reverse() ); } return path_out; diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h index 28d95edd5..574d6de62 100644 --- a/src/2geom/piecewise.h +++ b/src/2geom/piecewise.h @@ -32,7 +32,6 @@ #define SEEN_GEOM_PW_SB_H #include "sbasis.h" -//#include "sbasis-2d.h" #include #include