7 #include "ExportOrdinalsSmooth.h" 8 #include "LinearToLog.h" 14 #include "Transformation.h" 24 vector<SplinePair> &xy)
const 26 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsSmooth::loadSplinePairsWithoutTransformation";
28 Points::const_iterator itrP;
29 for (itrP = points.begin(); itrP != points.end(); itrP++) {
30 const Point &point = *itrP;
44 vector<SplinePair> &xy)
const 46 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsSmooth::loadSplinePairsWithTransformation";
50 Points::const_iterator itrP;
51 for (itrP = points.begin(); itrP != points.end(); itrP++) {
52 const Point &point = *itrP;
60 linearToLog.
linearize (posGraph.y(), isLogYRadius)));
65 const vector<SplinePair> &xy,
66 double pointsInterval)
const 68 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsSmooth::ordinalsAtIntervalsGraph";
70 const double NUM_SMALLER_INTERVALS = 1000;
73 ExportValuesOrdinal ordinals;
83 double integratedSeparation = 0;
84 QPointF posLast (xy [0].x(),
90 double tMin = t.front();
91 double tMax = t.back();
94 int iTLastInterval = 0;
95 for (
int iT = 0; iT < NUM_SMALLER_INTERVALS; iT++) {
97 double t = tMin + ((tMax - tMin) * iT) / (NUM_SMALLER_INTERVALS - 1.0);
101 QPointF posNew = QPointF (pairNew.
x(),
104 QPointF posDelta = posNew - posLast;
105 double integratedSeparationDelta = qSqrt (posDelta.x() * posDelta.x() + posDelta.y() * posDelta.y());
106 integratedSeparation += integratedSeparationDelta;
108 while (integratedSeparation >= pointsInterval) {
116 sInterp = (double) pointsInterval / (
double) integratedSeparation;
118 double tInterp = (1.0 - sInterp) * tLast + sInterp * t;
120 integratedSeparation -= pointsInterval;
123 ordinals.push_back (tInterp);
131 if (iTLastInterval < NUM_SMALLER_INTERVALS - 1) {
134 ordinals.push_back (tMax);
Cubic interpolation given independent and dependent value vectors.
SplinePair interpolateCoeff(double t) const
Return interpolated y for specified x.
double y() const
Get method for y.
double linearize(double value, bool isLog) const
Convert log coordinates to linear. This is a noop if the input is already linear. ...
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
QPointF posScreen() const
Accessor for screen position.
ExportValuesOrdinal ordinalsAtIntervalsGraph(const std::vector< double > &t, const std::vector< SplinePair > &xy, double pointsInterval) const
Perform the interpolation on the arrays loaded by the other methods.
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
void loadSplinePairsWithTransformation(const Points &points, const Transformation &transformation, bool isLogXTheta, bool isLogYRadius, std::vector< double > &t, std::vector< SplinePair > &xy) const
Load t (=ordinal) and xy (=screen position) spline pairs, converting screen coordinates to graph coor...
double x() const
Get method for x.
Warps log coordinates to make them linear before passing them to code that accepts only linear coordi...
ExportOrdinalsSmooth()
Single constructor.
Single X/Y pair for cubic spline interpolation initialization and calculations.
void loadSplinePairsWithoutTransformation(const Points &points, std::vector< double > &t, std::vector< SplinePair > &xy) const
Load t (=ordinal) and xy (=screen position) spline pairs, without any conversion to graph coordinates...