69 lines
2.3 KiB
C++
69 lines
2.3 KiB
C++
#ifndef POINTCALCULATE_H
|
|
#define POINTCALCULATE_H
|
|
|
|
#include <QPointF>
|
|
|
|
#include "filemanager.h"
|
|
|
|
namespace PointCalculate{
|
|
void setExperimentData(const QVector<Global::ExperimentData>&);
|
|
|
|
QPair<QPointF,QPointF> getStartAndEndPoint();
|
|
QVector<Global::ExperimentData> getDataInXRange(const float, const float);
|
|
QVector<QPointF> getPointVtrInXRange(const float, const float);
|
|
|
|
void setRegionPointX(const float,const float);
|
|
|
|
QPointF getClosestPointByX(const float);
|
|
QVector<QPointF> getNearbyPointGroupByX(const float);
|
|
|
|
QPointF getClosestPointByY(const float left,const float right,const float valueY);
|
|
QPointF getPeakPoint();
|
|
QPair<float, float> getMaxMinValue();
|
|
|
|
QPair<QPointF,QPointF> calculateStartAndEndPoint();
|
|
float calculateArea();
|
|
|
|
// text format
|
|
QString textFormatPeakPoint(const float enthalpyValue,
|
|
const float peakValue,
|
|
const float startPoint,
|
|
const float endPoint);
|
|
QString textFormatNumbericalLabel(const QPointF);
|
|
QString textFormatStartPoint(const QPointF);
|
|
QString textFormatEndPoint(const QPointF);
|
|
QString textFormatGlassTranstion(const float t1,const float tg,const float t2);
|
|
|
|
// glass transition
|
|
QPair<float,float> getCurveInflectionPointTangent(const float,const float);
|
|
struct Line {
|
|
double slope; //
|
|
double intercept; //
|
|
};
|
|
QPointF getIntersection(const Line& line1, const Line& line2);
|
|
double calculateSlope(double x1, double y1, double x2, double y2) ;
|
|
QVector<double> findInflectionPoints(const QVector<double>& x, const QVector<double>& y) ;
|
|
QMap<double, Line> calculateTangentLine(const QVector<double>& x, const QVector<double>& y) ;
|
|
|
|
//private
|
|
void updateStartEndPoint();
|
|
QPair<QPointF,QPointF> calculateMaxDiffPointLeft();
|
|
QPair<QPointF,QPointF> calculateMaxDiffPointRight();
|
|
enum MaxDiffPointDetailType{
|
|
Left,
|
|
Right
|
|
};
|
|
QPair<QPointF,QPointF> calculateMaxDiffPointDetail(const MaxDiffPointDetailType type);
|
|
|
|
QPointF calculateIntersection(const QPointF p1,const QPointF p2,
|
|
const QPointF p3, const QPointF p4);
|
|
QVector<QPointF> getPeakPointGroup();
|
|
std::vector<float> movingAverage(const std::vector<float>& data, int windowSize);
|
|
|
|
extern QVector<Global::ExperimentData> _dataVtr;
|
|
extern QPointF _peakPoint;
|
|
extern QPointF _leftSelectedPoint,_rightSelectedPoint;
|
|
}
|
|
|
|
#endif // POINTCALCULATE_H
|