diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-12-16 05:41:25 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-12-16 05:41:25 +0000 |
| commit | 7ec903c9898f872dbd9426ed7a62e1969fdb7be7 (patch) | |
| tree | a306139e829118a83516af02279c9eafd3440eaa /share/extensions/funcplot.py | |
| parent | Hershey Text: whitespace; py: docstring, modeline; inx: fix attribute value (diff) | |
| parent | Translations.Spanish translation update by Lucas Vieites. (diff) | |
| download | inkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.tar.gz inkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.zip | |
merge from trunk (r11955)
(bzr r11687.1.3)
Diffstat (limited to 'share/extensions/funcplot.py')
| -rwxr-xr-x | share/extensions/funcplot.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py index a868e92a4..08ac15dbb 100755 --- a/share/extensions/funcplot.py +++ b/share/extensions/funcplot.py @@ -25,11 +25,15 @@ Changes: * 21-Jun-2007: Tavmjong: Added polar coordinates ''' -import inkex, simplepath, simplestyle +# standard library from math import * from random import * -import gettext -_ = gettext.gettext +# local library +import inkex +import simplepath +import simplestyle + +inkex.localize() def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bottom, fx = "sin(x)", fpx = "cos(x)", fponum = True, times2pi = False, polar = False, isoscale = True, drawaxis = True, endpts = False): @@ -39,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 @@ -48,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 |
