22 #ifndef CRNLinearInterpolation_HEADER
23 #define CRNLinearInterpolation_HEADER
49 data(std::distance(beg, en))
54 for (Iter tmp = beg; tmp != en; ++tmp)
55 data[cnt++] = makePoint(*tmp);
56 std::sort(data.begin(), data.end(), Point2DDouble::Comparer(
Direction::LEFT));
65 virtual double operator[](
double x)
const override;
67 using Cartesian2DFunction::operator[];
70 const std::vector<crn::Point2DDouble>&
GetData() const noexcept {
return data; }
83 template<
typename T,
typename Y> Point2DDouble makePoint(
const std::pair<T, Y> &p)
86 std::vector<crn::Point2DDouble> data;
91 template<> struct
IsSerializable<LinearInterpolation> : public std::true_type {};
#define CRN_SERIALIZATION_CONSTRUCTOR(classname)
Defines a default constructor from xml element.
xml::Element Serialize(xml::Element &parent) const
const std::vector< crn::Point2DDouble > & GetData() const noexcept
Access to the sorted control point.
void Deserialize(xml::Element &el)
LinearInterpolation(Iter beg, Iter en)
Constructor from a list of points.
virtual ~LinearInterpolation() override
virtual double operator[](double x) const override
Gets ordinate at x.
LinearInterpolation & operator=(const LinearInterpolation &)=default
Base class for 2D functions.
#define CRN_DECLARE_CLASS_CONSTRUCTOR(classname)
Declares a class constructor.
CRN_ALIAS_SMART_PTR(ImageBW)