2 import sys
;sys
.path
.insert(0, "..")
5 # File for invalid parametrisations of Bezier curves
6 # visualise the constraints
9 if x
< 1/3.0: # a_x > 0
29 return 1-y
+ sqrt(1+y
+y
*y
)
31 return 1-y
- sqrt(1+y
+y
*y
)
34 return y
-1 - sqrt(1+y
+y
*y
)
36 return y
-1 + sqrt(1+y
+y
*y
)
44 def doplot(xtitle
, con
):
45 g
= graph
.graphxy(width
=10,
46 x
=graph
.axis
.lin(title
=xtitle
, min=-5, max=5),
48 key
=graph
.key
.key(pos
="tc"),
50 g
.plot(graph
.data
.function("y(x)=0", points
=2, title
=None), [graph
.style
.line()])
51 g
.plot(graph
.data
.function("y(x)=bound(x)", title
=None, context
=con
, points
=101), [graph
.style
.line()])
52 g
.plot(graph
.data
.function("y(x)=f(x, 'upper')", title
="upper sign", context
=con
, points
=101), [graph
.style
.line([color
.rgb
.red
])])
53 g
.plot(graph
.data
.function("y(x)=f(x, 'lower')", title
="lower sign", context
=con
, points
=101), [graph
.style
.line([color
.rgb
.green
])])
57 c1
= doplot(r
"$\Delta x$", {"f":fx
, "bound":boundx
})
58 c2
= doplot(r
"$\Delta y$", {"f":fy
, "bound":boundy
})
59 c1
.insert(c2
, [trafo
.translate(0, c1
.bbox().bottom() - c2
.bbox().top() - 0.5)])