'''
Copyright (C) 2009 Michel Chatelain.
Copyright (C) 2007 Tavmjong Bah, tavmjong@free.fr
Copyright (C) 2006 Georg Wiora, xorx@quarkbox.de
Copyright (C) 2006 Johan Engelen, johan@shouraizou.nl
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Changes:
* This program is derived by Michel Chatelain from funcplot.py. His changes are in the Public Domain.
* Michel Chatelain, 17-18 janvier 2009, a partir de funcplot.py
* 20 janvier 2009 : adaptation a la version 0.46 a partir de la nouvelle version de funcplot.py
'''
from math import *
from random import *
def drawfunction(t_start, t_end, xleft, xright, ybottom, ytop, samples, width, height, left, bottom,
# coords and scales based on the source rect
# Check for isotropic scaling and use smaller of the two scales, correct ranges
if isoscale:
# compute zero location
# set scale
# correct x-offset
else :
# compute zero location
# set scale
# correct x-offset
# functions specified by the user
if fx != "":
if fy != "":
# step is increment of t
a = [] # path array
# add axis
if drawaxis :
# check for visibility of x-axis
# xaxis
# check for visibility of y-axis
# xaxis
# initialize functions and derivatives for 0;
# they are carried over from one iteration to the next, to avoid extra function calculations.
# numerical derivatives, using 0.001*step as the small differential
# Start curve
# numerical derivatives
# create curve
a.append([' C ',
])
return a
help="Start t-value")
help="End t-value")
help="Multiply t-range by 2*pi")
help="x-value of rectangle's left")
help="x-value of rectangle's right")
help="y-value of rectangle's bottom")
help="y-value of rectangle's top")
help="Samples")
help="fx(t) for plotting")
help="fy(t) for plotting")
help="If True, source rectangle is removed")
help="If True, isotropic scaling is used")
help="If True, axis are drawn")
help="The selected UI-tab when OK was pressed")
help="dummy")
help="dummy")
# create new path with basic dimensions of selected rectangle
#copy attributes of rect
if s:
if t:
# top and bottom were exchanged
w,h,x,y+h,
#newpath.set('desc', '!func;' + self.options.fofx + ';' + self.options.fofy + ';'
# + `self.options.t_start` + ';'
# + `self.options.t_end` + ';'
# + `self.options.samples`)
# add path into SVG structure
# option wether to remove the rectangle or not.
if __name__ == '__main__':
e = ParamCurves()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99