26 #ifndef MLN_FUN_X2V_LINEAR_HH
27 # define MLN_FUN_X2V_LINEAR_HH
34 # include <mln/core/image/image1d.hh>
35 # include <mln/core/concept/function.hh>
36 # include <mln/fun/internal/selector.hh>
37 # include <mln/convert/to.hh>
38 # include <mln/algebra/vec.hh>
52 template <
typename I >
56 mln_value(I), linear<I> >
::ret
67 operator()(const algebra::vec<1,C>& v) const;
74 # ifndef MLN_INCLUDE_ONLY
79 mlc_bool(I::psite::dim == 1)::check();
85 linear<I>::operator()(const algebra::vec<1,C>& v)
const
87 typedef mln_sum(mln_value(I)) vsum;
93 double xa = mln_point(I)::
coord(v[0]);
101 double xb = mln_point(I)::
coord(v[0] + 1);
105 return
convert::to<mln_value(I)>
106 (ya + (x - xa) * (yb - ya) / (xb - xa));
109 # endif // ! MLN_INCLUDE_ONLY
118 #endif // ! MLN_FUN_X2V_LINEAR_HH