summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0eabaf2)
raw | patch | inline | side by side (parent: 0eabaf2)
author | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 3 Jul 2008 09:39:33 +0000 (09:39 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 3 Jul 2008 09:39:33 +0000 (09:39 +0000) |
src/2geom/numeric/linear_system.h | patch | blob | history | |
src/2geom/piecewise.h | patch | blob | history |
index 9cb521eb2a2f919a8d7982d46117109362c5643f..7699c5224ead519e34c4bbe9ea7b7fb0b8a864ec 100644 (file)
#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 8992c0097d3987f6d740fc8568c770506a9dc107..96e64bcf9e40ba3ab53e9dedbf7e2d32c6ce85d4 100644 (file)
--- a/src/2geom/piecewise.h
+++ b/src/2geom/piecewise.h
}
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;
+}
+
}