diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-05-22 19:51:50 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-05-22 19:51:50 +0000 |
| commit | 1ca2d062a23dbab152d88288ccd2b4a92bfb5403 (patch) | |
| tree | bfb30db573be1fbe201255fa208b80285c6f1da0 /src/2geom/elliptical-arc.cpp | |
| parent | update to latest 2geom (diff) | |
| download | inkscape-1ca2d062a23dbab152d88288ccd2b4a92bfb5403.tar.gz inkscape-1ca2d062a23dbab152d88288ccd2b4a92bfb5403.zip | |
update to really latest 2geom
(bzr r5737)
Diffstat (limited to 'src/2geom/elliptical-arc.cpp')
| -rw-r--r-- | src/2geom/elliptical-arc.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
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 <gsl/gsl_poly.h> +#include "poly.h" #include <cfloat> @@ -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 ) { |
