2023-03-26 12:58:31 +00:00
|
|
|
#pragma once
|
2025-04-23 14:26:33 +00:00
|
|
|
#include <JuceHeader.h>
|
2023-03-26 12:58:31 +00:00
|
|
|
|
2025-04-23 14:26:33 +00:00
|
|
|
class BulgeEffect : public osci::EffectApplication {
|
2023-03-26 12:58:31 +00:00
|
|
|
public:
|
2025-04-24 09:47:03 +00:00
|
|
|
osci::Point apply(int index, osci::Point input, const std::vector<std::atomic<double>>& values, double sampleRate) override {
|
|
|
|
double value = values[0];
|
|
|
|
double translatedBulge = -value + 1;
|
2023-03-26 12:58:31 +00:00
|
|
|
|
2025-04-24 09:47:03 +00:00
|
|
|
double r = sqrt(pow(input.x, 2) + pow(input.y, 2));
|
|
|
|
double theta = atan2(input.y, input.x);
|
|
|
|
double rn = pow(r, translatedBulge);
|
|
|
|
|
|
|
|
return osci::Point(rn * cos(theta), rn * sin(theta), input.z);
|
|
|
|
}
|
2024-08-26 17:09:29 +00:00
|
|
|
};
|