diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-07-03 09:39:33 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-07-03 09:39:33 +0000 |
| commit | dc87fc8833a417e1b663f1726d13674dc0990b8c (patch) | |
| tree | 6c38f537822882a1ebe884b72c816e0567419383 /src | |
| parent | Check that objects are of the right type before casting them. (diff) | |
| download | inkscape-dc87fc8833a417e1b663f1726d13674dc0990b8c.tar.gz inkscape-dc87fc8833a417e1b663f1726d13674dc0990b8c.zip | |
Partial 2geom update (anticipating changes that will be part of the next major update anyway, so overwriting them on next update is not a problem)
(bzr r6125)
Diffstat (limited to 'src')
| -rw-r--r-- | src/2geom/numeric/linear_system.h | 4 | ||||
| -rw-r--r-- | src/2geom/piecewise.h | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/2geom/numeric/linear_system.h b/src/2geom/numeric/linear_system.h index 9cb521eb2..7699c5224 100644 --- a/src/2geom/numeric/linear_system.h +++ b/src/2geom/numeric/linear_system.h @@ -6,8 +6,8 @@ #include <gsl/gsl_linalg.h> -#include "numeric/matrix.h" -#include "numeric/vector.h" +#include "2geom/numeric/matrix.h" +#include "2geom/numeric/vector.h" namespace Geom { namespace NL { diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h index 8992c0097..96e64bcf9 100644 --- a/src/2geom/piecewise.h +++ b/src/2geom/piecewise.h @@ -704,7 +704,23 @@ Piecewise<T> derivative(Piecewise<T> const &a) { } std::vector<double> roots(Piecewise<SBasis> const &f); -Piecewise<SBasis> reverse(Piecewise<SBasis> const &f); + +template<typename T> +Piecewise<T> reverse(Piecewise<T> const &f) { + Piecewise<T> ret = Piecewise<T>(); + ret.cuts.resize(f.cuts.size()); + ret.segs.resize(f.segs.size()); + double start = f.cuts[0]; + double end = f.cuts.back(); + for (unsigned i = 0; i < f.cuts.size(); i++) { + double x = f.cuts[f.cuts.size() - 1 - i]; + ret.cuts[i] = end - (x - start); + } + for (unsigned i = 0; i < f.segs.size(); i++) + ret.segs[i] = reverse(f[f.segs.size() - i - 1]); + return ret; +} + } |
