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 | |
| parent | update to latest 2geom (diff) | |
| download | inkscape-1ca2d062a23dbab152d88288ccd2b4a92bfb5403.tar.gz inkscape-1ca2d062a23dbab152d88288ccd2b4a92bfb5403.zip | |
update to really latest 2geom
(bzr r5737)
| -rw-r--r-- | src/2geom/elliptical-arc.cpp | 31 | ||||
| -rw-r--r-- | src/2geom/forward.h | 2 | ||||
| -rw-r--r-- | src/2geom/pathvector.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/piecewise.h | 1 |
4 files changed, 20 insertions, 16 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 ) { 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<Interval> Rect; class Shape; class Region; -class EllipticalArc; class SVGPathSink; template <typename> 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 <vector> #include <map> |
