summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d238f5)
raw | patch | inline | side by side (parent: 1d238f5)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 22 May 2008 19:51:50 +0000 (19:51 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 22 May 2008 19:51:50 +0000 (19:51 +0000) |
src/2geom/elliptical-arc.cpp | patch | blob | history | |
src/2geom/forward.h | patch | blob | history | |
src/2geom/pathvector.cpp | patch | blob | history | |
src/2geom/piecewise.h | patch | blob | history |
index b18991c88348d6fea38dcfcfee56fa390d1a8b91..b4a882f093a6eb64ade3da8b838f2ba10370f908 100644 (file)
#include "path.h"
#include "angle.h"
-#include <gsl/gsl_poly.h>
+#include "poly.h"
#include <cfloat>
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) )
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);
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;
}
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 454f9bf157164342820816deed66a5c15d1bd1ee..5ed7ee1ffcc9541a37d7d418f5549aeb109cb2d8 100644 (file)
--- a/src/2geom/forward.h
+++ b/src/2geom/forward.h
typedef BezierCurve<2> QuadraticBezier;
typedef BezierCurve<1> LineSegment;
typedef BezierCurve<3> CubicBezier;
+class EllipticalArc;
typedef double Coord;
class Point;
class Shape;
class Region;
-class EllipticalArc;
class SVGPathSink;
template <typename> class SVGPathGenerator;
index 2e3de3f504bdcab6fc28bee00faaad0374a5b37f..696ccad7752349554e250bbae1f50f6f376cabcf 100644 (file)
--- a/src/2geom/pathvector.cpp
+++ b/src/2geom/pathvector.cpp
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 28d95edd5e07a23d842888bd33460067985561a8..574d6de62f29011eab0e63f5e53e5d8140669c7f 100644 (file)
--- a/src/2geom/piecewise.h
+++ b/src/2geom/piecewise.h
#define SEEN_GEOM_PW_SB_H
#include "sbasis.h"
-//#include "sbasis-2d.h"
#include <vector>
#include <map>