20 lines
561 B
C++
20 lines
561 B
C++
//
|
|
// Created by robtor on 6/18/25.
|
|
//
|
|
|
|
#include "ICalibrator.h"
|
|
|
|
namespace floatpump {
|
|
LinearCalibrator::LinearCalibrator(std::pair<std::pair<double, double>, std::pair<double, double>> points)
|
|
{
|
|
_a = 1.0 * (points.second.second - points.first.second) / (points.second.first - points.first.first);
|
|
_b = points.first.second - (_a * points.first.first);
|
|
_calibration_points = std::move(points);
|
|
}
|
|
|
|
|
|
auto LinearCalibrator::translate(double measurand) -> double
|
|
{
|
|
return _a * measurand + _b;
|
|
}
|
|
} // floatpump
|