Utility class to interpolate points spaced evenly along a piecewise defined curve with fitted spline.
More...
#include <ExportOrdinalsSmooth.h>
|
| ExportOrdinalsSmooth () |
| Single constructor. More...
|
|
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. More...
|
|
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 coordinates. More...
|
|
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. More...
|
|
Utility class to interpolate points spaced evenly along a piecewise defined curve with fitted spline.
Definition at line 20 of file ExportOrdinalsSmooth.h.
◆ ExportOrdinalsSmooth()
ExportOrdinalsSmooth::ExportOrdinalsSmooth |
( |
| ) |
|
◆ loadSplinePairsWithoutTransformation()
void ExportOrdinalsSmooth::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.
Definition at line 22 of file ExportOrdinalsSmooth.cpp.
28 Points::const_iterator itrP;
29 for (itrP = points.begin(); itrP != points.end(); itrP++) {
30 const Point &point = *itrP;
#define LOG4CPP_INFO_S(logger)
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.
log4cpp::Category * mainCat
Single X/Y pair for cubic spline interpolation initialization and calculations.
◆ loadSplinePairsWithTransformation()
void ExportOrdinalsSmooth::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 coordinates.
Definition at line 39 of file ExportOrdinalsSmooth.cpp.
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)));
double linearize(double value, bool isLog) const
Convert log coordinates to linear. This is a noop if the input is already linear. ...
#define LOG4CPP_INFO_S(logger)
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.
log4cpp::Category * mainCat
Warps log coordinates to make them linear before passing them to code that accepts only linear coordi...
Single X/Y pair for cubic spline interpolation initialization and calculations.
◆ ordinalsAtIntervalsGraph()
ExportValuesOrdinal ExportOrdinalsSmooth::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.
Definition at line 64 of file ExportOrdinalsSmooth.cpp.
70 const double NUM_SMALLER_INTERVALS = 1000;
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 tIter = tMin + ((tMax - tMin) * iT) / (NUM_SMALLER_INTERVALS - 1.0);
99 SplinePair pairNew = spline.interpolateCoeff(tIter);
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 * tIter;
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.
double y() const
Get method for y.
#define LOG4CPP_INFO_S(logger)
log4cpp::Category * mainCat
double x() const
Get method for x.
QList< double > ExportValuesOrdinal
Single X/Y pair for cubic spline interpolation initialization and calculations.
The documentation for this class was generated from the following files: