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/fun/i2v/all.hh>
37 # include <mln/algebra/vec.hh>
38 # include <mln/metal/converts_to.hh>
45 template <
typename G,
typename C>
struct point;
57 template <
typename G,
typename C>
59 public internal::mutable_coord_impl_< G::dim, C, dpoint<G,C> >
64 enum {
dim = G::dim };
79 typedef algebra::vec<G::dim, C>
vec;
95 template <
typename C2>
96 dpoint(
const algebra::vec<dim,C2>& v);
102 dpoint(C sli, C row, C col);
114 template <
typename F>
121 template <
typename Q>
122 operator mln::algebra::vec<dpoint<G,C>::dim, Q>()
const;
128 mln::algebra::vec<G::dim, C> coord_;
132 # ifndef MLN_INCLUDE_ONLY
134 template <
typename G,
typename C>
142 template <
typename G,
typename C>
150 template <
typename G,
typename C>
156 template <
typename G,
typename C>
157 template <
typename C2>
167 for (
unsigned i = dim - 2; i < dim; ++i)
168 coord_[i] = static_cast<C>(v[j++]);
169 for (
unsigned i = 2; i < dim; ++i, ++j)
170 coord_[i-j] = static_cast<C>(v[j]);
174 template <
typename G,
typename C>
178 metal::bool_<(dim == 1)>::check();
182 template <
typename G,
typename C>
186 metal::bool_<(dim == 2)>::check();
191 template <
typename G,
typename C>
195 metal::bool_<(dim == 3)>::check();
201 template <
typename G,
typename C>
208 template <
typename G,
typename C>
217 template <
typename G,
typename C>
221 metal::bool_<(dim == 1)>::check();
225 template <
typename G,
typename C>
228 dpoint<G,C>::operator=(
const literal::one_t&)
230 metal::bool_<(dim == 1)>::check();
235 template <
typename G,
typename C>
236 template <
typename F>
240 mlc_converts_to(mln_result(F), C)::check();
241 const F& f = exact(f_);
242 for (
unsigned i = 0; i < dim; ++i)
243 coord_[i] = static_cast<C>(f(i));
246 template <
typename G,
typename C>
250 for (
unsigned i = 0; i < dim; ++i)
254 template <
typename G,
typename C>
255 template <
typename Q>
262 template <
typename G,
typename C>
267 algebra::vec<G::dim, float> tmp;
275 for (
unsigned i = dim - 2; i < dim; ++i)
276 tmp[j++] = coord_[i];
277 for (
unsigned i = 2; i < dim; ++i, ++j)
278 tmp[j] = coord_[i-j];
284 # endif // ! MLN_INCLUDE_ONLY
289 #endif // ! MLN_CORE_DPOINT_HH