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){
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{x,y};
return QPointF{
2*pow(cos(t),3),
2*pow(sin(t),3)
};
}
QPointF RenderArea::ComputeCycloid(double t)
{
return QPointF{
1.5 * (1 - cos(t)),
1.5 * (t - sin(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)
{
return QPointF{
1.5 * (2 * cos(t) + cos(2 * t)),
1.5 * (2 * sin(t) - sin(2 * t))
};
}
QSize RenderArea::minimumSizeHint() const
@ -70,16 +81,22 @@ void RenderArea::OnShapeChanged()
case Astroid:
mScale=50;
mIntervalLenght=2*M_PI;
mStepCount=256;
mStepCount=512;
break;
case Cycloid:
mScale=10;
mIntervalLenght=6*M_PI;
mStepCount=128;
break;
case HuygensCycloid:
mScale=10;
mIntervalLenght=4*M_PI;
mStepCount=512;
break;
case HypoCycloid:
mScale=50;
mIntervalLenght=2*M_PI;
mStepCount=256;
break;
default:
break;