up
This commit is contained in:
parent
7a0b812869
commit
2ba6957f93
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.3.1, 2017-08-28T08:25:14. -->
|
||||
<!-- Written by QtCreator 4.3.1, 2017-08-28T10:09:40. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{9311c877-cd31-4d5b-986a-ff7eaf9ec7ed}</value>
|
||||
<value type="QByteArray">{cc43eb28-2519-4f1e-b7c4-4119ef119db4}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@ -282,17 +282,14 @@
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">-1</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QtCurvesCpp</value>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/DEVEL/QtCurvesCpp/QtCurvesCpp.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">QtCurvesCpp.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/DEVEL/build-QtCurvesCpp-Desktop_Qt_5_9_1_MinGW_32bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
|
@ -43,3 +43,9 @@ void MainWindow::on_btnHypo_clicked()
|
||||
this->ui->renderArea->setShape(RenderArea::HypoCycloid);
|
||||
this->ui->renderArea->repaint();
|
||||
}
|
||||
|
||||
void MainWindow::on_btnLine_clicked()
|
||||
{
|
||||
this->ui->renderArea->setShape(RenderArea::Line);
|
||||
this->ui->renderArea->repaint();
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ class MainWindow : public QMainWindow
|
||||
|
||||
void on_btnHypo_clicked();
|
||||
|
||||
void on_btnLine_clicked();
|
||||
|
||||
private:
|
||||
constexpr static QWidget* root = 0;
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -236,6 +236,18 @@ border-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnLine">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(255, 255, 255);
|
||||
background-color: rgb(36, 35, 35);
|
||||
border-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -13,7 +13,7 @@ RenderArea::RenderArea(QWidget *parent) :
|
||||
QPointF RenderArea::ComputeAstroid(double t){
|
||||
return QPointF{
|
||||
2*pow(cos(t),3),
|
||||
2*pow(sin(t),3)
|
||||
2*pow(sin(t),3)
|
||||
};
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ QPointF RenderArea::ComputeCycloid(double t)
|
||||
{
|
||||
return QPointF{
|
||||
1.5 * (1 - cos(t)),
|
||||
1.5 * (t - sin(t))
|
||||
1.5 * (t - sin(t))
|
||||
};
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ QPointF RenderArea::ComputeHuygens(double t)
|
||||
{
|
||||
return QPointF{
|
||||
4 * (3 * cos(t) - cos(3 * t)),
|
||||
4 * (3 * sin(t) - sin(3 * t))
|
||||
4 * (3 * sin(t) - sin(3 * t))
|
||||
};
|
||||
}
|
||||
|
||||
@ -37,10 +37,15 @@ QPointF RenderArea::ComputeHypo(double t)
|
||||
{
|
||||
return QPointF{
|
||||
1.5 * (2 * cos(t) + cos(2 * t)),
|
||||
1.5 * (2 * sin(t) - sin(2 * t))
|
||||
1.5 * (2 * sin(t) - sin(2 * t))
|
||||
};
|
||||
}
|
||||
|
||||
QPointF RenderArea::ComputeLine(double t)
|
||||
{
|
||||
return QPointF{1-t,1-t};
|
||||
}
|
||||
|
||||
QSize RenderArea::minimumSizeHint() const
|
||||
{
|
||||
return QSize(100,100);
|
||||
@ -98,6 +103,11 @@ void RenderArea::OnShapeChanged()
|
||||
mIntervalLenght=2*M_PI;
|
||||
mStepCount=256;
|
||||
break;
|
||||
case Line:
|
||||
mScale=50;
|
||||
mIntervalLenght=1;
|
||||
mStepCount=128;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -110,13 +120,16 @@ QPointF RenderArea::Compute(double t)
|
||||
return ComputeAstroid(t);
|
||||
break;
|
||||
case Cycloid:
|
||||
return ComputeCycloid(t);
|
||||
return ComputeCycloid(t);
|
||||
break;
|
||||
case HuygensCycloid:
|
||||
return ComputeHuygens(t);
|
||||
return ComputeHuygens(t);
|
||||
break;
|
||||
case HypoCycloid:
|
||||
return ComputeHypo(t);
|
||||
return ComputeHypo(t);
|
||||
break;
|
||||
case Line:
|
||||
return ComputeLine(t);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -16,7 +16,8 @@ class RenderArea : public QWidget
|
||||
Astroid,
|
||||
Cycloid,
|
||||
HuygensCycloid,
|
||||
HypoCycloid
|
||||
HypoCycloid,
|
||||
Line
|
||||
};
|
||||
|
||||
void setBackgroundColor(QColor color) { mBackgroundColour = color; }
|
||||
@ -38,6 +39,7 @@ class RenderArea : public QWidget
|
||||
QPointF ComputeCycloid(double t);
|
||||
QPointF ComputeHuygens(double t);
|
||||
QPointF ComputeHypo(double t);
|
||||
QPointF ComputeLine(double t);
|
||||
QPointF Compute(double t);
|
||||
QColor mBackgroundColour,mShapeColour;
|
||||
ShapesType mShape;
|
||||
|
Loading…
Reference in New Issue
Block a user