C# 클래스 burningmime.curves.CurveFitBase

This is the base class containing implementations common to CurveFit and CurveBuilder. Most of this is ported from http://tog.acm.org/resources/GraphicsGems/gems/FitCurves.c
파일 보기 프로젝트 열기: prepare/HTML-Renderer

보호된 프로퍼티들

프로퍼티 타입 설명
_arclen List
_pts List
_squaredError System.Double
_u List

보호된 메소드들

메소드 설명
ArcLengthParamaterize ( int first, int last ) : void

Initializes the first (last - first) elements of u with scaled arc lengths.

FindMaxSquaredError ( int first, int last, CubicBezier curve, int &split ) : System.Double

Computes the maximum squared distance from a point to the curve using the current parameterization.

FitCurve ( int first, int last, System.Windows.Vector tanL, System.Windows.Vector tanR, CubicBezier &curve, int &split ) : bool

Tries to fit single Bezier curve to the points in [first ... last]. Destroys anything in _u in the process. Assumes there are at least two points to fit.

GenerateBezier ( int first, int last, System.Windows.Vector tanL, System.Windows.Vector tanR ) : CubicBezier

Generates a bezier curve for the segment using a least-squares approximation. for the derivation of this and why it works, see http://read.pudn.com/downloads141/ebook/610086/Graphics_Gems_I.pdf page 626 and beyond. tl;dr: math.

GetCenterTangent ( int first, int last, int split ) : System.Windows.Vector

Gets the tangent at a given point in the curve.

GetLeftTangent ( int last ) : System.Windows.Vector

Gets the tangent for the start of the cure.

GetRightTangent ( int first ) : System.Windows.Vector

Gets the tangent for the the end of the curve.

InitializeArcLengths ( ) : void

Builds the arc length array using the points array. Assumes _pts has points and _arclen is empty.

Reparameterize ( int first, int last, CubicBezier curve ) : void

Attempts to find a slightly better parameterization for u on the given curve.

메소드 상세

ArcLengthParamaterize() 보호된 메소드

Initializes the first (last - first) elements of u with scaled arc lengths.
protected ArcLengthParamaterize ( int first, int last ) : void
first int
last int
리턴 void

FindMaxSquaredError() 보호된 메소드

Computes the maximum squared distance from a point to the curve using the current parameterization.
protected FindMaxSquaredError ( int first, int last, CubicBezier curve, int &split ) : System.Double
first int
last int
curve CubicBezier
split int
리턴 System.Double

FitCurve() 보호된 메소드

Tries to fit single Bezier curve to the points in [first ... last]. Destroys anything in _u in the process. Assumes there are at least two points to fit.
protected FitCurve ( int first, int last, System.Windows.Vector tanL, System.Windows.Vector tanR, CubicBezier &curve, int &split ) : bool
first int Index of first point to consider.
last int Index of last point to consider (inclusive).
tanL System.Windows.Vector Tangent at teh start of the curve ("left").
tanR System.Windows.Vector Tangent on the end of the curve ("right").
curve CubicBezier The fitted curve.
split int Point at which to split if this method returns false.
리턴 bool

GenerateBezier() 보호된 메소드

Generates a bezier curve for the segment using a least-squares approximation. for the derivation of this and why it works, see http://read.pudn.com/downloads141/ebook/610086/Graphics_Gems_I.pdf page 626 and beyond. tl;dr: math.
protected GenerateBezier ( int first, int last, System.Windows.Vector tanL, System.Windows.Vector tanR ) : CubicBezier
first int
last int
tanL System.Windows.Vector
tanR System.Windows.Vector
리턴 CubicBezier

GetCenterTangent() 보호된 메소드

Gets the tangent at a given point in the curve.
protected GetCenterTangent ( int first, int last, int split ) : System.Windows.Vector
first int
last int
split int
리턴 System.Windows.Vector

GetLeftTangent() 보호된 메소드

Gets the tangent for the start of the cure.
protected GetLeftTangent ( int last ) : System.Windows.Vector
last int
리턴 System.Windows.Vector

GetRightTangent() 보호된 메소드

Gets the tangent for the the end of the curve.
protected GetRightTangent ( int first ) : System.Windows.Vector
first int
리턴 System.Windows.Vector

InitializeArcLengths() 보호된 메소드

Builds the arc length array using the points array. Assumes _pts has points and _arclen is empty.
protected InitializeArcLengths ( ) : void
리턴 void

Reparameterize() 보호된 메소드

Attempts to find a slightly better parameterization for u on the given curve.
protected Reparameterize ( int first, int last, CubicBezier curve ) : void
first int
last int
curve CubicBezier
리턴 void

프로퍼티 상세

_arclen 보호되어 있는 프로퍼티

length of curve before each point (so, arclen[0] = 0, arclen[1] = distance(pts[0], pts[1]), arclen[2] = arclen[1] + distance(pts[1], pts[2]) ... arclen[n -1] = length of the entire curve, etc).
protected List _arclen
리턴 List

_pts 보호되어 있는 프로퍼티

Points in the whole line being used for fitting.
protected List _pts
리턴 List

_squaredError 보호되어 있는 프로퍼티

maximum squared error before we split the curve
protected Double,System _squaredError
리턴 System.Double

_u 보호되어 있는 프로퍼티

current parametrization of the curve. When fitting, u[i] is the parametrization for the point in pts[first + i]. This is an optimization for CurveBuilder, since it might not need to allocate as big of a _u as is necessary to hold the whole curve.
protected List _u
리턴 List