#include <FourierCoefficient.h>
Public Types | |
enum | { numOfCoeffs = 80 } |
Public Member Functions | |
FourierCoefficient () | |
Constructor. | |
~FourierCoefficient () | |
Destructor. | |
long | fourierSynth (JointData::JointID joint, unsigned long time, int cMax, double scalingFactor=1.0) |
Synthesizes the value of the original function for a given joint using the fourier coefficients. | |
long | fourierSynth (JointData *jointData, unsigned long time, int cMax) |
Like the other fourierSynth, a change to the joint parameter and no return value. | |
bool | calcLUT (JointData::JointID joint, int cMax) |
Calculate LUT for the function values so they don't have to be computed every time the synth. | |
bool | calcAllLUTs (int cMax) |
Calculate all LUTs. | |
bool | calculate (long *functionValues, JointData::JointID joint) |
Calculate coefficients from the function values over one period. | |
bool | calcPhiAndR (int numOfC=numOfCoeffs) |
Calculates phi and r for the first numOfC coefficients only Calculates the coefficients in the exponential form, i.e. | |
bool | calcReAndIm (int numOfC=numOfCoeffs) |
Calculates the coefficients in the vector form, i.e. | |
bool | merge (FourierCoefficient *fc0, FourierCoefficient *fc1, double w1, FourierCoefficient *fc2, double w2, FourierCoefficient *fc3, double w3, int numOfC) |
Takes 1+3=4 sets of Fourier coefficients and averages them according to the weights. | |
bool | merge (FourierCoefficient *fc1, double w1, FourierCoefficient *fc2, double w2, int numOfC) |
Similar to merge(many parameters) but only merges two sets! | |
double | phaseAlign (JointData::JointID joint) |
Function shifts all phases so that the 1 Hz frequency of the joint is a sine function starting at t=0 (i.e. | |
Public Attributes | |
int | lengthOfPeriod |
length of period these coefficients are designed for | |
double | real [JointData::numOfJoint][numOfCoeffs] |
real and imaginary parts of the coefficients | |
double | imaginary [JointData::numOfJoint][numOfCoeffs] |
double | phi [JointData::numOfJoint][numOfCoeffs] |
alternative representation: length r and phase phi of the coefficients | |
double | r [JointData::numOfJoint][numOfCoeffs] |
double | functionLUT [JointData::numOfJoint][numOfCoeffs] |
LUT that stores the function calculated from the coeffs. | |
bool | useLookUp [numOfCoeffs] |
Definition at line 20 of file FourierCoefficient.h.
|
Definition at line 23 of file FourierCoefficient.h. |
|
Constructor.
init all coefficients to zero Definition at line 12 of file FourierCoefficient.cpp. References functionLUT, imaginary, numOfCoeffs, phi, r, real, and useLookUp. |
|
Destructor.
Definition at line 30 of file FourierCoefficient.cpp. |
|
Synthesizes the value of the original function for a given joint using the fourier coefficients. A scaling factor is added. This allows the amplitude of the curve to be changed while keeping the origin/offset constant. This factor is also used for inverting the direction of the function (in essence playing the function backward if the factor is smaller than 0)
Definition at line 36 of file FourierCoefficient.cpp. References imaginary, numOfCoeffs, pi2, and real. Referenced by calcLUT(). |
|
Like the other fourierSynth, a change to the joint parameter and no return value. In contrast to the above, a reference to the entire joint data array is passed in order to minimize function calls. All joint values are computed in one go. Also scalingfactor is no longer used. don't need it, really.
Definition at line 74 of file FourierCoefficient.cpp. References JointData::data, imaginary, numOfCoeffs, pi2, and real. |
|
Calculate LUT for the function values so they don't have to be computed every time the synth. is used
Definition at line 115 of file FourierCoefficient.cpp. References fourierSynth(), functionLUT, lengthOfPeriod, numOfCoeffs, real, and useLookUp. Referenced by calcAllLUTs(). |
Here is the call graph for this function:
|
Calculate all LUTs.
Definition at line 126 of file FourierCoefficient.cpp. References calcLUT(). |
Here is the call graph for this function:
|
Calculate coefficients from the function values over one period.
Definition at line 137 of file FourierCoefficient.cpp. References imaginary, numOfCoeffs, pi2, and real. |
|
Calculates phi and r for the first numOfC coefficients only Calculates the coefficients in the exponential form, i.e. z = R * exp (i*phi), from the "vector" representation z = x + iy
Definition at line 245 of file FourierCoefficient.cpp. References imaginary, phi, r, and real. Referenced by phaseAlign(). |
|
Calculates the coefficients in the vector form, i.e. z = x + iy, from the exponential representation z = R * exp (i*phi) Calculates the real and imaginary parts for the first numOfC coefficients
Definition at line 259 of file FourierCoefficient.cpp. References imaginary, phi, r, and real. Referenced by merge(), and phaseAlign(). |
|
Takes 1+3=4 sets of Fourier coefficients and averages them according to the weights. negative weights are interpreted relativly to fc0, a weight=1 means: go from fc0 100% into direction fcn, so fc=fc0+w1*(fc1-fc0)+w2*(fc2-fc0)+... Takes an parameter that determines the accuracy of the merge, i.e. the number of coefficients that are merged
always use the (direction of) difference with the smaller abs() Definition at line 190 of file FourierCoefficient.cpp. References calcReAndIm(), phi, pi, pi2, and r. |
Here is the call graph for this function:
|
Similar to merge(many parameters) but only merges two sets!
Definition at line 220 of file FourierCoefficient.cpp. References calcReAndIm(), phi, pi, pi2, and r. |
Here is the call graph for this function:
|
Function shifts all phases so that the 1 Hz frequency of the joint is a sine function starting at t=0 (i.e. there is no cosine part).This is necessary when using different function since they usually are not coherent. Coherence may be desirable in order to merge or superimpose two given functions.
Definition at line 165 of file FourierCoefficient.cpp. References calcPhiAndR(), calcReAndIm(), numOfCoeffs, and phi. |
Here is the call graph for this function:
|
length of period these coefficients are designed for
Definition at line 171 of file FourierCoefficient.h. Referenced by calcLUT(). |
|
real and imaginary parts of the coefficients
Definition at line 174 of file FourierCoefficient.h. Referenced by calcLUT(), calcPhiAndR(), calcReAndIm(), calculate(), FourierCoefficient(), fourierSynth(), operator<<(), and operator>>(). |
|
Definition at line 175 of file FourierCoefficient.h. Referenced by calcPhiAndR(), calcReAndIm(), calculate(), FourierCoefficient(), fourierSynth(), operator<<(), and operator>>(). |
|
alternative representation: length r and phase phi of the coefficients
Definition at line 179 of file FourierCoefficient.h. Referenced by calcPhiAndR(), calcReAndIm(), FourierCoefficient(), merge(), and phaseAlign(). |
|
Definition at line 180 of file FourierCoefficient.h. Referenced by calcPhiAndR(), calcReAndIm(), FourierCoefficient(), and merge(). |
|
LUT that stores the function calculated from the coeffs.
Definition at line 183 of file FourierCoefficient.h. Referenced by calcLUT(), and FourierCoefficient(). |
|
Definition at line 185 of file FourierCoefficient.h. Referenced by calcLUT(), and FourierCoefficient(). |