bezier curve through set of 2D points

Hello List,

Does matplotlib have a routine that can fit a cubic Bezier curve through an array of 2D points?

I saw some Bezier routines in Path, but couldn’t find what I am looking for.

If matplotlib doesn’t have it, does anybody have another suggestion in Python?

Thanks,

Mark

Does matplotlib have a routine that can fit a cubic Bezier curve through an
array of 2D points?

I saw some Bezier routines in Path, but couldn't find what I am looking for.

As far as I know, no.

If matplotlib doesn't have it, does anybody have another suggestion in
Python?

The attached is what I have used once.
It uses scipy.interpolate.splprep to fit the input as a B-spline then
convert it to cubic bezier curve.
But I have no idea if this is the best way to do it.

The original code is from

http://mail.scipy.org/pipermail/scipy-dev/2007-February/006651.html

And I only added some mpl-related things.

Regards,

-JJ

b_spline_to_bezier_series.py (3.42 KB)

···

On Thu, Jan 14, 2010 at 4:38 AM, Mark Bakker <markbak@...287...> wrote:

Jae-Joon Lee wrote:

···

On Thu, Jan 14, 2010 at 4:38 AM, Mark Bakker <markbak@...287...> wrote:

Does matplotlib have a routine that can fit a cubic Bezier curve through an
array of 2D points?

This looks like a pretty nice algorithm:

http://www.antigrain.com/research/bezier_interpolation/index.html

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...