diff options
Diffstat (limited to 'karbon/tools/vcurvefit.cc')
-rw-r--r-- | karbon/tools/vcurvefit.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/karbon/tools/vcurvefit.cc b/karbon/tools/vcurvefit.cc index 08dbda44..42b90a13 100644 --- a/karbon/tools/vcurvefit.cc +++ b/karbon/tools/vcurvefit.cc @@ -26,7 +26,7 @@ #include <core/vglobal.h> #include <render/vpainter.h> #include <render/vpainterfactory.h> -#include <commands/vshapecmd.h> +#include <commands/vtqshapecmd.h> /* An Algorithm for Automatically Fitting Digitized Curves @@ -104,7 +104,7 @@ double distance(KoPoint *p1,KoPoint *p2){ } -FitVector ComputeLeftTangent(QPtrList<KoPoint> &points,int end){ +FitVector ComputeLeftTangent(TQPtrList<KoPoint> &points,int end){ FitVector tHat1(*points.at(end+1),*points.at(end)); tHat1.normalize(); @@ -112,7 +112,7 @@ FitVector ComputeLeftTangent(QPtrList<KoPoint> &points,int end){ return tHat1; } -FitVector ComputeRightTangent(QPtrList<KoPoint> &points,int end){ +FitVector ComputeRightTangent(TQPtrList<KoPoint> &points,int end){ FitVector tHat1(*points.at(end-1),*points.at(end)); tHat1.normalize(); @@ -125,7 +125,7 @@ FitVector ComputeRightTangent(QPtrList<KoPoint> &points,int end){ * Assign parameter values to digitized points * using relative distances between points. */ -static double *ChordLengthParameterize(QPtrList<KoPoint> points,int first,int last) +static double *ChordLengthParameterize(TQPtrList<KoPoint> points,int first,int last) { int i; double *u; /* Parameterization */ @@ -165,7 +165,7 @@ static FitVector VectorSub(FitVector a,FitVector b) return (c); } -static FitVector ComputeCenterTangent(QPtrList<KoPoint> points,int center) +static FitVector ComputeCenterTangent(TQPtrList<KoPoint> points,int center) { FitVector V1, V2, tHatCenter; @@ -214,7 +214,7 @@ static double B3(double u) * Use least-squares method to find Bezier control points for region. * */ -KoPoint* GenerateBezier(QPtrList<KoPoint> &points, int first, int last, double *uPrime,FitVector tHat1,FitVector tHat2) +KoPoint* GenerateBezier(TQPtrList<KoPoint> &points, int first, int last, double *uPrime,FitVector tHat1,FitVector tHat2) { int i; FitVector A[MAXPOINTS][2]; /* Precomputed rhs for eqn */ @@ -359,7 +359,7 @@ static KoPoint BezierII(int degree,KoPoint *V, double t) * Find the maximum squared distance of digitized points * to fitted curve. */ -static double ComputeMaxError(QPtrList<KoPoint> points,int first,int last,KoPoint *curve,double *u,int *splitPoint) +static double ComputeMaxError(TQPtrList<KoPoint> points,int first,int last,KoPoint *curve,double *u,int *splitPoint) { int i; double maxDist; /* Maximum error */ @@ -390,12 +390,12 @@ static double NewtonRaphsonRootFind(KoPoint *Q,KoPoint P,double u) { double numerator, denominator; KoPoint Q1[3], Q2[2]; /* Q' and Q'' */ - KoPoint Q_u, Q1_u, Q2_u; /*u evaluated at Q, Q', & Q'' */ + KoPoint TQ_u, Q1_u, Q2_u; /*u evaluated at Q, Q', & Q'' */ double uPrime; /* Improved u */ int i; /* Compute Q(u) */ - Q_u = BezierII(3,Q, u); + TQ_u = BezierII(3,Q, u); /* Generate control vertices for Q' */ for (i = 0; i <= 2; i++) { @@ -414,9 +414,9 @@ static double NewtonRaphsonRootFind(KoPoint *Q,KoPoint P,double u) Q2_u = BezierII(1, Q2, u); /* Compute f(u)/f'(u) */ - numerator = (Q_u.x() - P.x()) * (Q1_u.x()) + (Q_u.y() - P.y()) * (Q1_u.y()); + numerator = (TQ_u.x() - P.x()) * (Q1_u.x()) + (TQ_u.y() - P.y()) * (Q1_u.y()); denominator = (Q1_u.x()) * (Q1_u.x()) + (Q1_u.y()) * (Q1_u.y()) + - (Q_u.x() - P.x()) * (Q2_u.x()) + (Q_u.y() - P.y()) * (Q2_u.y()); + (TQ_u.x() - P.x()) * (Q2_u.x()) + (TQ_u.y() - P.y()) * (Q2_u.y()); /* u = u - f(u)/f'(u) */ uPrime = u - (numerator/denominator); @@ -425,11 +425,11 @@ static double NewtonRaphsonRootFind(KoPoint *Q,KoPoint P,double u) /* * Reparameterize: - * Given set of points and their parameterization, try to find + * Given set of points and their parameterization, try to tqfind * a better parameterization. * */ -static double *Reparameterize(QPtrList<KoPoint> points,int first,int last,double *u,KoPoint *curve) +static double *Reparameterize(TQPtrList<KoPoint> points,int first,int last,double *u,KoPoint *curve) { int nPts = last-first+1; int i; @@ -443,7 +443,7 @@ static double *Reparameterize(QPtrList<KoPoint> points,int first,int last,double return (uPrime); } -KoPoint *FitCubic(QPtrList<KoPoint> &points,int first,int last,FitVector tHat1,FitVector tHat2,float error,int &width){ +KoPoint *FitCubic(TQPtrList<KoPoint> &points,int first,int last,FitVector tHat1,FitVector tHat2,float error,int &width){ double *u; double *uPrime; double maxError; @@ -538,7 +538,7 @@ KoPoint *FitCubic(QPtrList<KoPoint> &points,int first,int last,FitVector tHat1,F } -VPath *bezierFit(QPtrList<KoPoint> &points,float error){ +VPath *bezierFit(TQPtrList<KoPoint> &points,float error){ FitVector tHat1, tHat2; tHat1 = ComputeLeftTangent(points,0); |