26 #ifndef MLN_CORE_DPOINT_HH
27 # define MLN_CORE_DPOINT_HH
33 # include <mln/core/def/coord.hh>
34 # include <mln/core/concept/gdpoint.hh>
35 # include <mln/core/internal/coord_impl.hh>
36 # include <mln/algebra/vec.hh>
37 # include <mln/metal/converts_to.hh>
44 template <
typename G,
typename C>
struct point;
56 template <
typename G,
typename C>
58 public internal::mutable_coord_impl_< G::dim, C, dpoint<G,C> >
63 enum {
dim = G::dim };
94 template <
typename C2>
101 dpoint(C sli, C row, C col);
113 template <
typename F>
120 template <
typename Q>
131 # ifndef MLN_INCLUDE_ONLY
133 template <
typename G,
typename C>
141 template <
typename G,
typename C>
149 template <
typename G,
typename C>
155 template <
typename G,
typename C>
156 template <
typename C2>
166 for (
unsigned i = dim - 2; i < dim; ++i)
167 coord_[i] = static_cast<C>(v[j++]);
168 for (
unsigned i = 2; i < dim; ++i, ++j)
169 coord_[i-j] = static_cast<C>(v[j]);
173 template <
typename G,
typename C>
177 metal::bool_<(dim == 1)>::check();
181 template <
typename G,
typename C>
185 metal::bool_<(dim == 2)>::check();
190 template <
typename G,
typename C>
194 metal::bool_<(dim == 3)>::check();
200 template <
typename G,
typename C>
207 template <
typename G,
typename C>
216 template <
typename G,
typename C>
220 metal::bool_<(dim == 1)>::check();
224 template <
typename G,
typename C>
229 metal::bool_<(dim == 1)>::check();
234 template <
typename G,
typename C>
235 template <
typename F>
239 mlc_converts_to(mln_result(F), C)::check();
240 const F& f =
exact(f_);
241 for (
unsigned i = 0; i < dim; ++i)
242 coord_[i] = static_cast<C>(f(i));
245 template <
typename G,
typename C>
249 for (
unsigned i = 0; i < dim; ++i)
253 template <
typename G,
typename C>
254 template <
typename Q>
261 template <
typename G,
typename C>
263 typename dpoint<G,C>::vec
266 algebra::vec<G::dim, float> tmp;
274 for (
unsigned i = dim - 2; i < dim; ++i)
275 tmp[j++] = coord_[i];
276 for (
unsigned i = 2; i < dim; ++i, ++j)
277 tmp[j] = coord_[i-j];
283 # endif // ! MLN_INCLUDE_ONLY
288 #endif // ! MLN_CORE_DPOINT_HH