|
|
|
@ -12,7 +12,6 @@ |
|
|
|
|
#include <QDial> |
|
|
|
|
#include <QColorDialog> |
|
|
|
|
#include <QCoreApplication> |
|
|
|
|
#include "Pendulum.h" |
|
|
|
|
#include "Button.h" |
|
|
|
|
#include <QThread> |
|
|
|
|
#include <QCloseEvent> |
|
|
|
@ -297,6 +296,7 @@ QWidget * MainWindow::buildAddUI() { |
|
|
|
|
removeBtn->setStyleSheet("background-color: #ffaaaa"); |
|
|
|
|
|
|
|
|
|
connect(addBtn, &QPushButton::clicked, this, &MainWindow::add); |
|
|
|
|
connect(this, &MainWindow::pendulaCreated, simulation, &Simulation::addPendula); |
|
|
|
|
connect(removeBtn, &QPushButton::clicked, simulation, &Simulation::clearPendula); |
|
|
|
|
|
|
|
|
|
btnLyt->addWidget(addBtn); |
|
|
|
@ -393,8 +393,8 @@ void MainWindow::normalizeLengths() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MainWindow::add() { |
|
|
|
|
std::vector<Pendulum *> addPendula; |
|
|
|
|
if (multiple){ |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++){ |
|
|
|
|
auto M = std::vector(masses.begin(), masses.begin() + segments); |
|
|
|
|
auto L = std::vector(lengths.begin(), lengths.begin() + segments); |
|
|
|
@ -417,13 +417,14 @@ void MainWindow::add() { |
|
|
|
|
auto hue = float(progress + 0.5); |
|
|
|
|
c = QColor::fromHsvF(hue, 1, 1); |
|
|
|
|
} |
|
|
|
|
simulation->pendula.push_back(new Pendulum(M, L, c, angle)); |
|
|
|
|
addPendula.push_back(new Pendulum(M, L, c, angle)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
auto M = std::vector(masses.begin(), masses.begin() + segments); |
|
|
|
|
auto L = std::vector(lengths.begin(), lengths.begin() + segments); |
|
|
|
|
simulation->pendula.push_back(new Pendulum(M, L, color, startingAngle)); |
|
|
|
|
addPendula.push_back(new Pendulum(M, L, color, startingAngle)); |
|
|
|
|
} |
|
|
|
|
emit pendulaCreated(addPendula); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MainWindow::resetSimulationControl() { |
|
|
|
|