2023-03-26 12:58:31 +00:00
|
|
|
#include "BulgeEffect.h"
|
|
|
|
|
|
|
|
BulgeEffect::BulgeEffect() {}
|
|
|
|
|
|
|
|
BulgeEffect::~BulgeEffect() {}
|
|
|
|
|
2024-10-23 11:44:31 +00:00
|
|
|
OsciPoint BulgeEffect::apply(int index, OsciPoint input, const std::vector<std::atomic<double>>& values, double sampleRate) {
|
2023-07-14 14:34:24 +00:00
|
|
|
double value = values[0];
|
2023-03-26 12:58:31 +00:00
|
|
|
double translatedBulge = -value + 1;
|
|
|
|
|
2024-01-07 19:48:02 +00:00
|
|
|
double r = sqrt(pow(input.x, 2) + pow(input.y, 2));
|
2023-03-26 12:58:31 +00:00
|
|
|
double theta = atan2(input.y, input.x);
|
|
|
|
double rn = pow(r, translatedBulge);
|
|
|
|
|
2024-10-23 11:44:31 +00:00
|
|
|
return OsciPoint(rn * cos(theta), rn * sin(theta), input.z);
|
2023-03-26 12:58:31 +00:00
|
|
|
}
|