#include #include #include #include #include #include "Pendulum.h" using namespace std::chrono; class QTimer; class Simulation : public QObject { Q_OBJECT public: explicit Simulation(); double sizeMeters = 50; double gravity {}; double timescale {}; int substeps {}; bool isPlaying = false; std::mutex pendulaMutex; signals: void layoutChanged(const std::vector *newPendula); void positionChanged(const std::vector *changedPendula); public slots: void clearPendula(); void addPendula(const std::vector &add); private slots: void update(); private: QTimer * timer; int updateInterval = 17; std::vector pendula; time_point lastUpdate; };