diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2016-09-03 01:10:18 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2016-09-03 01:10:18 -0300 |
commit | 077270f0294d236c6047d850703c5d011cb4b711 (patch) | |
tree | c655594e525222104c49564f097734537ccc322b /Project/SyncGenerator.cpp | |
parent | bd3f70a62f8c2868e20f094a0ad7dd8c977ab853 (diff) | |
download | PSP.git-077270f0294d236c6047d850703c5d011cb4b711.tar.gz PSP.git-077270f0294d236c6047d850703c5d011cb4b711.tar.xz PSP.git-077270f0294d236c6047d850703c5d011cb4b711.zip |
Motor implementation done, elements classes reorganized
Diffstat (limited to 'Project/SyncGenerator.cpp')
-rw-r--r-- | Project/SyncGenerator.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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<wxPoint2DDouble> 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; +} |