diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-02 18:08:53 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-02 18:08:53 -0300 |
commit | bd3f70a62f8c2868e20f094a0ad7dd8c977ab853 (patch) | |
tree | 7b3cc0de1debe3130f5c95b73052aee3f5d52a43 /Project/Generator.cpp | |
parent | b06d4c3d76cca3ed8a54dae1d978030d687233b2 (diff) | |
download | PSP.git-bd3f70a62f8c2868e20f094a0ad7dd8c977ab853.tar.gz PSP.git-bd3f70a62f8c2868e20f094a0ad7dd8c977ab853.tar.xz PSP.git-bd3f70a62f8c2868e20f094a0ad7dd8c977ab853.zip |
Motor under implementation
Diffstat (limited to 'Project/Generator.cpp')
-rw-r--r-- | Project/Generator.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Project/Generator.cpp b/Project/Generator.cpp index 74adbef..c98e912 100644 --- a/Project/Generator.cpp +++ b/Project/Generator.cpp @@ -1,6 +1,18 @@ #include "Generator.h" -Generator::Generator() {} +Generator::Generator() : Element() +{ + 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)); + } +} Generator::~Generator() {} bool Generator::AddParent(Element* parent, wxPoint2DDouble position) { @@ -53,6 +65,13 @@ void Generator::Draw(wxPoint2DDouble translation, double scale) const glColor4d(0.2, 0.2, 0.2, 1.0); DrawCircle(m_position, 25.0, 20); + + // 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); } } |