Code

update to really latest 2geom
authorjohanengelen <johanengelen@users.sourceforge.net>
Thu, 22 May 2008 19:51:50 +0000 (19:51 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Thu, 22 May 2008 19:51:50 +0000 (19:51 +0000)
src/2geom/elliptical-arc.cpp
src/2geom/forward.h
src/2geom/pathvector.cpp
src/2geom/piecewise.h

index b18991c88348d6fea38dcfcfee56fa390d1a8b91..b4a882f093a6eb64ade3da8b838f2ba10370f908 100644 (file)
@@ -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 )
        {
index 454f9bf157164342820816deed66a5c15d1bd1ee..5ed7ee1ffcc9541a37d7d418f5549aeb109cb2d8 100644 (file)
@@ -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;
 
index 2e3de3f504bdcab6fc28bee00faaad0374a5b37f..696ccad7752349554e250bbae1f50f6f376cabcf 100644 (file)
@@ -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;
index 28d95edd5e07a23d842888bd33460067985561a8..574d6de62f29011eab0e63f5e53e5d8140669c7f 100644 (file)
@@ -32,7 +32,6 @@
 #define SEEN_GEOM_PW_SB_H
 
 #include "sbasis.h"
-//#include "sbasis-2d.h"
 #include <vector>
 #include <map>