From 398b8c550b6ece8e389cf263615c6463c50bbf0f Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Tue, 23 Oct 2012 17:40:02 -0400 Subject: extensions. function plotter. prevent divide by zero. (Bug 1064863) Fixed bugs: - https://launchpad.net/bugs/1064863 (bzr r11824) --- share/extensions/funcplot.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'share/extensions/funcplot.py') diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py index a3a810028..08ac15dbb 100755 --- a/share/extensions/funcplot.py +++ b/share/extensions/funcplot.py @@ -43,6 +43,9 @@ def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bott xend = 2 * pi * xend # coords and scales based on the source rect + if xstart == xend: + inkex.errormsg(_("x-interval cannot be zero. Please modify 'Start X' or 'End X'")) + return [] scalex = width / (xend - xstart) xoff = left coordx = lambda x: (x - xstart) * scalex + xoff #convert x-value to coordinate @@ -52,6 +55,9 @@ def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bott polar_scalex = width/2.0 coordx = lambda x: x * polar_scalex + centerx #convert x-value to coordinate + if ytop == ybottom: + inkex.errormsg(_("y-interval cannot be zero. Please modify 'Y top' or 'Y bottom'")) + return [] scaley = height / (ytop - ybottom) yoff = bottom coordy = lambda y: (ybottom - y) * scaley + yoff #convert y-value to coordinate -- cgit v1.2.3