It appears to me that the DC's only support for curves of any sort is with splines. Are there any libraries that add bezier functionality, or is there a way to convert a bezier curve into a spline?
+2
A:
Given 4 control points, the formula for the associated cubic Bezier curve is not hard to compute. Once you calculate a set of points on the curve, you could use DC.DrawLines
to draw it.
There is a python implementation for calculating points on generalized Bezier curves (shameless plug) here. It's generalized in the sense that it can accept an arbitrary number of control points (>2) as input to make_bezier
. If you want only the 4-control point version, you can cut out pascal_row
entirely and replace
combinations=pascal_row(n-1)
with
combinations=(1,3,3,1)
unutbu
2010-02-27 03:48:48
+1
A:
After a little googling, I think I'll go with wx.GraphicsContext, which supports wx.GraphicsPath. It appears to have exactly what I need, in addition to anti-aliasing (according to this page)
Bibendum
2010-02-27 05:54:28
Good idea. It's the new way to draw in wxpython.
DrBloodmoney
2010-02-27 18:11:00