diff --git a/mainwindow.cpp b/mainwindow.cpp
index 6773daa..1b11254 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -92,6 +92,20 @@ void MainWindow::on_btnStarfish_clicked()
UpdateUi();
}
+void MainWindow::on_btnCloud_clicked()
+{
+ this->ui->renderArea->setShape(RenderArea::Cloud1);
+ this->ui->renderArea->repaint();
+ UpdateUi();
+}
+
+void MainWindow::on_btnInverseCloud_clicked()
+{
+ this->ui->renderArea->setShape(RenderArea::Cloud2);
+ this->ui->renderArea->repaint();
+ UpdateUi();
+}
+
void MainWindow::on_intervalInput_valueChanged(double interval)
{
this->ui->renderArea->setInternalLenght(interval);
diff --git a/mainwindow.h b/mainwindow.h
index 40ec709..9731170 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -47,6 +47,10 @@ class MainWindow : public QMainWindow
void on_btnStarfish_clicked();
+ void on_btnCloud_clicked();
+
+ void on_btnInverseCloud_clicked();
+
private:
void UpdateUi();
constexpr static QWidget* root = 0;
diff --git a/mainwindow.ui b/mainwindow.ui
index 3a3f096..be3e5ba 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -413,6 +413,30 @@ border-color: rgb(255, 255, 255);
+ -
+
+
+ color: rgb(255, 255, 255);
+background-color: rgb(36, 35, 35);
+border-color: rgb(255, 255, 255);
+
+
+ Cloud
+
+
+
+ -
+
+
+ color: rgb(255, 255, 255);
+background-color: rgb(36, 35, 35);
+border-color: rgb(255, 255, 255);
+
+
+ Inverse Cloud
+
+
+
-
-
diff --git a/renderarea.cpp b/renderarea.cpp
index a970739..31963c0 100644
--- a/renderarea.cpp
+++ b/renderarea.cpp
@@ -121,6 +121,25 @@ QPointF RenderArea::ComputeStarfish(double t)
};
}
+QPointF RenderArea::ComputeCloud2(double t)
+{
+ return ComputeCloudWithSign(t,1.);
+}
+
+QPointF RenderArea::ComputeCloud1(double t)
+{
+ return ComputeCloudWithSign(t,-1.);
+}
+
+QPointF RenderArea::ComputeCloudWithSign(double t,double sign)
+{
+ double a{14},b{1};
+ return QPointF{
+ (a+b)*cos(t*(b/a)) + sign*b*cos(t*((a+b)/a)),
+ (a+b)*sin(t*(b/a)) - b*sin(t*((a+b)/a))
+ };
+}
+
void RenderArea::OnShapeChanged()
{
switch (mShape) {
@@ -169,6 +188,16 @@ void RenderArea::OnShapeChanged()
mIntervalLenght=6*M_PI;
mStepCount=256;
break;
+ case Cloud1:
+ mScale=10;
+ mIntervalLenght=28*M_PI;
+ mStepCount=128;
+ break;
+ case Cloud2:
+ mScale=10;
+ mIntervalLenght=28*M_PI;
+ mStepCount=128;
+ break;
default:
break;
}
@@ -204,6 +233,12 @@ QPointF RenderArea::Compute(double t)
case Starfish:
return ComputeStarfish(t);
break;
+ case Cloud1:
+ return ComputeCloud1(t);
+ break;
+ case Cloud2:
+ return ComputeCloud2(t);
+ break;
default:
break;
}
diff --git a/renderarea.h b/renderarea.h
index e50beb6..d7ec8bc 100644
--- a/renderarea.h
+++ b/renderarea.h
@@ -22,7 +22,9 @@ class RenderArea : public QWidget
Circle,
Ellipse,
Fancy,
- Starfish
+ Starfish,
+ Cloud1,
+ Cloud2
};
void setBackgroundColor(QColor color) { mBackgroundColour = color; }
@@ -62,6 +64,9 @@ class RenderArea : public QWidget
QPointF ComputeEllipse(double t);
QPointF ComputeFancy(double t);
QPointF ComputeStarfish(double t);
+ QPointF ComputeCloud1(double t);
+ QPointF ComputeCloud2(double t);
+ QPointF ComputeCloudWithSign(double t,double sign);
QColor mBackgroundColour;
ShapesType mShape;
QPen mPen;