2023-03-26 12:58:31 +00:00
|
|
|
#include "BulgeEffect.h"
|
|
|
|
|
|
|
|
BulgeEffect::BulgeEffect() {}
|
|
|
|
|
|
|
|
BulgeEffect::~BulgeEffect() {}
|
|
|
|
|
2024-01-07 16:17:20 +00:00
|
|
|
Point BulgeEffect::apply(int index, Point input, const std::vector<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-01-07 19:48:02 +00:00
|
|
|
return Point(rn * cos(theta), rn * sin(theta), input.z);
|
2023-03-26 12:58:31 +00:00
|
|
|
}
|