Mapping Bezier Curves Through Points
Posted: 2008-03-19T18:48:15-07:00
I found the -draw " bezier x0,y0 ... xn,yn" option, and thought that it meant that the curve would be drawn through the points, rather than simply using the points as references.
Unfortunately, that isn't how it works, as the following shows:
To create Bezier curves that include the points, I managed to find Algorithms for Automatically Fitting Digitized Curves at the Graphical Gems Repository. The specific code is FitCurves.c in gems.zip. If someone could fold a version of that code into the main library, I'm sure that a lot of people would find it useful. (For example, converting from raster to vector using the edge points as the source point set, resizing that properly deals with curved lines, etc.)
Unfortunately, that isn't how it works, as the following shows:
Code: Select all
convert -size 230x60 xc:skyblue -fill none -stroke black -draw "bezier 010,010 040,050 070,045 100,015 130,015 160,045 190,050 220,010" -stroke red -draw "polyline 010,010 040,050 070,045 100,015 130,015 160,045 190,050 220,010" bad_bezier.gif
To create Bezier curves that include the points, I managed to find Algorithms for Automatically Fitting Digitized Curves at the Graphical Gems Repository. The specific code is FitCurves.c in gems.zip. If someone could fold a version of that code into the main library, I'm sure that a lot of people would find it useful. (For example, converting from raster to vector using the edge points as the source point set, resizing that properly deals with curved lines, etc.)