0

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?

Bibendum
  • 502
  • 4
  • 7
  • 18
  • Hm ... what are you trying to do? Asymptote is amazing at graphics. Check out: http://asymptote.sourceforge.net/gallery/BezierSurface.asy – Hamish Grubijan Feb 27 '10 at 02:59

2 Answers2

2

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)
Community
  • 1
  • 1
unutbu
  • 842,883
  • 184
  • 1,785
  • 1,677
1

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
  • 502
  • 4
  • 7
  • 18