implementing the remaining curves

This commit is contained in:
thepra 2017-08-28 12:48:41 +02:00
parent 66b3828254
commit 7a0b812869

View File

@ -11,23 +11,34 @@ RenderArea::RenderArea(QWidget *parent) :
} }
QPointF RenderArea::ComputeAstroid(double t){ QPointF RenderArea::ComputeAstroid(double t){
double cos_t{cos(t)},sin_t{sin(t)},x{2*cos_t*cos_t*cos_t},y{2*sin_t*sin_t*sin_t}; return QPointF{
return QPointF{x,y}; 2*pow(cos(t),3),
2*pow(sin(t),3)
};
} }
QPointF RenderArea::ComputeCycloid(double t) QPointF RenderArea::ComputeCycloid(double t)
{ {
return QPointF{
1.5 * (1 - cos(t)),
1.5 * (t - sin(t))
};
} }
QPointF RenderArea::ComputeHuygens(double t) QPointF RenderArea::ComputeHuygens(double t)
{ {
return QPointF{
4 * (3 * cos(t) - cos(3 * t)),
4 * (3 * sin(t) - sin(3 * t))
};
} }
QPointF RenderArea::ComputeHypo(double t) QPointF RenderArea::ComputeHypo(double t)
{ {
return QPointF{
1.5 * (2 * cos(t) + cos(2 * t)),
1.5 * (2 * sin(t) - sin(2 * t))
};
} }
QSize RenderArea::minimumSizeHint() const QSize RenderArea::minimumSizeHint() const
@ -70,16 +81,22 @@ void RenderArea::OnShapeChanged()
case Astroid: case Astroid:
mScale=50; mScale=50;
mIntervalLenght=2*M_PI; mIntervalLenght=2*M_PI;
mStepCount=256; mStepCount=512;
break; break;
case Cycloid: case Cycloid:
mScale=10;
mIntervalLenght=6*M_PI;
mStepCount=128;
break; break;
case HuygensCycloid: case HuygensCycloid:
mScale=10;
mIntervalLenght=4*M_PI;
mStepCount=512;
break; break;
case HypoCycloid: case HypoCycloid:
mScale=50;
mIntervalLenght=2*M_PI;
mStepCount=256;
break; break;
default: default:
break; break;