2023-03-26 12:58:31 +00:00
|
|
|
#include "BulgeEffect.h"
|
|
|
|
|
|
|
|
BulgeEffect::BulgeEffect() {}
|
|
|
|
|
|
|
|
BulgeEffect::~BulgeEffect() {}
|
|
|
|
|
2023-07-14 14:34:24 +00:00
|
|
|
Vector2 BulgeEffect::apply(int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
|
|
|
double value = values[0];
|
2023-03-26 12:58:31 +00:00
|
|
|
double translatedBulge = -value + 1;
|
|
|
|
|
|
|
|
double r = input.magnitude();
|
|
|
|
double theta = atan2(input.y, input.x);
|
|
|
|
double rn = pow(r, translatedBulge);
|
|
|
|
|
|
|
|
return Vector2(rn * cos(theta), rn * sin(theta));
|
|
|
|
}
|