From fa0dad91b01cfde47696d26323ec36d34e757db8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 26 Apr 2012 21:28:46 +0200 Subject: 2geom update (bzr r11297) --- src/2geom/piecewise.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h index 837f33ea7..e3b4d3456 100644 --- a/src/2geom/piecewise.h +++ b/src/2geom/piecewise.h @@ -783,10 +783,13 @@ Piecewise compose(Piecewise const &f, SBasis const &g){ double t0=(*cut).first; double t1=(*next).first; - SBasis sub_g=compose(g, Linear(t0,t1)); - sub_g=compose(Linear(-f.cuts[idx]/(f.cuts[idx+1]-f.cuts[idx]), - (1-f.cuts[idx])/(f.cuts[idx+1]-f.cuts[idx])),sub_g); - result.push(compose(f[idx],sub_g),t1); + if (!are_near(t0,t1,EPSILON*EPSILON)) { // prevent adding cuts that are extremely close together and that may cause trouble with rounding e.g. when reversing the path + SBasis sub_g=compose(g, Linear(t0,t1)); + sub_g=compose(Linear(-f.cuts[idx]/(f.cuts[idx+1]-f.cuts[idx]), + (1-f.cuts[idx])/(f.cuts[idx+1]-f.cuts[idx])),sub_g); + result.push(compose(f[idx],sub_g),t1); + } + cut++; next++; } -- cgit v1.2.3