* milena/mln/world/k1/display_enlarged.hh,
* milena/mln/world/k1/immerse.hh,
* milena/mln/world/k1/internal/face_dim.hh,
* milena/mln/world/k1/is_0_face.hh,
* milena/mln/world/k1/is_0_or_1_face.hh,
* milena/mln/world/k1/is_1_face.hh,
* milena/mln/world/k1/is_1_face_horizontal.hh,
* milena/mln/world/k1/is_1_face_vertical.hh,
* milena/mln/world/k1/is_2_face.hh,
* milena/mln/world/k1/is_primary_face.hh,
* milena/mln/world/k1/un_immerse.hh: New.
* milena/tests/world/k1/Makefile.am,
* milena/tests/world/k1/display_enlarged.cc,
* milena/tests/world/k1/immerse.cc,
* milena/tests/world/k1/is_0_face.cc,
* milena/tests/world/k1/is_0_or_1_face.cc,
* milena/tests/world/k1/is_1_face.cc,
* milena/tests/world/k1/is_1_face_horizontal.cc,
* milena/tests/world/k1/is_1_face_vertical.cc,
* milena/tests/world/k1/is_2_face.cc,
* milena/tests/world/k1/is_primary_face.cc: New tests.
* milena/tests/world/Makefile.am: Add Subdir.
* milena/mln/make/image.hh: Add overloads.
---
milena/ChangeLog | 31 +++++
milena/mln/make/image.hh | 59 ++++++++--
milena/mln/world/k1/display_enlarged.hh | 154 +++++++++++++++++++++++++
milena/mln/world/k1/immerse.hh | 122 +++++++++++++++++++
milena/mln/world/k1/internal/face_dim.hh | 75 ++++++++++++
milena/mln/world/k1/is_0_face.hh | 70 +++++++++++
milena/mln/world/k1/is_0_or_1_face.hh | 71 +++++++++++
milena/mln/world/k1/is_1_face.hh | 70 +++++++++++
milena/mln/world/k1/is_1_face_horizontal.hh | 70 +++++++++++
milena/mln/world/k1/is_1_face_vertical.hh | 70 +++++++++++
milena/mln/world/k1/is_2_face.hh | 70 +++++++++++
milena/mln/world/k1/is_primary_face.hh | 70 +++++++++++
milena/mln/world/k1/un_immerse.hh | 21 ++++
milena/tests/world/Makefile.am | 6 +-
milena/tests/world/k1/Makefile.am | 42 +++++++
milena/tests/world/k1/display_enlarged.cc | 98 ++++++++++++++++
milena/tests/world/k1/immerse.cc | 53 +++++++++
milena/tests/world/k1/is_0_face.cc | 40 +++++++
milena/tests/world/k1/is_0_or_1_face.cc | 40 +++++++
milena/tests/world/k1/is_1_face.cc | 39 ++++++
milena/tests/world/k1/is_1_face_horizontal.cc | 41 +++++++
milena/tests/world/k1/is_1_face_vertical.cc | 41 +++++++
milena/tests/world/k1/is_2_face.cc | 39 ++++++
milena/tests/world/k1/is_primary_face.cc | 39 ++++++
24 files changed, 1418 insertions(+), 13 deletions(-)
create mode 100644 milena/mln/world/k1/display_enlarged.hh
create mode 100644 milena/mln/world/k1/immerse.hh
create mode 100644 milena/mln/world/k1/internal/face_dim.hh
create mode 100644 milena/mln/world/k1/is_0_face.hh
create mode 100644 milena/mln/world/k1/is_0_or_1_face.hh
create mode 100644 milena/mln/world/k1/is_1_face.hh
create mode 100644 milena/mln/world/k1/is_1_face_horizontal.hh
create mode 100644 milena/mln/world/k1/is_1_face_vertical.hh
create mode 100644 milena/mln/world/k1/is_2_face.hh
create mode 100644 milena/mln/world/k1/is_primary_face.hh
create mode 100644 milena/mln/world/k1/un_immerse.hh
create mode 100644 milena/tests/world/k1/Makefile.am
create mode 100644 milena/tests/world/k1/display_enlarged.cc
create mode 100644 milena/tests/world/k1/immerse.cc
create mode 100644 milena/tests/world/k1/is_0_face.cc
create mode 100644 milena/tests/world/k1/is_0_or_1_face.cc
create mode 100644 milena/tests/world/k1/is_1_face.cc
create mode 100644 milena/tests/world/k1/is_1_face_horizontal.cc
create mode 100644 milena/tests/world/k1/is_1_face_vertical.cc
create mode 100644 milena/tests/world/k1/is_2_face.cc
create mode 100644 milena/tests/world/k1/is_primary_face.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fdc8bd7..3db410c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,34 @@
+2012-09-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Initial commit of tools to work in K1.
+
+ * milena/mln/world/k1/display_enlarged.hh,
+ * milena/mln/world/k1/immerse.hh,
+ * milena/mln/world/k1/internal/face_dim.hh,
+ * milena/mln/world/k1/is_0_face.hh,
+ * milena/mln/world/k1/is_0_or_1_face.hh,
+ * milena/mln/world/k1/is_1_face.hh,
+ * milena/mln/world/k1/is_1_face_horizontal.hh,
+ * milena/mln/world/k1/is_1_face_vertical.hh,
+ * milena/mln/world/k1/is_2_face.hh,
+ * milena/mln/world/k1/is_primary_face.hh,
+ * milena/mln/world/k1/un_immerse.hh: New.
+
+ * milena/tests/world/k1/Makefile.am,
+ * milena/tests/world/k1/display_enlarged.cc,
+ * milena/tests/world/k1/immerse.cc,
+ * milena/tests/world/k1/is_0_face.cc,
+ * milena/tests/world/k1/is_0_or_1_face.cc,
+ * milena/tests/world/k1/is_1_face.cc,
+ * milena/tests/world/k1/is_1_face_horizontal.cc,
+ * milena/tests/world/k1/is_1_face_vertical.cc,
+ * milena/tests/world/k1/is_2_face.cc,
+ * milena/tests/world/k1/is_primary_face.cc: New tests.
+
+ * milena/tests/world/Makefile.am: Add Subdir.
+
+ * milena/mln/make/image.hh: Add overloads.
+
2012-09-28 Guillaume Lazzara <z(a)lrde.epita.fr>
* mln/debug/draw_graph.hh: Add a new overload and fix comments.
diff --git a/milena/mln/make/image.hh b/milena/mln/make/image.hh
index ef80c57..5208293 100644
--- a/milena/mln/make/image.hh
+++ b/milena/mln/make/image.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
@@ -37,6 +37,9 @@
# include <mln/core/image/image1d.hh>
# include <mln/core/image/image2d.hh>
# include <mln/core/image/image3d.hh>
+# include <mln/make/box1d.hh>
+# include <mln/make/box2d.hh>
+# include <mln/make/box3d.hh>
# include <mln/opt/at.hh>
@@ -54,8 +57,11 @@ namespace mln
/// \return A 1D image.
///
template <typename V, unsigned L>
- mln::image1d<V> image(V (&values)[L]);
+ mln::image1d<V> image(V (&values)[L], const point1d& pmin);
+ /// \overload pmin = (0)
+ template <typename V, unsigned L>
+ mln::image1d<V> image(V (&values)[L]);
/// Create an image2d from an 2D array of values.
///
@@ -64,6 +70,10 @@ namespace mln
/// \return A 2D image.
///
template <typename V, unsigned R, unsigned C>
+ mln::image2d<V> image(V (&values)[R][C], const point2d& pmin);
+
+ /// \overload pmin = (0,0)
+ template <typename V, unsigned R, unsigned C>
mln::image2d<V> image(V (&values)[R][C]);
@@ -74,6 +84,10 @@ namespace mln
/// \return A 3D image.
///
template <typename V, unsigned S, unsigned R, unsigned C>
+ mln::image3d<V> image(V (&values)[S][R][C], const point3d& pmin);
+
+ /// \overload pmin = (0,0,0)
+ template <typename V, unsigned S, unsigned R, unsigned C>
mln::image3d<V> image(V (&values)[S][R][C]);
@@ -82,37 +96,53 @@ namespace mln
template <typename V, unsigned L>
mln::image1d<V>
- image(V (&values)[L])
+ image(V (&values)[L], const point1d& pmin)
{
mlc_bool(L != 0)::check();
- mln::image1d<V> tmp(L);
+ mln::image1d<V> tmp(make::box1d(pmin.ind(), pmin.ind() + L - 1));
const def::coord ninds = static_cast<def::coord>(L);
for (def::coord ind = 0; ind < ninds; ++ind)
- tmp(point1d(ind)) = values[ind];
+ tmp(point1d(pmin.ind() + ind)) = values[ind];
return tmp;
}
+ template <typename V, unsigned L>
+ mln::image1d<V>
+ image(V (&values)[L])
+ {
+ return image(values, point1d(0));
+ }
+
template <typename V, unsigned R, unsigned C>
mln::image2d<V>
- image(V (&values)[R][C])
+ image(V (&values)[R][C], const point2d& pmin)
{
mlc_bool(R != 0 && C != 0)::check();
- mln::image2d<V> tmp(R, C);
+ mln::image2d<V> tmp(make::box2d(pmin.row(), pmin.col(),
+ pmin.row() + R - 1, pmin.col() + C - 1));
const def::coord
nrows = static_cast<def::coord>(R),
ncols = static_cast<def::coord>(C);
for (def::coord row = 0; row < nrows; ++row)
for (def::coord col = 0; col < ncols; ++col)
- opt::at(tmp, row, col) = values[row][col];
+ opt::at(tmp, pmin.row() + row, pmin.col() + col) = values[row][col];
return tmp;
}
+ template <typename V, unsigned R, unsigned C>
+ mln::image2d<V>
+ image(V (&values)[R][C])
+ {
+ return image(values, point2d(0, 0));
+ }
+
template <typename V, unsigned S, unsigned R, unsigned C>
mln::image3d<V>
- image(V (&values)[S][R][C])
+ image(V (&values)[S][R][C], const point3d& pmin)
{
mlc_bool(S != 0 && R != 0 && C != 0)::check();
- mln::image3d<V> tmp(S, R, C);
+ mln::image3d<V> tmp(make::box3d(pmin.sli(), pmin.row(), pmin.col(),
+ pmin.sli() + S - 1, pmin.row() + R - 1, pmin.col() + C - 1));
const def::coord
nslis = static_cast<def::coord>(S),
nrows = static_cast<def::coord>(R),
@@ -120,10 +150,17 @@ namespace mln
for (def::coord sli = 0; sli < nslis; ++sli)
for (def::coord row = 0; row < nrows; ++row)
for (def::coord col = 0; col < ncols; ++col)
- opt::at(tmp, sli, row, col) = values[sli][row][col];
+ opt::at(tmp, pmin.sli() + sli, pmin.row() + row, pmin.col() + col) =
values[sli][row][col];
return tmp;
}
+ template <typename V, unsigned S, unsigned R, unsigned C>
+ mln::image3d<V>
+ image(V (&values)[S][R][C])
+ {
+ return image(values, point3d(0, 0, 0));
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::make
diff --git a/milena/mln/world/k1/display_enlarged.hh
b/milena/mln/world/k1/display_enlarged.hh
new file mode 100644
index 0000000..f3610c1
--- /dev/null
+++ b/milena/mln/world/k1/display_enlarged.hh
@@ -0,0 +1,154 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Create a new image where 2 faces are enlarged for better
+/// visualization.
+
+#ifndef MLN_WORLD_K1_DISPLAY_ENLARGED_HH
+# define MLN_WORLD_K1_DISPLAY_ENLARGED_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_0_face.hh>
+# include <mln/world/k1/is_1_face_vertical.hh>
+# include <mln/world/k1/is_1_face_horizontal.hh>
+# include <mln/world/k1/is_2_face.hh>
+# include <mln/geom/all.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Create a new image where 2 faces are enlarged for better
+ visualization.
+
+ Exemple with zoom = 3:
+ \verbatim
+ . - . - . . - - - . - - - .
+ | o | o | | o o o | o o o |
+ . - . - . -> | o o o | o o o |
+ | o | o | | o o o | o o o |
+ . - . - . . - - - . - - - .
+ | o o o | o o o |
+ | o o o | o o o |
+ | o o o | o o o |
+ . - - - . - - - .
+ \endverbatim
+
+ \param[in] ima_k1 A 2D image immersed in K1.
+ \param[in] zoom The number of times 2 faces must be duplicated
+ (must be odd).
+
+
+ This function is useful for debugging to distinguish 2 faces
+ from others.
+
+ */
+ template <typename I>
+ mln_concrete(I)
+ display_enlarged(const Image<I>& ima_k1, unsigned zoom);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I)
+ display_enlarged(const Image<I>& ima_k1_, unsigned zoom_)
+ {
+ trace::entering("mln::world::k1::display_enlarged");
+
+ mln_precondition(exact(ima_k1_).is_valid());
+ mln_assertion(zoom_ % 2);
+
+ const I& ima_k1 = exact(ima_k1_);
+ int shift = zoom_ - 1;
+
+ // No zoom: return original image.
+ if (zoom_ == 1)
+ return ima_k1;
+
+ mln_concrete(I) output(make::box2d(ima_k1.domain().pmin().row() * shift,
+ ima_k1.domain().pmin().col() * shift,
+ ima_k1.domain().pmax().row() * shift,
+ ima_k1.domain().pmax().col() * shift));
+
+ const mln::def::coord
+ min_row = geom::min_row(ima_k1),
+ max_row = geom::max_row(ima_k1),
+ min_col = geom::min_col(ima_k1),
+ max_col = geom::max_col(ima_k1);
+
+ for (mln::def::coord row = min_row; row <= max_row; ++row)
+ {
+ for (mln::def::coord col = min_col; col <= max_col; ++col)
+ {
+ if (is_0_face(point2d(row, col)))
+ {
+ output.at_(row * shift, col * shift) = ima_k1.at_(row, col);
+ }
+ else if (is_1_face_vertical(point2d(row, col)))
+ {
+ for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
+ output.at_(row * shift + j, col * shift) = ima_k1.at_(row, col);
+ }
+ else if (is_1_face_horizontal(point2d(row, col)))
+ {
+ for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
+ output.at_(row * shift, col * shift + j) = ima_k1.at_(row, col);
+ }
+ else if (is_2_face(point2d(row, col)))
+ {
+ for (mln::def::coord i = -(shift - 1); i < (shift + 3); ++i)
+ for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
+ output.at_(row * shift + i, col * shift + j) = ima_k1.at_(row, col);
+ }
+ }
+ }
+
+ trace::exiting("mln::world::k1::display_enlarged");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_DISPLAY_ENLARGED_HH
+
diff --git a/milena/mln/world/k1/immerse.hh b/milena/mln/world/k1/immerse.hh
new file mode 100644
index 0000000..928012b
--- /dev/null
+++ b/milena/mln/world/k1/immerse.hh
@@ -0,0 +1,122 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Immerse a 2D image into K1.
+
+#ifndef MLN_WORLD_K1_IMMERSE_HH
+# define MLN_WORLD_K1_IMMERSE_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Immerse a 2D image into K1.
+
+ \verbatim
+
+ -1 0 1 2 3
+ 0 1 -1 . - . - .
+ 0 o o 0 | o | o |
+ 1 o o -> 1 . - . - .
+ 2 | o | o |
+ 3 . - . - .
+
+ \endverbatim
+
+ */
+ template <typename I>
+ mln_concrete(I) immerse(const Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ /// \brief Return the equivalent domain in K1 from a domain in
+ /// K0.
+ template <typename B>
+ inline
+ B domain_from_K0(const Box<B>& b_)
+ {
+ mln_precondition(exact(b_).is_valid());
+ const B& b = exact(b_);
+
+ mln_deduce(B, site, delta) one;
+ one.set_all(1);
+ return B(2 * b.pmin() - one, 2 * b.pmax() + one);
+ }
+
+ inline
+ point2d
+ immerse_point(const point2d& p)
+ {
+ point2d tmp(2 * p.row(), 2 * p.col());
+ return tmp;
+ }
+
+ } // end of namespace mln::world::k1::internal
+
+
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I) immerse(const Image<I>& ima_)
+ {
+ trace::entering("mln::world::k1::immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_concrete(I) output(internal::domain_from_K0(ima.domain()));
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ output(internal::immerse_point(p)) = ima(p);
+
+ trace::exiting("mln::world::k1::immerse");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IMMERSE_HH
diff --git a/milena/mln/world/k1/internal/face_dim.hh
b/milena/mln/world/k1/internal/face_dim.hh
new file mode 100644
index 0000000..b933e86
--- /dev/null
+++ b/milena/mln/world/k1/internal/face_dim.hh
@@ -0,0 +1,75 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Returns the dimension of site in K1.
+
+#ifndef MLN_WORLD_K1_FACE_DIM_HH
+# define MLN_WORLD_K1_FACE_DIM_HH
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ namespace internal
+ {
+
+ /// \brief Returns the dimension of site in K1.
+ unsigned face_dim(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ unsigned face_dim(const point2d& p)
+ {
+ return (p[0] % 2 == 0) + (p[1] % 2 == 0);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::work::k1::internal
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FACE_DIM_HH
+
+
diff --git a/milena/mln/world/k1/is_0_face.hh b/milena/mln/world/k1/is_0_face.hh
new file mode 100644
index 0000000..c9d9b0e
--- /dev/null
+++ b/milena/mln/world/k1/is_0_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a 0 face.
+
+#ifndef MLN_WORLD_K1_IS_0_FACE_HH
+# define MLN_WORLD_K1_IS_0_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 0 face
+ bool is_0_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_0_face(const point2d& p)
+ {
+ return internal::face_dim(p) == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_0_FACE_HH
diff --git a/milena/mln/world/k1/is_0_or_1_face.hh
b/milena/mln/world/k1/is_0_or_1_face.hh
new file mode 100644
index 0000000..6f3f47a
--- /dev/null
+++ b/milena/mln/world/k1/is_0_or_1_face.hh
@@ -0,0 +1,71 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_0_OR_1_FACE_HH
+# define MLN_WORLD_K1_IS_0_OR_1_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_0_or_1_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_0_or_1_face(const point2d& p)
+ {
+ unsigned dim = internal::face_dim(p);
+ return dim == 0 || dim == 1;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_0_OR_1_FACE_HH
diff --git a/milena/mln/world/k1/is_1_face.hh b/milena/mln/world/k1/is_1_face.hh
new file mode 100644
index 0000000..aafa442
--- /dev/null
+++ b/milena/mln/world/k1/is_1_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_1_FACE_HH
+# define MLN_WORLD_K1_IS_1_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face(const point2d& p)
+ {
+ return internal::face_dim(p) == 1;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_1_FACE_HH
diff --git a/milena/mln/world/k1/is_1_face_horizontal.hh
b/milena/mln/world/k1/is_1_face_horizontal.hh
new file mode 100644
index 0000000..ff90b0c
--- /dev/null
+++ b/milena/mln/world/k1/is_1_face_horizontal.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_1_FACE_HORIZONTAL_HH
+# define MLN_WORLD_K1_IS_1_FACE_HORIZONTAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_1_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face_horizontal(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face_horizontal(const point2d& p)
+ {
+ return is_1_face(p) && p[1] % 2 == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_1_FACE_HORIZONTAL_HH
diff --git a/milena/mln/world/k1/is_1_face_vertical.hh
b/milena/mln/world/k1/is_1_face_vertical.hh
new file mode 100644
index 0000000..f10067d
--- /dev/null
+++ b/milena/mln/world/k1/is_1_face_vertical.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_1_FACE_VERTICAL_HH
+# define MLN_WORLD_K1_IS_1_FACE_VERTICAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_1_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face_vertical(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face_vertical(const point2d& p)
+ {
+ return is_1_face(p) && p[0] % 2 == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_1_FACE_VERTICAL_HH
diff --git a/milena/mln/world/k1/is_2_face.hh b/milena/mln/world/k1/is_2_face.hh
new file mode 100644
index 0000000..b3c8c98
--- /dev/null
+++ b/milena/mln/world/k1/is_2_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a 2 face.
+
+#ifndef MLN_WORLD_K1_IS_2_FACE_HH
+# define MLN_WORLD_K1_IS_2_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 2 face
+ bool is_2_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_2_face(const point2d& p)
+ {
+ return internal::face_dim(p) == 2;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_2_FACE_HH
diff --git a/milena/mln/world/k1/is_primary_face.hh
b/milena/mln/world/k1/is_primary_face.hh
new file mode 100644
index 0000000..572d25c
--- /dev/null
+++ b/milena/mln/world/k1/is_primary_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+///
+/// \brief Check if site is a primary face.
+
+#ifndef MLN_WORLD_K1_IS_PRIMARY_FACE_HH
+# define MLN_WORLD_K1_IS_PRIMARY_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a primary face
+ bool is_primary_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_primary_face(const point2d& p)
+ {
+ return is_2_face(p);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_PRIMARY_FACE_HH
diff --git a/milena/mln/world/k1/un_immerse.hh b/milena/mln/world/k1/un_immerse.hh
new file mode 100644
index 0000000..7978be9
--- /dev/null
+++ b/milena/mln/world/k1/un_immerse.hh
@@ -0,0 +1,21 @@
+
+
+ inline
+ point2d
+ un_immerse(const point2d& p)
+ {
+ point2d tmp(p.row() / 2, p.col() / 2);
+ return tmp;
+ }
+
+ struct is_2_face_t : Function_v2b< is_2_face_t >
+ {
+ typedef bool result;
+ inline bool operator()(const point2d& p) const { return FIXME; } // p.row() % 2
&& p.col() % 2
+ } is_2_face;
+
+ struct is_not_2_face_t : Function_v2b< is_not_2_face_t >
+ {
+ typedef bool result;
+ inline bool operator()(const point2d& p) const { return FIXME; } // ! (p.row() %
2 && p.col() % 2)
+ } is_not_2_face;
diff --git a/milena/tests/world/Makefile.am b/milena/tests/world/Makefile.am
index 3bae089..494271c 100644
--- a/milena/tests/world/Makefile.am
+++ b/milena/tests/world/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2009, 2012 EPITA Research and Development Laboratory
+# (LRDE).
#
# This file is part of Olena.
#
@@ -18,4 +19,5 @@ include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
binary_2d \
- inter_pixel
+ inter_pixel \
+ k1
diff --git a/milena/tests/world/k1/Makefile.am b/milena/tests/world/k1/Makefile.am
new file mode 100644
index 0000000..daa0d94
--- /dev/null
+++ b/milena/tests/world/k1/Makefile.am
@@ -0,0 +1,42 @@
+# Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE).
+#
+# This file is part of Olena.
+#
+# Olena is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, version 2 of the License.
+#
+# Olena is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ display_enlarged \
+ immerse \
+ immerse_and_duplicate_2_to_1_faces \
+ is_0_face \
+ is_0_or_1_face \
+ is_1_face \
+ is_1_face_vertical \
+ is_1_face_horizontal \
+ is_2_face \
+ is_primary_face
+
+display_enlarged_SOURCES = display_enlarged.cc
+immerse_SOURCES = immerse.cc
+immerse_and_duplicate_2_to_1_faces_SOURCES = immerse_and_duplicate_2_to_1_faces.cc
+is_0_face_SOURCES = is_0_face.cc
+is_0_or_1_face_SOURCES = is_0_or_1_face.cc
+is_1_face_SOURCES = is_1_face.cc
+is_1_face_vertical_SOURCES = is_1_face_vertical.cc
+is_1_face_horizontal_SOURCES = is_1_face_horizontal.cc
+is_2_face_SOURCES = is_2_face.cc
+is_primary_face_SOURCES = is_primary_face.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/world/k1/display_enlarged.cc
b/milena/tests/world/k1/display_enlarged.cc
new file mode 100644
index 0000000..3365fbe
--- /dev/null
+++ b/milena/tests/world/k1/display_enlarged.cc
@@ -0,0 +1,98 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/display_enlarged.hh>
+#include <mln/world/k1/immerse.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int vals[5][5] = {
+ {1, 2, 1, 2, 1 },
+ {2, 3, 2, 3, 2 },
+ {1, 2, 1, 2, 1 },
+ {2, 3, 2, 3, 2 },
+ {1, 2, 1, 2, 1 }
+ };
+
+ int vals3[9][9] = {
+ {1, 2, 2, 2, 1, 2, 2, 2, 1},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {1, 2, 2, 2, 1, 2, 2, 2, 1},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {1, 2, 2, 2, 1, 2, 2, 2, 1}
+ };
+
+ int vals5[17][17] = {
+ {1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1}
+ };
+
+ image2d<int> ima = make::image(vals, point2d(-1, -1));
+
+ {
+ image2d<int> enlarged = world::k1::display_enlarged(ima, 1);
+ mln_assertion(ima == enlarged);
+ }
+
+ {
+ image2d<int> ref3 = make::image(vals3, point2d(-2, -2));
+ image2d<int> enlarged = world::k1::display_enlarged(ima, 3);
+ mln_assertion(ref3 == enlarged);
+ }
+
+ {
+ image2d<int> ref5 = make::image(vals5, point2d(-4, -4));
+ image2d<int> enlarged = world::k1::display_enlarged(ima, 5);
+ mln_assertion(ref5 == enlarged);
+ }
+}
diff --git a/milena/tests/world/k1/immerse.cc b/milena/tests/world/k1/immerse.cc
new file mode 100644
index 0000000..8a17056
--- /dev/null
+++ b/milena/tests/world/k1/immerse.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/immerse.hh>
+#include <mln/make/box2d.hh>
+
+int main()
+{
+ using namespace mln;
+
+
+ int vals[2][2] = {
+ {1, 2 },
+ {3, 4 }
+ };
+ image2d<int> ima = make::image(vals);
+
+ image2d<int> immersed = world::k1::immerse(ima);
+
+ // Check domain
+ mln_assertion(immersed.domain() == make::box2d(-1, -1, 3, 3));
+
+ // Check values
+ mln_assertion(immersed(point2d(0, 0)) == 1);
+ mln_assertion(immersed(point2d(2, 0)) == 3);
+ mln_assertion(immersed(point2d(0, 2)) == 2);
+ mln_assertion(immersed(point2d(2, 2)) == 4);
+}
diff --git a/milena/tests/world/k1/is_0_face.cc b/milena/tests/world/k1/is_0_face.cc
new file mode 100644
index 0000000..6033af6
--- /dev/null
+++ b/milena/tests/world/k1/is_0_face.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_0_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(world::k1::is_0_face(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_0_face(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_0_face(point2d(0, -1)));
+ mln_assertion(!world::k1::is_0_face(point2d(0, 0)));
+ mln_assertion(world::k1::is_0_face(point2d(1, 1)));
+}
diff --git a/milena/tests/world/k1/is_0_or_1_face.cc
b/milena/tests/world/k1/is_0_or_1_face.cc
new file mode 100644
index 0000000..f977566
--- /dev/null
+++ b/milena/tests/world/k1/is_0_or_1_face.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_0_or_1_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(world::k1::is_0_or_1_face(point2d(-1, -1)));
+ mln_assertion(world::k1::is_0_or_1_face(point2d(-1, 0)));
+ mln_assertion(world::k1::is_0_or_1_face(point2d(0, -1)));
+ mln_assertion(!world::k1::is_0_or_1_face(point2d(0, 0)));
+ mln_assertion(world::k1::is_0_or_1_face(point2d(1, 1)));
+}
diff --git a/milena/tests/world/k1/is_1_face.cc b/milena/tests/world/k1/is_1_face.cc
new file mode 100644
index 0000000..bd50f84
--- /dev/null
+++ b/milena/tests/world/k1/is_1_face.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_1_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_1_face(point2d(-1, -1)));
+ mln_assertion(world::k1::is_1_face(point2d(-1, 0)));
+ mln_assertion(world::k1::is_1_face(point2d(0, -1)));
+ mln_assertion(!world::k1::is_1_face(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_1_face_horizontal.cc
b/milena/tests/world/k1/is_1_face_horizontal.cc
new file mode 100644
index 0000000..4f6e406
--- /dev/null
+++ b/milena/tests/world/k1/is_1_face_horizontal.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_1_face_horizontal.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(-1, -1)));
+ mln_assertion(world::k1::is_1_face_horizontal(point2d(-1, 0)));
+ mln_assertion(world::k1::is_1_face_horizontal(point2d(1, 0)));
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(0, -1)));
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(0, 1)));
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_1_face_vertical.cc
b/milena/tests/world/k1/is_1_face_vertical.cc
new file mode 100644
index 0000000..e204f97
--- /dev/null
+++ b/milena/tests/world/k1/is_1_face_vertical.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_1_face_vertical.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(1, 0)));
+ mln_assertion(world::k1::is_1_face_vertical(point2d(0, -1)));
+ mln_assertion(world::k1::is_1_face_vertical(point2d(0, 1)));
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_2_face.cc b/milena/tests/world/k1/is_2_face.cc
new file mode 100644
index 0000000..912567d
--- /dev/null
+++ b/milena/tests/world/k1/is_2_face.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_2_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_2_face(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_2_face(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_2_face(point2d(0, -1)));
+ mln_assertion(world::k1::is_2_face(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_primary_face.cc
b/milena/tests/world/k1/is_primary_face.cc
new file mode 100644
index 0000000..32eb871
--- /dev/null
+++ b/milena/tests/world/k1/is_primary_face.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_primary_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_primary_face(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_primary_face(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_primary_face(point2d(0, -1)));
+ mln_assertion(world::k1::is_primary_face(point2d(0, 0)));
+}
--
1.7.2.5