summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2015-08-30 11:37:24 +0000
committerapenner <penner@vaxxine.com>2015-08-30 11:37:24 +0000
commit952f240eb043f626eab87dcf1348d778d96ca363 (patch)
tree608678fed7af4d023da98490c2f493b94233a48e /src
parentEnsure strncpy'd strings are null terminated (diff)
downloadinkscape-952f240eb043f626eab87dcf1348d778d96ca363.tar.gz
inkscape-952f240eb043f626eab87dcf1348d778d96ca363.zip
lpe-powerstroke. validity check on data. (Bug 1487424)
Fixed bugs: - https://launchpad.net/bugs/1487424 (bzr r14333)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-powerstroke.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index f90d67d4e..03102a84a 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -102,12 +102,15 @@ static Circle touching_circle( D2<SBasis> const &curve, double t, double tol=0.0
{
//Piecewise<SBasis> k = curvature(curve, tol);
D2<SBasis> dM=derivative(curve);
- if ( are_near(L2sq(dM(t)),0.) ) {
+ if ( are_near(L2sq(dM(t)),0.) && (dM[0].size() > 1) && (dM[1].size() > 1) ) {
dM=derivative(dM);
}
- if ( are_near(L2sq(dM(t)),0.) ) { // try second time
+ if ( are_near(L2sq(dM(t)),0.) && (dM[0].size() > 1) && (dM[1].size() > 1) ) { // try second time
dM=derivative(dM);
}
+ if ( are_near(L2sq(dM(t)),0.) && (dM[0].size() > 1) && (dM[1].size() > 1) ) { // admit defeat
+ return Geom::Circle(Geom::Point(0., 0.), 0.);
+ }
Piecewise<D2<SBasis> > unitv = unitVector(dM,tol);
Piecewise<SBasis> dMlength = dot(Piecewise<D2<SBasis> >(dM),unitv);
Piecewise<SBasis> k = cross(derivative(unitv),unitv);