summaryrefslogtreecommitdiffstats
path: root/Project/SyncGenerator.cpp
blob: 377239d6444c0a21ed9afdfe2346f04c468fc7f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#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"));
    GeneralMenuItens(menu);
    return true;
}