summaryrefslogtreecommitdiffstats
path: root/share/extensions/funcplot.py
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2006-11-24 21:36:32 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2006-11-24 21:36:32 +0000
commit2ab949705e9120aa2b882cdc619b6d50339c0831 (patch)
tree8e772bf8ecf302c0a82592b8525717399a3a6d15 /share/extensions/funcplot.py
parentDeleted the Wavy extension, because functionplotter provides the same functio... (diff)
downloadinkscape-2ab949705e9120aa2b882cdc619b6d50339c0831.tar.gz
inkscape-2ab949705e9120aa2b882cdc619b6d50339c0831.zip
Added "multiply x-range with 2*pi" option to function plotter for easier use
(bzr r2033)
Diffstat (limited to 'share/extensions/funcplot.py')
-rw-r--r--share/extensions/funcplot.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py
index f555bb612..d4154dfe7 100644
--- a/share/extensions/funcplot.py
+++ b/share/extensions/funcplot.py
@@ -25,8 +25,12 @@ from math import *
from random import *
def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, top,
- fx = "sin(x)", fpx = "cos(x)", fponum = True):
-
+ fx = "sin(x)", fpx = "cos(x)", fponum = True, times2pi = False):
+
+ if times2pi == True:
+ xstart = 2 * pi * xstart
+ xend = 2 * pi * xend
+
# step is the distance between nodes on x
step = (xend - xstart) / (samples-1)
third = step / 3.0
@@ -83,6 +87,10 @@ class FuncPlot(inkex.Effect):
action="store", type="float",
dest="xend", default=1.0,
help="End x-value")
+ self.OptionParser.add_option("--times2pi",
+ action="store", type="inkbool",
+ dest="times2pi", default=True,
+ help="Multiply x-range by 2*pi")
self.OptionParser.add_option("--ybottom",
action="store", type="float",
dest="ybottom", default=-1.0,
@@ -144,7 +152,8 @@ class FuncPlot(inkex.Effect):
w,h,x,y,
self.options.fofx,
self.options.fpofx,
- self.options.fponum)))
+ self.options.fponum,
+ self.options.times2pi)))
newpath.setAttribute('title', self.options.fofx)
#newpath.setAttribute('desc', '!func;' + self.options.fofx + ';'