#include "Envelope.h"
#include <float.h>
#include <math.h>
#include <wx/wxcrtvararg.h>
#include <wx/brush.h>
#include <wx/pen.h>
#include <wx/textfile.h>
#include <wx/log.h>
#include <wx/utils.h>
Go to the source code of this file.
|
static double | InterpolatePoints (double y1, double y2, double factor, bool logarithmic) |
|
static double | IntegrateInterpolated (double y1, double y2, double time, bool logarithmic) |
|
static double | IntegrateInverseInterpolated (double y1, double y2, double time, bool logarithmic) |
|
static double | SolveIntegrateInverseInterpolated (double y1, double y2, double time, double area, bool logarithmic) |
|
static void | checkResult (int n, double a, double b) |
|
◆ checkResult()
static void checkResult |
( |
int |
n, |
|
|
double |
a, |
|
|
double |
b |
|
) |
| |
|
static |
Definition at line 1441 of file Envelope.cpp.
1442{
1443 if( (a-b > 0 ? a-b : b-a) > 0.0000001 )
1444 {
1445 wxPrintf( "Envelope: Result #%d is: %f, should be %f\n", n, a, b );
1446
1447 }
1448}
◆ IntegrateInterpolated()
static double IntegrateInterpolated |
( |
double |
y1, |
|
|
double |
y2, |
|
|
double |
time, |
|
|
bool |
logarithmic |
|
) |
| |
|
static |
Definition at line 1159 of file Envelope.cpp.
1160{
1161
1162
1163
1164
1165
1166
1167
1168 if(logarithmic)
1169 {
1170 double l = log(y1 / y2);
1171 if(fabs(l) < 1.0e-5)
1172 return (y1 + y2) * 0.5 * time;
1173 return (y1 - y2) / l * time;
1174 }
1175 else
1176 {
1177 return (y1 + y2) * 0.5 * time;
1178 }
1179}
Referenced by Envelope::Integral().
◆ IntegrateInverseInterpolated()
static double IntegrateInverseInterpolated |
( |
double |
y1, |
|
|
double |
y2, |
|
|
double |
time, |
|
|
bool |
logarithmic |
|
) |
| |
|
static |
◆ InterpolatePoints()
static double InterpolatePoints |
( |
double |
y1, |
|
|
double |
y2, |
|
|
double |
factor, |
|
|
bool |
logarithmic |
|
) |
| |
|
static |
◆ SolveIntegrateInverseInterpolated()
static double SolveIntegrateInverseInterpolated |
( |
double |
y1, |
|
|
double |
y2, |
|
|
double |
time, |
|
|
double |
area, |
|
|
bool |
logarithmic |
|
) |
| |
|
static |
Definition at line 1197 of file Envelope.cpp.
1198{
1199
1200
1201 double a = area / time, res;
1202 if(logarithmic)
1203 {
1204 double l = log(y1 / y2);
1205 if(fabs(l) < 1.0e-5)
1206 res = a * (y1 + y2) * 0.5;
1207 else if(1.0 + a * y1 * l <= 0.0)
1208 res = 1.0;
1209 else
1210 res = log1p(a * y1 * l) / l;
1211 }
1212 else
1213 {
1214 if(fabs(y2 - y1) < 1.0e-5)
1215 res = a * (y1 + y2) * 0.5;
1216 else
1217 res = y1 * expm1(a * (y2 - y1)) / (y2 - y1);
1218 }
1219 return std::max(0.0,
std::min(1.0, res)) * time;
1220}
References min().
Referenced by Envelope::SolveIntegralOfInverse().
◆ VALUE_TOLERANCE
const double VALUE_TOLERANCE = 0.001 |
|
static |