From 077270f0294d236c6047d850703c5d011cb4b711 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 3 Sep 2016 01:10:18 -0300 Subject: Motor implementation done, elements classes reorganized --- Project/SyncGenerator.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Project/SyncGenerator.cpp (limited to 'Project/SyncGenerator.cpp') diff --git a/Project/SyncGenerator.cpp b/Project/SyncGenerator.cpp new file mode 100644 index 0000000..dff180d --- /dev/null +++ b/Project/SyncGenerator.cpp @@ -0,0 +1,33 @@ +#include "SyncGenerator.h" + +SyncGenerator::SyncGenerator() : Machines() +{ + int numPtsSine = 10; + double mx = 15.0; + double my = 10.0; + double pi = 3.14159265359; + + for(int i = 0; i <= numPtsSine; i++) { + double x = (2.0 * pi / double(numPtsSine)) * double(i) - pi; + double y = std::sin(x); + m_sinePts.push_back(wxPoint2DDouble((x / pi) * mx, y * my)); + } +} +SyncGenerator::~SyncGenerator() {} + +void SyncGenerator::DrawSymbol() const +{ + // Draw sine. + std::vector sinePts; + for(int i = 0; i < (int)m_sinePts.size(); i++) { + sinePts.push_back(m_sinePts[i] + m_position); + } + DrawLine(sinePts); +} +bool SyncGenerator::GetContextMenu(wxMenu& menu) +{ + menu.Append(ID_EDIT_SYNCGENERATOR, _("Edit Generator")); + menu.Append(ID_ROTATE, _("Rotate")); + menu.Append(ID_DELETE, _("Delete")); + return true; +} -- cgit