SmoothLine

function SmoothLine(const path: TArrayOfPointD; closed: Boolean; tolerance: double; minSegLength: double = 3): TArrayOfPointD; overload;

function SmoothLine(const path: TArrayOfArrayOfPointD; closed: Boolean; tolerance: double; minSegLength: double = 3): TArrayOfArrayOfPointD; overload;


This function replaces roughly curved sections of flattened paths with series of smooth Bezier curves. The returned path (or paths) is a series of consecutive Cubic Beziers where the end vertex of one Bezier becomes the start vertex of the next. (These can easily be converted back to flattened paths using the FlattenCBezier function).


This function is a very useful adjunct to the Vectorize function that's found in the Image32_Extra unit. Both functions are demonstrated in the VectorizeImages sample application.

Note 1: This function is based on "An Algorithm for Automatically Fitting Digitized Curves" by Philip J. Schneider as published in "Graphics Gems", Academic Press, 1990.

Note 2: This function is not to be confused with the TSmoothPath class in the Image32_SmoothPath unit.


Before:
After:

See Also

Vectorize, TSmoothPath, FlattenCBezier