Quantum/osc/drawings.h

60 lines
1.3 KiB
C
Raw Permalink Normal View History

2023-12-16 16:17:02 +01:00
#ifndef ELEMENT_H
#define ELEMENT_H
/*
#include <vector>
#include <string>
#include <functional>*/
#include "canvas.h"
static constexpr unsigned NumWeight = 10;
static constexpr double M_PI = 3.1415926;
class BackGround : public Canvas {
public:
BackGround (const int w, const int h) : Canvas (w, h) {};
virtual ~BackGround (){};
void drawings ();
};
class ForeGround : public Canvas {
unsigned index, speed;
double weights [NumWeight];
double normals [NumWeight];
public:
ForeGround (const int w, const int h) : Canvas (w, h) {
normalize ();
};
virtual ~ForeGround (){};
void drawings ();
void setWeight (const int n, const int w) {
weights [n] = (double) w * 0.01;
}
void changeSpeed (int s) { speed = s; };
void step ();
void reset () {
index = 0;
}
protected:
double probality (const double x) const;
void normalize ();
void phase ();
};
struct CommonPlots {
int maxx, maxy;
bool StartStop;
BackGround * bg;
ForeGround * fg;
CommonPlots (const int w, const int h) : maxx (w), maxy(h) {
bg = new BackGround (w,h);
fg = new ForeGround (w,h);
bg->drawings();
fg->drawings();
StartStop = false;
}
~CommonPlots () {
delete bg;
delete fg;
}
};
#endif // ELEMENT_H