C# Class burningmime.curves.CurveFit

Implements a least-squares bezier curve fitting routine based on http://tog.acm.org/resources/GraphicsGems/gems/FitCurves.c with a few optimizations made by me. You can read the article here: http://read.pudn.com/downloads141/ebook/610086/Graphics_Gems_I.pdf page 626. To use, call the Fit static function and wait for magic to happen.
Inheritance: CurveFitBase
Afficher le fichier Open project: prepare/HTML-Renderer Class Usage Examples

Méthodes publiques

Méthode Description
Fit ( List points, System.Double maxError ) : CubicBezier[]

Attempts to fit a set of Bezier curves to the given data. It returns a set of curves that form a http://en.wikipedia.org/wiki/Composite_B%C3%A9zier_curve with C1 continuity (that is, each curve's start point is coincident with the previous curve's end point, and the tangent vectors of the start and end points are going in the same direction, so the curves will join up smoothly). Returns an empty array if less than two points in input. Input data MUST not contain repeated points (that is, the same point twice in succession). The best way to ensure this is to call any one of the methods in CurvePreprocess, since all three pre-processing methods will remove duplicate points. If repeated points are encountered, unexpected behavior can occur.

Private Methods

Méthode Description
CurveFit ( ) : System

Private constructor so it can't be constructed externally.

FitRecursive ( int first, int last, System.Windows.Vector tanL, System.Windows.Vector tanR ) : void

Main fit function that attempts to fit a segment of curve and recurses if unable to.

GetInstance ( ) : CurveFit

Method Details

Fit() public static méthode

Attempts to fit a set of Bezier curves to the given data. It returns a set of curves that form a http://en.wikipedia.org/wiki/Composite_B%C3%A9zier_curve with C1 continuity (that is, each curve's start point is coincident with the previous curve's end point, and the tangent vectors of the start and end points are going in the same direction, so the curves will join up smoothly). Returns an empty array if less than two points in input. Input data MUST not contain repeated points (that is, the same point twice in succession). The best way to ensure this is to call any one of the methods in CurvePreprocess, since all three pre-processing methods will remove duplicate points. If repeated points are encountered, unexpected behavior can occur.
public static Fit ( List points, System.Double maxError ) : CubicBezier[]
points List Set of points to fit to.
maxError System.Double Maximum distance from any data point to a point on the generated curve.
Résultat CubicBezier[]