7#include "ExportOrdinalsSmooth.h"
13#include "Transformation.h"
23 vector<SplinePair> &xy)
const
25 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsSmooth::loadSplinePairsWithoutTransformation";
27 Points::const_iterator itrP;
28 for (itrP = points.begin(); itrP != points.end(); itrP++) {
29 const Point &point = *itrP;
41 vector<SplinePair> &xy)
const
43 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsSmooth::loadSplinePairsWithTransformation";
45 Points::const_iterator itrP;
46 for (itrP = points.begin(); itrP != points.end(); itrP++) {
47 const Point &point = *itrP;
60 const vector<SplinePair> &xy,
61 double pointsInterval)
const
63 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsSmooth::ordinalsAtIntervalsGraph";
65 const double NUM_SMALLER_INTERVALS = 1000;
68 ExportValuesOrdinal ordinals;
75 double integratedSeparation = 0;
76 QPointF posLast (xy [0].x(),
82 double tMin = t.front();
83 double tMax = t.back();
86 int iTLastInterval = 0;
87 for (
int iT = 0; iT < NUM_SMALLER_INTERVALS; iT++) {
89 double t = tMin + ((tMax - tMin) * iT) / (NUM_SMALLER_INTERVALS - 1.0);
93 QPointF posNew = QPointF (pairNew.
x(),
96 QPointF posDelta = posNew - posLast;
97 double integratedSeparationDelta = qSqrt (posDelta.x() * posDelta.x() + posDelta.y() * posDelta.y());
98 integratedSeparation += integratedSeparationDelta;
100 while (integratedSeparation >= pointsInterval) {
108 sInterp = (double) pointsInterval / (
double) integratedSeparation;
110 double tInterp = (1.0 - sInterp) * tLast + sInterp * t;
112 integratedSeparation -= pointsInterval;
115 ordinals.push_back (tInterp);
123 if (iTLastInterval < NUM_SMALLER_INTERVALS - 1) {
126 ordinals.push_back (tMax);
void loadSplinePairsWithTransformation(const Points &points, const Transformation &transformation, std::vector< double > &t, std::vector< SplinePair > &xy) const
Load t (=ordinal) and xy (=screen position) spline pairs, converting screen coordinates to graph coor...
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.
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...
ExportOrdinalsSmooth()
Single constructor.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
QPointF posScreen() const
Accessor for screen position.
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
Single X/Y pair for cubic spline interpolation initialization and calculations.
double y() const
Get method for y.
double x() const
Get method for x.
Cubic interpolation given independent and dependent value vectors.
SplinePair interpolateCoeff(double t) const
Return interpolated y for specified x.