remove relative path setting
[PyX.git] / design / invalid3.py
blob93265ec0be15b015b39c536fe6f77c51038682b0
1 #!/usr/bin/env python
2 import sys;sys.path.insert(0, "..")
3 from math import *
4 from pyx import *
5 # File for invalid parametrisations of Bezier curves
6 # Some examples
8 def Dx_m(Dy):
9 return (-1-2*Dy-sqrt((1+2*Dy)**2+3))/3.0
11 def Dx_p(Dy):
12 return (-1-2*Dy+sqrt((1+2*Dy)**2+3))/3.0
14 def acurve(Dx_fct, Dy, Dx=None):
15 if Dx is None:
16 Dx = Dx_fct(Dy)
17 p = path.curve(0,0, 0,1, Dx,1+Dy, 1,0)
18 c = canvas.canvas()
19 c.stroke(p, [deco.shownormpath()])
20 c.text(-0.2, -10*unit.x_pt, r"\noindent$\Delta x=%g $\par\noindent$\Delta y=%g$"%(Dx,Dy),
21 [text.parbox(4), text.size.footnotesize])
22 return c
24 dx = 3
25 dy = -3
26 cc = acurve(Dx_m, 0)
27 c = acurve(Dx_m, 1); cc.insert(c, [trafo.translate(dx, 0)])
28 c = acurve(Dx_m, -1); cc.insert(c, [trafo.translate(2*dx, 0)])
29 c = acurve(Dx_m, -2); cc.insert(c, [trafo.translate(0, dy)])
30 c = acurve(Dx_p, -1); cc.insert(c, [trafo.translate(dx, dy)])
31 c = acurve(Dx_p, -3); cc.insert(c, [trafo.translate(2*dx, dy)])
32 cc.writePDFfile()