From: cilix42 Date: Thu, 3 Jul 2008 09:39:33 +0000 (+0000) Subject: Partial 2geom update (anticipating changes that will be part of the next major update... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=caf884a8e15eda6c9c32020a2fd80e9317beaf24;p=inkscape.git 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) --- 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 -#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 derivative(Piecewise const &a) { } std::vector roots(Piecewise const &f); -Piecewise reverse(Piecewise const &f); + +template +Piecewise reverse(Piecewise const &f) { + Piecewise ret = Piecewise(); + 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; +} + }