26 #ifndef MLN_CORE_ALIAS_NEIGHB2D_HH
27 # define MLN_CORE_ALIAS_NEIGHB2D_HH
37 # include <mln/core/alias/window2d.hh>
38 # include <mln/core/neighb.hh>
39 # include <mln/convert/from_to.hh>
40 # include <mln/make/double_neighb2d.hh>
41 # include <mln/fun/p2b/chess.hh>
123 neighb< win::multiple<window2d, mln::fun::p2b::chess> > c6_2d();
133 template <
unsigned S>
134 void from_to_(
const bool (&values)[S],
neighb2d& nbh);
136 template <
unsigned R,
unsigned C>
137 void from_to_(
bool const (&values)[R][C],
neighb2d& nbh);
145 # ifndef MLN_INCLUDE_ONLY
153 static const bool vals[] = { 0, 1, 0,
156 convert::from_to(vals, it);
167 static const bool vals[] = { 1, 1, 1,
170 convert::from_to(vals, it);
181 static const bool vals[] = { 0, 0, 0,
184 convert::from_to(vals, it);
195 static const bool vals[] = { 0, 1, 0,
198 convert::from_to(vals, it);
205 neighb< win::multiple<window2d, mln::fun::p2b::chess> >
208 bool vert[] = { 1, 1, 0,
212 bool hori[] = { 0, 1, 1,
216 return make::double_neighb2d(fun::p2b::chess(),
228 template <
unsigned S>
230 from_to_(
const bool (&values)[S],
neighb2d& nbh)
232 enum { h = mlc_sqrt_int(S) / 2 };
233 mlc_bool((2 * h + 1) * (2 * h + 1) == S)::check();
235 convert::from_to(values, win);
236 mln_postcondition(win.is_neighbable_());
239 template <
unsigned R,
unsigned C>
241 from_to_(
bool const (&values)[R][C],
neighb2d& nbh)
243 mlc_bool(R % 2 == 1)::check();
244 mlc_bool(C % 2 == 1)::check();
246 convert::from_to(values, win);
247 mln_postcondition(win.is_neighbable_());
254 # endif // ! MLN_INCLUDE_ONLY
260 #endif // ! MLN_CORE_ALIAS_NEIGHB2D_HH