-> also deleted obsolete UBInterpolator classespreferencesAboutTextFull
parent
123ebf1d95
commit
1a075c057d
@ -1,53 +0,0 @@ |
||||
#include "UBInterpolator.h" |
||||
|
||||
UBInterpolator::UBInterpolator() |
||||
{ |
||||
} |
||||
|
||||
UBInterpolator::~UBInterpolator() |
||||
{ |
||||
} |
||||
|
||||
UBQuadraticBezier::UBQuadraticBezier() |
||||
{ |
||||
mPath = 0; |
||||
} |
||||
|
||||
UBQuadraticBezier::~UBQuadraticBezier() |
||||
{ |
||||
if (mPath) |
||||
delete mPath; |
||||
} |
||||
|
||||
void UBQuadraticBezier::setPoints(QList<QPointF> points) |
||||
{ |
||||
setPoints(points[0], points[1], points[2]); |
||||
|
||||
} |
||||
|
||||
void UBQuadraticBezier::setPoints(QPointF start, QPointF control, QPointF end) |
||||
{ |
||||
mPath = new QPainterPath(start); |
||||
mPath->quadTo(control, end); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Return n points along the curve, including start and end points (thus n should be larger than or equal to 2). |
||||
* |
||||
* The higher n, the more accurate the resulting curve will be. |
||||
*/ |
||||
QList<QPointF> UBQuadraticBezier::getPoints(int n) |
||||
{ |
||||
QList<QPointF> points; |
||||
|
||||
if (n <= 1) |
||||
return points; |
||||
|
||||
for (int i(0); i <= n; ++i) { |
||||
qreal percent = qreal(i)/qreal(n); |
||||
|
||||
points << mPath->pointAtPercent(percent); |
||||
} |
||||
|
||||
return points; |
||||
} |
@ -1,45 +0,0 @@ |
||||
#ifndef UBINTERPOLATOR_H |
||||
#define UBINTERPOLATOR_H |
||||
|
||||
#include <QtGui> |
||||
|
||||
class UBInterpolator |
||||
{ |
||||
/* Abstract class representing an interpolator */ |
||||
|
||||
public: |
||||
enum InterpolationMethod { |
||||
NoInterpolation, |
||||
//SimpleSpline,
|
||||
//CatmullRom,
|
||||
Bezier |
||||
}; |
||||
|
||||
UBInterpolator(); |
||||
virtual ~UBInterpolator(); |
||||
|
||||
virtual void setPoints(QList<QPointF> points) = 0; |
||||
//virtual double y(double x) {}
|
||||
|
||||
}; |
||||
|
||||
class UBQuadraticBezier : public UBInterpolator |
||||
{ |
||||
|
||||
public: |
||||
UBQuadraticBezier(); |
||||
virtual ~UBQuadraticBezier(); |
||||
|
||||
virtual void setPoints(QList<QPointF> points); |
||||
void setPoints(QPointF start, QPointF control, QPointF end); |
||||
|
||||
//virtual double y(double x);
|
||||
|
||||
QList<QPointF> getPoints(int n); |
||||
|
||||
private: |
||||
|
||||
QPainterPath* mPath; |
||||
}; |
||||
|
||||
#endif // UBINTERPOLATOR_H
|
Loading…
Reference in new issue