From c883d7627a479c8c5b6a9f77b9841fa5631572ad Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 27 Apr 2015 19:39:29 -0400 Subject: 2Geom sync - initial commit (bzr r14059.2.1) --- src/2geom/sbasis.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/2geom/sbasis.cpp') diff --git a/src/2geom/sbasis.cpp b/src/2geom/sbasis.cpp index b56e03c74..4f1df621e 100644 --- a/src/2geom/sbasis.cpp +++ b/src/2geom/sbasis.cpp @@ -466,6 +466,15 @@ SBasis compose(SBasis const &a, SBasis const &b, unsigned k) { return r; } +SBasis portion(const SBasis &t, double from, double to) { + double fv = t.valueAt(from); + double tv = t.valueAt(to); + SBasis ret = compose(t, Linear(from, to)); + ret.at0() = fv; + ret.at1() = tv; + return ret; +} + /* Inversion algorithm. The notation is certainly very misleading. The pseudocode should say: @@ -632,7 +641,6 @@ SBasis compose_inverse(SBasis const &f, SBasis const &g, unsigned order, double //TODO: handle det~0!! if (fabs(det) Date: Wed, 15 Jul 2015 20:47:16 +0200 Subject: Update 2Geom to r2421, fix SBasis derivatives. Fixes LP bug #1473317. Fixed bugs: - https://launchpad.net/bugs/1473317 (bzr r14248) --- src/2geom/sbasis.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/2geom/sbasis.cpp') diff --git a/src/2geom/sbasis.cpp b/src/2geom/sbasis.cpp index 4f1df621e..42d92d7b8 100644 --- a/src/2geom/sbasis.cpp +++ b/src/2geom/sbasis.cpp @@ -328,9 +328,9 @@ SBasis derivative(SBasis const &a) { } int k = a.size()-1; double d = (2*k+1)*(a[k][1] - a[k][0]); - if(d == 0) + if (d == 0 && k > 0) { c.pop_back(); - else { + } else { c[k][0] = d; c[k][1] = d; } @@ -351,9 +351,9 @@ void SBasis::derive() { // in place version } int k = size()-1; double d = (2*k+1)*((*this)[k][1] - (*this)[k][0]); - if(d == 0) + if (d == 0 && k > 0) { pop_back(); - else { + } else { (*this)[k][0] = d; (*this)[k][1] = d; } -- cgit v1.2.3