OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PortSinusGaussian.hpp
Go to the documentation of this file.
1#pragma once
3#define _USE_MATH_DEFINES
4#include <math.h>
5
6
7template<class T>
9{
10 _frequencyMiddle = (_frequencyMax + _frequencyMin) / 2;
11 _exponentCoefficient = -pow(M_PI, 2) / (4 * log(_fadedAmplitude)) * pow(_frequencyMax - _frequencyMin, 2);
12 _timeShift = sqrt(-(log(_fadedAmplitude)/_exponentCoefficient));
13}
14
15template<class T>
17{
18 double t1 = exp(-_exponentCoefficient * pow(currentTime - _timeShift, 2));
19 double t2 = cos(2 * M_PI * _frequencyMiddle * (currentTime - _timeShift));
20 T currentValue =static_cast<T>(t1 * t2);
21 return currentValue;
22}
Definition PortSinusGaussian.h:5
T CalculateCurrentValue(float currentTime) override
Definition PortSinusGaussian.hpp:16