* mln/world/k1/immerse_with.hh,
* mln/world/k2/fill_non_primary_from_primary_2_faces.hh,
* mln/world/k2/is_non_primary_2_face.hh,
* mln/world/k2/is_non_primary_2_face_center.hh,
* mln/world/k2/is_non_primary_2_face_horizontal.hh,
* mln/world/k2/is_non_primary_2_face_vertical.hh,
* mln/world/k2/is_primary_2_face.hh,
* mln/world/k2/un_immerse.hh,
* mln/world/kn/fill_0_1_faces_internal_border.hh,
* mln/world/kn/fill_0_from_1_faces.hh,
* mln/world/kn/fill_0_from_2_faces.hh,
* mln/world/kn/fill_1_from_2_faces.hh,
* mln/world/kn/fill_1_from_aux_2_faces.hh,
* mln/world/kn/fill_2_from_1_faces.hh,
* mln/world/kn/internal/face_dim.hh,
* mln/world/kn/internal/immerse_point.hh,
* mln/world/kn/is_0_face.hh,
* mln/world/kn/is_0_or_1_face.hh,
* mln/world/kn/is_1_face.hh,
* mln/world/kn/is_1_face_horizontal.hh,
* mln/world/kn/is_1_face_vertical.hh,
* mln/world/kn/is_2_face.hh,
* mln/world/kn/un_immerse.hh: New.
* mln/world/k1/fill_0_1_faces_internal_border.hh,
* mln/world/k1/fill_0_from_2_faces.hh,
* mln/world/k1/fill_1_from_aux_2_faces.hh,
* mln/world/k1/fill_2_from_1_faces.hh,
* mln/world/k1/is_0_face.hh,
* mln/world/k1/is_0_or_1_face.hh,
* mln/world/k1/is_1_face.hh,
* mln/world/k1/is_1_face_horizontal.hh,
* mln/world/k1/is_1_face_vertical.hh,
* mln/world/k1/is_2_face.hh,
* mln/world/k2/fill_0_from_1_faces.hh,
* mln/world/k2/fill_1_from_2_faces.hh,
* mln/world/k2/fill_non_primary_from_primary_faces.hh,
* mln/world/k2/immerse_with.hh,
* mln/world/k2/is_non_primary_face.hh,
* mln/world/k2/is_non_primary_face_cross.hh,
* mln/world/k2/is_non_primary_face_horizontal.hh,
* mln/world/k2/is_non_primary_face_vertical.hh,
* mln/world/k2/is_primary_face.hh: Remove.
* mln/world/k1/display_enlarged.hh,
* mln/world/k1/fill_0_from_1_faces.hh,
* mln/world/k1/fill_0_from_primary_faces.hh,
* mln/world/k1/fill_1_from_2_faces.hh,
* mln/world/k1/immerse.hh,
* mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh,
* mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh,
* mln/world/k1/internal/face_dim.hh,
* mln/world/kn/immerse.hh,
* mln/world/k1/is_primary_face.hh,
* mln/world/k1/un_immerse.hh,
* mln/world/k2/immerse.hh: Fix namespaces.
* tests/world/Makefile.am,
* tests/world/k1/Makefile.am,
* tests/world/k1/fill_0_from_1_faces.cc,
* tests/world/k1/fill_1_from_2_faces.cc,
* tests/world/k1/immerse.cc,
* tests/world/k1/un_immerse.cc: Update tests.
* tests/world/k1/fill_0_1_faces_internal_border.cc,
* tests/world/k1/fill_0_from_2_faces.cc,
* tests/world/k1/fill_1_from_aux_2_faces.cc,
* tests/world/k1/fill_2_from_1_faces.cc,
* tests/world/k1/is_0_face.cc,
* tests/world/k1/is_0_or_1_face.cc,
* tests/world/k1/is_1_face.cc,
* tests/world/k1/is_1_face_horizontal.cc,
* tests/world/k1/is_1_face_vertical.cc,
* tests/world/k1/is_2_face.cc: Remove.
* tests/world/k1/immerse_with.cc,
* tests/world/k2/Makefile.am,
* tests/world/k2/fill_non_primary_from_primary_2_faces.cc,
* tests/world/k2/immerse.cc,
* tests/world/k2/is_non_primary_2_face.cc,
* tests/world/k2/is_non_primary_2_face_center.cc,
* tests/world/k2/is_non_primary_2_face_horizontal.cc,
* tests/world/k2/is_non_primary_2_face_vertical.cc,
* tests/world/k2/is_primary_2_face.cc,
* tests/world/k2/un_immerse.cc,
* tests/world/kn/Makefile.am,
* tests/world/kn/fill_0_1_faces_internal_border.cc,
* tests/world/kn/fill_0_from_1_faces.cc,
* tests/world/kn/fill_0_from_2_faces.cc,
* tests/world/kn/fill_1_from_2_faces.cc,
* tests/world/kn/fill_1_from_aux_2_faces.cc,
* tests/world/kn/fill_2_from_1_faces.cc,
* tests/world/kn/immerse.cc,
* tests/world/kn/is_0_face.cc,
* tests/world/kn/is_0_or_1_face.cc,
* tests/world/kn/is_1_face.cc,
* tests/world/kn/is_1_face_horizontal.cc,
* tests/world/kn/is_1_face_vertical.cc,
* tests/world/kn/is_2_face.cc,
* tests/world/kn/un_immerse.cc: New.
---
milena/ChangeLog | 105 ++++++++++
milena/mln/world/k1/display_enlarged.hh | 16 +-
.../mln/world/k1/fill_0_1_faces_internal_border.hh | 104 ----------
milena/mln/world/k1/fill_0_from_1_faces.hh | 62 ++----
milena/mln/world/k1/fill_0_from_2_faces.hh | 127 ------------
milena/mln/world/k1/fill_0_from_primary_faces.hh | 6 +-
milena/mln/world/k1/fill_1_from_2_faces.hh | 49 +----
milena/mln/world/k1/fill_1_from_aux_2_faces.hh | 155 --------------
milena/mln/world/k1/fill_2_from_1_faces.hh | 127 ------------
milena/mln/world/k1/immerse.hh | 45 +++-
.../k1/immerse_and_duplicate_2_to_0_1_faces.hh | 12 +-
.../world/k1/immerse_and_duplicate_2_to_1_faces.hh | 8 +-
milena/mln/world/k1/immerse_with.hh | 117 +++++++++++
milena/mln/world/k1/internal/face_dim.hh | 84 --------
milena/mln/world/k1/is_0_face.hh | 80 -------
milena/mln/world/k1/is_0_or_1_face.hh | 71 -------
milena/mln/world/k1/is_1_face.hh | 83 --------
milena/mln/world/k1/is_1_face_horizontal.hh | 79 -------
milena/mln/world/k1/is_1_face_vertical.hh | 83 --------
milena/mln/world/k1/is_2_face.hh | 80 -------
milena/mln/world/k1/is_primary_face.hh | 6 +-
milena/mln/world/k1/un_immerse.hh | 64 +++----
milena/mln/world/k2/fill_0_from_1_faces.hh | 114 ----------
milena/mln/world/k2/fill_1_from_2_faces.hh | 118 -----------
.../k2/fill_non_primary_from_primary_2_faces.hh | 197 ++++++++++++++++++
.../k2/fill_non_primary_from_primary_faces.hh | 217 --------------------
milena/mln/world/k2/immerse.hh | 107 ++++++-----
milena/mln/world/k2/immerse_with.hh | 173 ----------------
milena/mln/world/k2/is_non_primary_2_face.hh | 83 ++++++++
.../mln/world/k2/is_non_primary_2_face_center.hh | 88 ++++++++
.../world/k2/is_non_primary_2_face_horizontal.hh | 82 ++++++++
.../mln/world/k2/is_non_primary_2_face_vertical.hh | 82 ++++++++
milena/mln/world/k2/is_non_primary_face.hh | 83 --------
milena/mln/world/k2/is_non_primary_face_cross.hh | 88 --------
.../mln/world/k2/is_non_primary_face_horizontal.hh | 83 --------
.../mln/world/k2/is_non_primary_face_vertical.hh | 83 --------
milena/mln/world/k2/is_primary_2_face.hh | 81 ++++++++
milena/mln/world/k2/is_primary_face.hh | 82 --------
milena/mln/world/k2/un_immerse.hh | 114 ++++++++++
.../mln/world/kn/fill_0_1_faces_internal_border.hh | 103 +++++++++
milena/mln/world/kn/fill_0_from_1_faces.hh | 114 ++++++++++
milena/mln/world/kn/fill_0_from_2_faces.hh | 127 ++++++++++++
milena/mln/world/kn/fill_1_from_2_faces.hh | 118 +++++++++++
milena/mln/world/kn/fill_1_from_aux_2_faces.hh | 155 ++++++++++++++
milena/mln/world/kn/fill_2_from_1_faces.hh | 127 ++++++++++++
milena/mln/world/kn/immerse.hh | 93 +++++----
milena/mln/world/kn/internal/face_dim.hh | 84 ++++++++
milena/mln/world/kn/internal/immerse_point.hh | 90 ++++++++
milena/mln/world/kn/is_0_face.hh | 80 +++++++
milena/mln/world/kn/is_0_or_1_face.hh | 71 +++++++
milena/mln/world/kn/is_1_face.hh | 83 ++++++++
milena/mln/world/kn/is_1_face_horizontal.hh | 79 +++++++
milena/mln/world/kn/is_1_face_vertical.hh | 83 ++++++++
milena/mln/world/kn/is_2_face.hh | 80 +++++++
milena/mln/world/kn/un_immerse.hh | 144 +++++++++++++
milena/tests/world/Makefile.am | 4 +-
milena/tests/world/k1/Makefile.am | 28 +--
.../world/k1/fill_0_1_faces_internal_border.cc | 59 ------
milena/tests/world/k1/fill_0_from_1_faces.cc | 8 -
milena/tests/world/k1/fill_0_from_2_faces.cc | 93 ---------
milena/tests/world/k1/fill_1_from_2_faces.cc | 16 +-
milena/tests/world/k1/fill_1_from_aux_2_faces.cc | 104 ----------
milena/tests/world/k1/fill_2_from_1_faces.cc | 94 ---------
milena/tests/world/k1/immerse.cc | 56 ++++--
milena/tests/world/k1/immerse_with.cc | 63 ++++++
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/un_immerse.cc | 15 +-
milena/tests/world/k2/Makefile.am | 38 ++++
.../k2/fill_non_primary_from_primary_2_faces.cc | 105 ++++++++++
milena/tests/world/k2/immerse.cc | 78 +++++++
milena/tests/world/k2/is_non_primary_2_face.cc | 50 +++++
.../tests/world/k2/is_non_primary_2_face_center.cc | 48 +++++
.../world/k2/is_non_primary_2_face_horizontal.cc | 52 +++++
.../world/k2/is_non_primary_2_face_vertical.cc | 50 +++++
milena/tests/world/k2/is_primary_2_face.cc | 52 +++++
milena/tests/world/k2/un_immerse.cc | 55 +++++
milena/tests/world/kn/Makefile.am | 51 +++++
.../world/kn/fill_0_1_faces_internal_border.cc | 59 ++++++
milena/tests/world/kn/fill_0_from_1_faces.cc | 69 ++++++
milena/tests/world/kn/fill_0_from_2_faces.cc | 93 +++++++++
milena/tests/world/kn/fill_1_from_2_faces.cc | 87 ++++++++
milena/tests/world/kn/fill_1_from_aux_2_faces.cc | 104 ++++++++++
milena/tests/world/kn/fill_2_from_1_faces.cc | 94 +++++++++
milena/tests/world/kn/immerse.cc | 90 ++++++++
milena/tests/world/kn/is_0_face.cc | 40 ++++
milena/tests/world/kn/is_0_or_1_face.cc | 40 ++++
milena/tests/world/kn/is_1_face.cc | 39 ++++
milena/tests/world/kn/is_1_face_horizontal.cc | 41 ++++
milena/tests/world/kn/is_1_face_vertical.cc | 41 ++++
milena/tests/world/kn/is_2_face.cc | 39 ++++
milena/tests/world/kn/un_immerse.cc | 67 ++++++
96 files changed, 4320 insertions(+), 3011 deletions(-)
delete mode 100644 milena/mln/world/k1/fill_0_1_faces_internal_border.hh
delete mode 100644 milena/mln/world/k1/fill_0_from_2_faces.hh
delete mode 100644 milena/mln/world/k1/fill_1_from_aux_2_faces.hh
delete mode 100644 milena/mln/world/k1/fill_2_from_1_faces.hh
create mode 100644 milena/mln/world/k1/immerse_with.hh
delete mode 100644 milena/mln/world/k1/internal/face_dim.hh
delete mode 100644 milena/mln/world/k1/is_0_face.hh
delete mode 100644 milena/mln/world/k1/is_0_or_1_face.hh
delete mode 100644 milena/mln/world/k1/is_1_face.hh
delete mode 100644 milena/mln/world/k1/is_1_face_horizontal.hh
delete mode 100644 milena/mln/world/k1/is_1_face_vertical.hh
delete mode 100644 milena/mln/world/k1/is_2_face.hh
delete mode 100644 milena/mln/world/k2/fill_0_from_1_faces.hh
delete mode 100644 milena/mln/world/k2/fill_1_from_2_faces.hh
create mode 100644 milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
delete mode 100644 milena/mln/world/k2/fill_non_primary_from_primary_faces.hh
delete mode 100644 milena/mln/world/k2/immerse_with.hh
create mode 100644 milena/mln/world/k2/is_non_primary_2_face.hh
create mode 100644 milena/mln/world/k2/is_non_primary_2_face_center.hh
create mode 100644 milena/mln/world/k2/is_non_primary_2_face_horizontal.hh
create mode 100644 milena/mln/world/k2/is_non_primary_2_face_vertical.hh
delete mode 100644 milena/mln/world/k2/is_non_primary_face.hh
delete mode 100644 milena/mln/world/k2/is_non_primary_face_cross.hh
delete mode 100644 milena/mln/world/k2/is_non_primary_face_horizontal.hh
delete mode 100644 milena/mln/world/k2/is_non_primary_face_vertical.hh
create mode 100644 milena/mln/world/k2/is_primary_2_face.hh
delete mode 100644 milena/mln/world/k2/is_primary_face.hh
create mode 100644 milena/mln/world/k2/un_immerse.hh
create mode 100644 milena/mln/world/kn/fill_0_1_faces_internal_border.hh
create mode 100644 milena/mln/world/kn/fill_0_from_1_faces.hh
create mode 100644 milena/mln/world/kn/fill_0_from_2_faces.hh
create mode 100644 milena/mln/world/kn/fill_1_from_2_faces.hh
create mode 100644 milena/mln/world/kn/fill_1_from_aux_2_faces.hh
create mode 100644 milena/mln/world/kn/fill_2_from_1_faces.hh
create mode 100644 milena/mln/world/kn/internal/face_dim.hh
create mode 100644 milena/mln/world/kn/internal/immerse_point.hh
create mode 100644 milena/mln/world/kn/is_0_face.hh
create mode 100644 milena/mln/world/kn/is_0_or_1_face.hh
create mode 100644 milena/mln/world/kn/is_1_face.hh
create mode 100644 milena/mln/world/kn/is_1_face_horizontal.hh
create mode 100644 milena/mln/world/kn/is_1_face_vertical.hh
create mode 100644 milena/mln/world/kn/is_2_face.hh
create mode 100644 milena/mln/world/kn/un_immerse.hh
delete mode 100644 milena/tests/world/k1/fill_0_1_faces_internal_border.cc
delete mode 100644 milena/tests/world/k1/fill_0_from_2_faces.cc
delete mode 100644 milena/tests/world/k1/fill_1_from_aux_2_faces.cc
delete mode 100644 milena/tests/world/k1/fill_2_from_1_faces.cc
create mode 100644 milena/tests/world/k1/immerse_with.cc
delete mode 100644 milena/tests/world/k1/is_0_face.cc
delete mode 100644 milena/tests/world/k1/is_0_or_1_face.cc
delete mode 100644 milena/tests/world/k1/is_1_face.cc
delete mode 100644 milena/tests/world/k1/is_1_face_horizontal.cc
delete mode 100644 milena/tests/world/k1/is_1_face_vertical.cc
delete mode 100644 milena/tests/world/k1/is_2_face.cc
create mode 100644 milena/tests/world/k2/Makefile.am
create mode 100644 milena/tests/world/k2/fill_non_primary_from_primary_2_faces.cc
create mode 100644 milena/tests/world/k2/immerse.cc
create mode 100644 milena/tests/world/k2/is_non_primary_2_face.cc
create mode 100644 milena/tests/world/k2/is_non_primary_2_face_center.cc
create mode 100644 milena/tests/world/k2/is_non_primary_2_face_horizontal.cc
create mode 100644 milena/tests/world/k2/is_non_primary_2_face_vertical.cc
create mode 100644 milena/tests/world/k2/is_primary_2_face.cc
create mode 100644 milena/tests/world/k2/un_immerse.cc
create mode 100644 milena/tests/world/kn/Makefile.am
create mode 100644 milena/tests/world/kn/fill_0_1_faces_internal_border.cc
create mode 100644 milena/tests/world/kn/fill_0_from_1_faces.cc
create mode 100644 milena/tests/world/kn/fill_0_from_2_faces.cc
create mode 100644 milena/tests/world/kn/fill_1_from_2_faces.cc
create mode 100644 milena/tests/world/kn/fill_1_from_aux_2_faces.cc
create mode 100644 milena/tests/world/kn/fill_2_from_1_faces.cc
create mode 100644 milena/tests/world/kn/immerse.cc
create mode 100644 milena/tests/world/kn/is_0_face.cc
create mode 100644 milena/tests/world/kn/is_0_or_1_face.cc
create mode 100644 milena/tests/world/kn/is_1_face.cc
create mode 100644 milena/tests/world/kn/is_1_face_horizontal.cc
create mode 100644 milena/tests/world/kn/is_1_face_vertical.cc
create mode 100644 milena/tests/world/kn/is_2_face.cc
create mode 100644 milena/tests/world/kn/un_immerse.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 31f7bba..9fcc238 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,110 @@
2012-10-22 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Revamp khalimsky directory.
+
+ * mln/world/k1/immerse_with.hh,
+ * mln/world/k2/fill_non_primary_from_primary_2_faces.hh,
+ * mln/world/k2/is_non_primary_2_face.hh,
+ * mln/world/k2/is_non_primary_2_face_center.hh,
+ * mln/world/k2/is_non_primary_2_face_horizontal.hh,
+ * mln/world/k2/is_non_primary_2_face_vertical.hh,
+ * mln/world/k2/is_primary_2_face.hh,
+ * mln/world/k2/un_immerse.hh,
+ * mln/world/kn/fill_0_1_faces_internal_border.hh,
+ * mln/world/kn/fill_0_from_1_faces.hh,
+ * mln/world/kn/fill_0_from_2_faces.hh,
+ * mln/world/kn/fill_1_from_2_faces.hh,
+ * mln/world/kn/fill_1_from_aux_2_faces.hh,
+ * mln/world/kn/fill_2_from_1_faces.hh,
+ * mln/world/kn/internal/face_dim.hh,
+ * mln/world/kn/internal/immerse_point.hh,
+ * mln/world/kn/is_0_face.hh,
+ * mln/world/kn/is_0_or_1_face.hh,
+ * mln/world/kn/is_1_face.hh,
+ * mln/world/kn/is_1_face_horizontal.hh,
+ * mln/world/kn/is_1_face_vertical.hh,
+ * mln/world/kn/is_2_face.hh,
+ * mln/world/kn/un_immerse.hh: New.
+
+ * mln/world/k1/fill_0_1_faces_internal_border.hh,
+ * mln/world/k1/fill_0_from_2_faces.hh,
+ * mln/world/k1/fill_1_from_aux_2_faces.hh,
+ * mln/world/k1/fill_2_from_1_faces.hh,
+ * mln/world/k1/is_0_face.hh,
+ * mln/world/k1/is_0_or_1_face.hh,
+ * mln/world/k1/is_1_face.hh,
+ * mln/world/k1/is_1_face_horizontal.hh,
+ * mln/world/k1/is_1_face_vertical.hh,
+ * mln/world/k1/is_2_face.hh,
+ * mln/world/k2/fill_0_from_1_faces.hh,
+ * mln/world/k2/fill_1_from_2_faces.hh,
+ * mln/world/k2/fill_non_primary_from_primary_faces.hh,
+ * mln/world/k2/immerse_with.hh,
+ * mln/world/k2/is_non_primary_face.hh,
+ * mln/world/k2/is_non_primary_face_cross.hh,
+ * mln/world/k2/is_non_primary_face_horizontal.hh,
+ * mln/world/k2/is_non_primary_face_vertical.hh,
+ * mln/world/k2/is_primary_face.hh: Remove.
+
+ * mln/world/k1/display_enlarged.hh,
+ * mln/world/k1/fill_0_from_1_faces.hh,
+ * mln/world/k1/fill_0_from_primary_faces.hh,
+ * mln/world/k1/fill_1_from_2_faces.hh,
+ * mln/world/k1/immerse.hh,
+ * mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh,
+ * mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh,
+ * mln/world/k1/internal/face_dim.hh,
+ * mln/world/kn/immerse.hh,
+ * mln/world/k1/is_primary_face.hh,
+ * mln/world/k1/un_immerse.hh,
+ * mln/world/k2/immerse.hh: Fix namespaces.
+
+ * tests/world/Makefile.am,
+ * tests/world/k1/Makefile.am,
+ * tests/world/k1/fill_0_from_1_faces.cc,
+ * tests/world/k1/fill_1_from_2_faces.cc,
+ * tests/world/k1/immerse.cc,
+ * tests/world/k1/un_immerse.cc: Update tests.
+
+ * tests/world/k1/fill_0_1_faces_internal_border.cc,
+ * tests/world/k1/fill_0_from_2_faces.cc,
+ * tests/world/k1/fill_1_from_aux_2_faces.cc,
+ * tests/world/k1/fill_2_from_1_faces.cc,
+ * tests/world/k1/is_0_face.cc,
+ * tests/world/k1/is_0_or_1_face.cc,
+ * tests/world/k1/is_1_face.cc,
+ * tests/world/k1/is_1_face_horizontal.cc,
+ * tests/world/k1/is_1_face_vertical.cc,
+ * tests/world/k1/is_2_face.cc: Remove.
+
+ * tests/world/k1/immerse_with.cc,
+ * tests/world/k2/Makefile.am,
+ * tests/world/k2/fill_non_primary_from_primary_2_faces.cc,
+ * tests/world/k2/immerse.cc,
+ * tests/world/k2/is_non_primary_2_face.cc,
+ * tests/world/k2/is_non_primary_2_face_center.cc,
+ * tests/world/k2/is_non_primary_2_face_horizontal.cc,
+ * tests/world/k2/is_non_primary_2_face_vertical.cc,
+ * tests/world/k2/is_primary_2_face.cc,
+ * tests/world/k2/un_immerse.cc,
+ * tests/world/kn/Makefile.am,
+ * tests/world/kn/fill_0_1_faces_internal_border.cc,
+ * tests/world/kn/fill_0_from_1_faces.cc,
+ * tests/world/kn/fill_0_from_2_faces.cc,
+ * tests/world/kn/fill_1_from_2_faces.cc,
+ * tests/world/kn/fill_1_from_aux_2_faces.cc,
+ * tests/world/kn/fill_2_from_1_faces.cc,
+ * tests/world/kn/immerse.cc,
+ * tests/world/kn/is_0_face.cc,
+ * tests/world/kn/is_0_or_1_face.cc,
+ * tests/world/kn/is_1_face.cc,
+ * tests/world/kn/is_1_face_horizontal.cc,
+ * tests/world/kn/is_1_face_vertical.cc,
+ * tests/world/kn/is_2_face.cc,
+ * tests/world/kn/un_immerse.cc: New.
+
+2012-10-22 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Replace converters by safe_cast.
* mln/world/k2/converters.hh: Remove.
diff --git a/milena/mln/world/k1/display_enlarged.hh
b/milena/mln/world/k1/display_enlarged.hh
index a247d38..fa437d4 100644
--- a/milena/mln/world/k1/display_enlarged.hh
+++ b/milena/mln/world/k1/display_enlarged.hh
@@ -32,10 +32,10 @@
# 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/world/kn/is_0_face.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
+# include <mln/world/kn/is_2_face.hh>
# include <mln/geom/all.hh>
@@ -114,21 +114,21 @@ namespace mln
{
for (mln::def::coord col = min_col; col <= max_col; ++col)
{
- if (is_0_face(row, col))
+ if (kn::is_0_face(row, col))
{
output.at_(row * shift, col * shift) = ima_k1.at_(row, col);
}
- else if (is_1_face_vertical(row, col))
+ else if (kn::is_1_face_vertical(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(row, col))
+ else if (kn::is_1_face_horizontal(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(row, col))
+ else if (kn::is_2_face(row, col))
{
for (mln::def::coord i = -(shift - 1); i < (shift + 3); ++i)
for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
diff --git a/milena/mln/world/k1/fill_0_1_faces_internal_border.hh
b/milena/mln/world/k1/fill_0_1_faces_internal_border.hh
deleted file mode 100644
index 0ee3d27..0000000
--- a/milena/mln/world/k1/fill_0_1_faces_internal_border.hh
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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 Fill 0 and 1 faces border with a value in a K1 2D image.
-
-#ifndef MLN_WORLD_K1_FILL_0_1_FACES_INTERNAL_BORDER_HH
-# define MLN_WORLD_K1_FILL_0_1_FACES_INTERNAL_BORDER_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_0_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k1
- {
-
- /*! \brief Fill 0 and 1 faces border with a value in a K1 2D image.
-
- \param[in,out] inout A 2D image immersed in K1.
- \param[in] v The border value.
-
- Example with \p v=1:
-
- . - . - . 1 1 1 1 1
- | o | o | 1 o | o 1
- . - . - . -> 1 - . - 1
- | o | o | 1 o | o 1
- . - . - . 1 1 1 1 1
-
- */
- template <typename I>
- void fill_0_1_faces_internal_border(Image<I>& inout, const
mln_value(I)& v);
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
-
- template <typename I>
- void fill_0_1_faces_internal_border(Image<I>& inout_, const
mln_value(I)& v)
- {
- trace::entering("mln::world::k1::fill_0_1_faces_internal_border");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
-
- // Horizontal borders
- for (mln::def::coord col = geom::min_col(inout); col <= geom::max_col(inout); ++col)
- {
- inout.at_(geom::min_row(inout), col) = v;
- inout.at_(geom::max_row(inout), col) = v;
- }
-
- // Vertical borders
- for (mln::def::coord row = geom::min_row(inout); row <= geom::max_row(inout); ++row)
- {
- inout.at_(row, geom::min_col(inout)) = v;
- inout.at_(row, geom::max_col(inout)) = v;
- }
-
- trace::exiting("mln::world::k1::fill_0_1_faces_internal_border");
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k1
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K1_FILL_0_1_FACES_INTERNAL_BORDER_HH
diff --git a/milena/mln/world/k1/fill_0_from_1_faces.hh
b/milena/mln/world/k1/fill_0_from_1_faces.hh
index c56f407..c0f6eb7 100644
--- a/milena/mln/world/k1/fill_0_from_1_faces.hh
+++ b/milena/mln/world/k1/fill_0_from_1_faces.hh
@@ -31,7 +31,9 @@
# define MLN_WORLD_K1_FILL_0_FROM_1_FACES_HH
# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_0_face.hh>
+# include <mln/world/kn/is_0_face.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
namespace mln
@@ -46,24 +48,27 @@ namespace mln
/*! \brief Fill 1 faces in a K1 2D image using its 2 faces.
\param[in,out] inout A 2D image immersed in K1.
- \param[in,out] f A functor computing a result from four values.
+ \param[in,out] f A functor computing a result from two values.
- This function use the following neighborhood:
+ This function use the following neighborhoods:
+
+ * In case of vertical 1 faces:
\verbatim
- |
- -.-
- |
+ x | x
\endverbatim
+ * In case of horizontal 1 face:
+
+ \verbatim
+ x
+ -
+ x
+ \endverbatim
*/
template <typename I, typename F>
- void fill_0_from_1_faces(Image<I>& inout, Function_vvvv2v<F>&
f);
-
- /// \overload
- template <typename I, typename A>
- void fill_0_from_1_faces(Image<I>& inout, const Accumulator<A>&
accu);
+ void fill_0_from_1_faces(Image<I>& inout, const
Function_vvvv2v<F>& f);
# ifndef MLN_INCLUDE_ONLY
@@ -73,44 +78,19 @@ namespace mln
template <typename I, typename F>
- void fill_0_from_1_faces(Image<I>& inout_, Function_vvvv2v<F>&
f_)
- {
- trace::entering("mln::world::k1::fill_0_from_1_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- F& f = exact(f_);
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_0_face(p))
- inout(p) = f(inout(p + up), inout(p + left), inout(p + right), inout(p + down));
-
- trace::exiting("mln::world::k1::fill_0_from_1_faces");
- }
-
-
- template <typename I, typename A>
- void fill_0_from_1_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
+ void fill_0_from_1_faces(Image<I>& inout_, const
Function_vvvv2v<F>& f_)
{
trace::entering("mln::world::k1::fill_0_from_1_faces");
mln_precondition(exact(inout_).is_valid());
I& inout = exact(inout_);
- (void) accu_;
+ const F& f = exact(f_);
- A accu = A();
mln_piter(I) p(inout.domain());
for_all(p)
- if (is_0_face(p))
- {
- accu.init();
- accu.take(inout(p + up));
- accu.take(inout(p + left));
- accu.take(inout(p + right));
- accu.take(inout(p + down));
- inout(p) = accu.to_result();
- }
+ if (kn::is_0_face(p))
+ inout(p) = f(inout(p + up), inout(p + left),
+ inout(p + right), inout(p + down));
trace::exiting("mln::world::k1::fill_0_from_1_faces");
}
diff --git a/milena/mln/world/k1/fill_0_from_2_faces.hh
b/milena/mln/world/k1/fill_0_from_2_faces.hh
deleted file mode 100644
index 7b3e57e..0000000
--- a/milena/mln/world/k1/fill_0_from_2_faces.hh
+++ /dev/null
@@ -1,127 +0,0 @@
-// 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 Fill 1 faces in a K1 2D image using its 2 faces.
-
-#ifndef MLN_WORLD_K1_FILL_0_FROM_2_FACES_HH
-# define MLN_WORLD_K1_FILL_0_FROM_2_FACES_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_0_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k1
- {
-
- /*! \brief Fill 0 faces in a K1 2D image using its 2 faces.
-
- \param[in,out] inout A 2D image immersed in K1.
- \param[in,out] f A functor computing a result from four values.
-
- This function use the following neighborhood:
-
- \verbatim
- x x
- .
- x x
- \endverbatim
-
-
- */
- template <typename I, typename F>
- void fill_0_from_2_faces(Image<I>& inout, Function_vvvv2v<F>&
f);
-
- /// \overload
- template <typename I, typename A>
- void fill_0_from_2_faces(Image<I>& inout, const Accumulator<A>&
accu);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
-
- template <typename I, typename F>
- void fill_0_from_2_faces(Image<I>& inout_, Function_vvvv2v<F>&
f_)
- {
- trace::entering("mln::world::k1::fill_0_from_2_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- F& f = exact(f_);
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_0_face(p))
- inout(p) = f(inout(p + up_left), inout(p + up_right), inout(p + down_left), inout(p
+ down_right));
-
- trace::exiting("mln::world::k1::fill_0_from_2_faces");
- }
-
-
- template <typename I, typename A>
- void fill_0_from_2_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
- {
- trace::entering("mln::world::k1::fill_0_from_2_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- (void) accu_;
-
- A accu = A();
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_0_face(p))
- {
- accu.init();
- accu.take(inout(p + up_left));
- accu.take(inout(p + up_right));
- accu.take(inout(p + down_left));
- accu.take(inout(p + down_right));
- inout(p) = accu.to_result();
- }
-
- trace::exiting("mln::world::k1::fill_0_from_2_faces");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k1
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K1_FILL_0_FROM_2_FACES_HH
diff --git a/milena/mln/world/k1/fill_0_from_primary_faces.hh
b/milena/mln/world/k1/fill_0_from_primary_faces.hh
index db3aed8..12dcc5f 100644
--- a/milena/mln/world/k1/fill_0_from_primary_faces.hh
+++ b/milena/mln/world/k1/fill_0_from_primary_faces.hh
@@ -31,7 +31,7 @@
# define MLN_WORLD_K1_FILL_0_FROM_PRIMARY_FACES_HH
# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/fill_0_from_2_faces.hh>
+# include <mln/world/kn/fill_0_from_2_faces.hh>
namespace mln
@@ -79,7 +79,7 @@ namespace mln
mln_precondition(exact(inout).is_valid());
- fill_0_from_2_faces(inout, f);
+ kn::fill_0_from_2_faces(inout, f);
trace::exiting("mln::world::k1::fill_0_from_primary_faces");
}
@@ -92,7 +92,7 @@ namespace mln
mln_precondition(exact(inout).is_valid());
- fill_0_from_2_faces(inout, accu);
+ kn::fill_0_from_2_faces(inout, accu);
trace::exiting("mln::world::k1::fill_0_from_primary_faces");
}
diff --git a/milena/mln/world/k1/fill_1_from_2_faces.hh
b/milena/mln/world/k1/fill_1_from_2_faces.hh
index abec694..74e6b25 100644
--- a/milena/mln/world/k1/fill_1_from_2_faces.hh
+++ b/milena/mln/world/k1/fill_1_from_2_faces.hh
@@ -31,8 +31,8 @@
# define MLN_WORLD_K1_FILL_1_FROM_2_FACES_HH
# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_1_face_vertical.hh>
-# include <mln/world/k1/is_1_face_horizontal.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
namespace mln
@@ -67,11 +67,7 @@ namespace mln
*/
template <typename I, typename F>
- void fill_1_from_2_faces(Image<I>& inout, Function_vv2v<F>&
f);
-
- /// \overload
- template <typename I, typename A>
- void fill_1_from_2_faces(Image<I>& inout, const Accumulator<A>&
accu);
+ void fill_1_from_2_faces(Image<I>& inout, const
Function_vv2v<F>& f);
# ifndef MLN_INCLUDE_ONLY
@@ -81,56 +77,25 @@ namespace mln
template <typename I, typename F>
- void fill_1_from_2_faces(Image<I>& inout_, Function_vv2v<F>&
f_)
+ void fill_1_from_2_faces(Image<I>& inout_, const
Function_vv2v<F>& f_)
{
trace::entering("mln::world::k1::fill_1_from_2_faces");
mln_precondition(exact(inout_).is_valid());
I& inout = exact(inout_);
- F& f = exact(f_);
+ const F& f = exact(f_);
mln_piter(I) p(inout.domain());
for_all(p)
- if (is_1_face_vertical(p))
+ if (kn::is_1_face_vertical(p))
inout(p) = f(inout(p + left), inout(p + right));
- else if (is_1_face_horizontal(p))
+ else if (kn::is_1_face_horizontal(p))
inout(p) = f(inout(p + up), inout(p + down));
trace::exiting("mln::world::k1::fill_1_from_2_faces");
}
- template <typename I, typename A>
- void fill_1_from_2_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
- {
- trace::entering("mln::world::k1::fill_1_from_2_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- (void) accu_;
-
- A accu = A();
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_1_face_vertical(p))
- {
- accu.init();
- accu.take(inout(p + left));
- accu.take(inout(p + right));
- inout(p) = accu.to_result();
- }
- else if (is_1_face_horizontal(p))
- {
- accu.init();
- accu.take(inout(p + up));
- accu.take(inout(p + down));
- inout(p) = accu.to_result();
- }
-
- trace::exiting("mln::world::k1::fill_1_from_2_faces");
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::world::k1
diff --git a/milena/mln/world/k1/fill_1_from_aux_2_faces.hh
b/milena/mln/world/k1/fill_1_from_aux_2_faces.hh
deleted file mode 100644
index e8a7358..0000000
--- a/milena/mln/world/k1/fill_1_from_aux_2_faces.hh
+++ /dev/null
@@ -1,155 +0,0 @@
-// 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 Fill 1 faces in a K1 2D image using 2 faces from an
-/// auxiliary image.
-
-#ifndef MLN_WORLD_K1_FILL_1_FROM_AUX_2_FACES_HH
-# define MLN_WORLD_K1_FILL_1_FROM_AUX_2_FACES_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_1_face_vertical.hh>
-# include <mln/world/k1/is_1_face_horizontal.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k1
- {
-
- /*! \brief Fill 1 faces in a K1 2D image using 2 faces from an
- auxiliary image.
-
- \param[in,out] inout A 2D image immersed in K1.
- \param[in] aux A 2D image with the same domain as \p inout.
- \param[in,out] f A functor computing a result from two values.
-
- This function use the following neighborhoods:
-
- * In case of vertical 1 faces:
-
- \verbatim
- x | x
- \endverbatim
-
- * In case of horizontal 1 face:
-
- \verbatim
- x
- -
- x
- \endverbatim
-
- */
- template <typename I, typename J, typename F>
- void fill_1_from_aux_2_faces(Image<I>& inout, const Image<J>&
aux,
- Function_vv2v<F>& f);
-
- /// \overload
- template <typename I, typename J, typename A>
- void fill_1_from_aux_2_faces(Image<I>& inout, const Image<J>&
aux,
- const Accumulator<A>& accu);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
-
- template <typename I, typename J, typename F>
- void fill_1_from_aux_2_faces(Image<I>& inout_, const Image<J>&
aux_,
- Function_vv2v<F>& f_)
- {
- trace::entering("mln::world::k1::fill_1_from_aux_2_faces");
-
- mln_precondition(exact(inout_).is_valid());
- mln_precondition(exact(aux_).is_valid());
- mln_precondition(exact(inout_).domain() == exact(aux_).domain());
- I& inout = exact(inout_);
- const J& aux = exact(aux_);
- F& f = exact(f_);
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_1_face_vertical(p))
- inout(p) = f(aux(p + left), aux(p + right));
- else if (is_1_face_horizontal(p))
- inout(p) = f(aux(p + up), aux(p + down));
-
- trace::exiting("mln::world::k1::fill_1_from_aux_2_faces");
- }
-
-
- template <typename I, typename J, typename A>
- void fill_1_from_aux_2_faces(Image<I>& inout_, const Image<J>&
aux_,
- const Accumulator<A>& accu_)
- {
- trace::entering("mln::world::k1::fill_1_from_aux_2_faces");
-
- mln_precondition(exact(inout_).is_valid());
- mln_precondition(exact(aux_).is_valid());
- mln_precondition(exact(inout_).domain() == exact(aux_).domain());
- I& inout = exact(inout_);
- const J& aux = exact(aux_);
- (void) accu_;
-
- A accu = A();
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_1_face_vertical(p))
- {
- accu.init();
- accu.take(aux(p + left));
- accu.take(aux(p + right));
- inout(p) = accu.to_result();
- }
- else if (is_1_face_horizontal(p))
- {
- accu.init();
- accu.take(aux(p + up));
- accu.take(aux(p + down));
- inout(p) = accu.to_result();
- }
-
- trace::exiting("mln::world::k1::fill_1_from_aux_2_faces");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k1
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K1_FILL_1_FROM_AUX_2_FACES_HH
diff --git a/milena/mln/world/k1/fill_2_from_1_faces.hh
b/milena/mln/world/k1/fill_2_from_1_faces.hh
deleted file mode 100644
index c539e30..0000000
--- a/milena/mln/world/k1/fill_2_from_1_faces.hh
+++ /dev/null
@@ -1,127 +0,0 @@
-// 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 Fill 2 faces in a K1 2D image using its 1 faces.
-
-#ifndef MLN_WORLD_K1_FILL_2_FROM_1_FACES_HH
-# define MLN_WORLD_K1_FILL_2_FROM_1_FACES_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k1
- {
-
- /*! \brief Fill 0 faces in a K1 2D image using its 2 faces.
-
- \param[in,out] inout A 2D image immersed in K1.
- \param[in,out] f A functor computing a result from four values.
-
- This function use the following neighborhood:
-
- \verbatim
- -
- |o|
- -
- \endverbatim
-
-
- */
- template <typename I, typename F>
- void fill_2_from_1_faces(Image<I>& inout, Function_vvvv2v<F>&
f);
-
- /// \overload
- template <typename I, typename A>
- void fill_2_from_1_faces(Image<I>& inout, const Accumulator<A>&
accu);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
-
- template <typename I, typename F>
- void fill_2_from_1_faces(Image<I>& inout_, Function_vvvv2v<F>&
f_)
- {
- trace::entering("mln::world::k1::fill_2_from_1_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- F& f = exact(f_);
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_2_face(p))
- inout(p) = f(inout(p + up), inout(p + left), inout(p + right), inout(p + down));
-
- trace::exiting("mln::world::k1::fill_2_from_1_faces");
- }
-
-
- template <typename I, typename A>
- void fill_2_from_1_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
- {
- trace::entering("mln::world::k1::fill_2_from_1_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- (void) accu_;
-
- A accu = A();
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_2_face(p))
- {
- accu.init();
- accu.take(inout(p + up));
- accu.take(inout(p + left));
- accu.take(inout(p + right));
- accu.take(inout(p + down));
- inout(p) = accu.to_result();
- }
-
- trace::exiting("mln::world::k1::fill_2_from_1_faces");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k1
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K1_FILL_2_FROM_1_FACES_HH
diff --git a/milena/mln/world/k1/immerse.hh b/milena/mln/world/k1/immerse.hh
index 1f59f7e..5ae6cfc 100644
--- a/milena/mln/world/k1/immerse.hh
+++ b/milena/mln/world/k1/immerse.hh
@@ -31,9 +31,6 @@
# define MLN_WORLD_K1_IMMERSE_HH
# include <mln/core/concept/image.hh>
-# include <mln/core/concept/box.hh>
-# include <mln/core/alias/point2d.hh>
-
# include <mln/world/kn/immerse.hh>
namespace mln
@@ -48,43 +45,50 @@ namespace mln
/*! \brief Immerse a 2D image into K1.
\param[in] ima 2D Image in K0.
- \param[in] new_type Value type of the immersed image.
+ \param[in] new_value_type Value type of the immersed image.
\return A 2D image immersed in k1 of value type \tparam V.
\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, typename V>
- mln_concrete(I) immerse(const Image<I>& ima, const V& new_type);
+ mln_ch_value(I,V)
+ immerse(const Image<I>& ima, const V& new_value_type);
/// \overload
/// new_type is set to mln_value(I).
template <typename I>
mln_concrete(I) immerse(const Image<I>& ima);
+ /// \overload
+ /// 0, 1 and non-primary 2-faces values are set to \p
+ /// default_value.
+ template <typename I, typename V>
+ mln_ch_value(I, V)
+ immerse(const Image<I>& ima, const V& new_value_type,
+ const V& default_value);
+
# ifndef MLN_INCLUDE_ONLY
- // Facade
template <typename I, typename V>
- mln_concrete(I)
- immerse(const Image<I>& ima, const V& new_type)
+ mln_ch_value(I,V)
+ immerse(const Image<I>& ima, const V& new_value_type)
{
trace::entering("mln::world::k1::immerse");
mln_precondition(exact(ima).is_valid());
+ (void) new_value_type;
- mln_concrete(I) output = kn::immerse(ima, 1, V());
+ mln_ch_value(I,V) output = kn::immerse(ima, 1, V());
trace::exiting("mln::world::k1::immerse");
return output;
@@ -96,9 +100,26 @@ namespace mln
immerse(const Image<I>& ima)
{
typedef mln_value(I) V;
- return immerse(ima, V());
+ return immerse(ima, 1);
}
+
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ immerse(const Image<I>& ima, const V& new_value_type,
+ const V& default_value)
+ {
+ trace::entering("mln::world::k2::immerse");
+ mln_precondition(exact(ima).is_valid());
+
+ mln_ch_value(I,V)
+ output = kn::immerse(ima, 1, new_value_type, default_value);
+
+ trace::exiting("mln::world::k2::immerse");
+ return output;
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::world::k1
diff --git a/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
b/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
index 137f4a3..b6b6d57 100644
--- a/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
+++ b/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
@@ -35,9 +35,9 @@
# include <mln/core/concept/box.hh>
# include <mln/core/alias/point2d.hh>
# include <mln/world/k1/immerse.hh>
-# include <mln/world/k1/is_1_face_vertical.hh>
-# include <mln/world/k1/is_1_face_horizontal.hh>
-# include <mln/world/k1/is_0_face.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
+# include <mln/world/kn/is_0_face.hh>
namespace mln
@@ -83,21 +83,21 @@ namespace mln
mln_piter(I) p(output.domain());
for_all(p)
- if (is_1_face_vertical(p))
+ if (kn::is_1_face_vertical(p))
{
if (output.domain().has(p + left))
output(p) = output(p + left);
else // Handle left border
output(p) = output(p + right);
}
- else if (is_1_face_horizontal(p))
+ else if (kn::is_1_face_horizontal(p))
{
if (output.domain().has(p + up))
output(p) = output(p + up);
else // Handle top border
output(p) = output(p + down);
}
- else if (is_0_face(p))
+ else if (kn::is_0_face(p))
{
if (output.domain().has(p + up_left))
output(p) = output(p + up_left);
diff --git a/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
b/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
index 27c1eb9..33ef3dd 100644
--- a/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
+++ b/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
@@ -35,8 +35,8 @@
# include <mln/core/concept/box.hh>
# include <mln/core/alias/point2d.hh>
# include <mln/world/k1/immerse.hh>
-# include <mln/world/k1/is_1_face_vertical.hh>
-# include <mln/world/k1/is_1_face_horizontal.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
namespace mln
{
@@ -81,14 +81,14 @@ namespace mln
mln_piter(I) p(output.domain());
for_all(p)
- if (is_1_face_vertical(p))
+ if (kn::is_1_face_vertical(p))
{
if (output.domain().has(p + left))
output(p) = output(p + left);
else // Handle left border
output(p) = output(p + right);
}
- else if (is_1_face_horizontal(p))
+ else if (kn::is_1_face_horizontal(p))
{
if (output.domain().has(p + up))
output(p) = output(p + up);
diff --git a/milena/mln/world/k1/immerse_with.hh b/milena/mln/world/k1/immerse_with.hh
new file mode 100644
index 0000000..d52bbe7
--- /dev/null
+++ b/milena/mln/world/k1/immerse_with.hh
@@ -0,0 +1,117 @@
+// 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 and compute values of 0 and 1
+/// faces from 2-faces'.
+
+#ifndef MLN_WORLD_K1_IMMERSE_WITH_HH
+# define MLN_WORLD_K1_IMMERSE_WITH_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+
+# include <mln/world/k1/immerse.hh>
+# include <mln/world/k1/fill_0_from_1_faces.hh>
+# include <mln/world/k1/fill_1_from_2_faces.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Immerse a 2D image into K1 and compute values of
+ * 0 and 1 faces from 2-faces'.
+
+ \verbatim
+ -1 0 1 2 3
+ 0 1 -1 . - . - .
+ 0 o o 0 | o | o |
+ 1 o o -> 1 . - . - .
+ 2 | o | o |
+ 3 . - . - .
+ \endverbatim
+
+ 1-faces are valued with function \p f2, using left and right
+ 2-faces (for vertical 1-faces) or up and down 2-faces (for
+ horizontal 1-faces).
+
+ 0-faces are valued with function \p f4, considering a
+ 4-connexity with its 1-face neighbors.
+
+ */
+ template <typename I, typename V, typename F2, typename F4>
+ mln_ch_value(I, V)
+ immerse_with(const Image<I>& ima, const V& new_value_type,
+ const Function_vv2v<F2>& f_1faces,
+ const Function_vvvv2v<F4>& f_0faces);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename V, typename F2, typename F4>
+ mln_ch_value(I, V)
+ immerse_with(const Image<I>& ima_, const V& new_value_type,
+ const Function_vv2v<F2>& f_1faces_,
+ const Function_vvvv2v<F4>& f_0faces_)
+ {
+ trace::entering("mln::world::k1::immerse_with");
+ mln_precondition(exact(ima_).is_valid());
+
+ // FIXME: we cannot write that test because we rely on
+ // safe_convert. So, even though some types may not
+ // have conversions available by default, conversion
+ // may work...
+ //mlc_converts_to(mln_result(F2), V)::check();
+ //mlc_converts_to(mln_result(F4), V)::check();
+
+ const I& ima = exact(ima_);
+ const F2& f_1faces = exact(f_1faces_);
+ const F4& f_0faces = exact(f_0faces_);
+
+ mln_ch_value(I,V) output = k1::immerse(ima, new_value_type);
+ k1::fill_1_from_2_faces(output, f_1faces);
+ k1::fill_0_from_1_faces(output, f_0faces);
+
+ trace::exiting("mln::world::k1::immerse_with");
+ 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_WITH_HH
diff --git a/milena/mln/world/k1/internal/face_dim.hh
b/milena/mln/world/k1/internal/face_dim.hh
deleted file mode 100644
index 34a0247..0000000
--- a/milena/mln/world/k1/internal/face_dim.hh
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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);
-
- /// \overload
- unsigned face_dim(const mln::def::coord& row, const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- unsigned face_dim(const point2d& p)
- {
- return face_dim(p.row(), p.col());
- }
-
- inline
- unsigned face_dim(const mln::def::coord& row, const mln::def::coord& col)
- {
- return (row % 2 == 0) + (col % 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
deleted file mode 100644
index 01878d9..0000000
--- a/milena/mln/world/k1/is_0_face.hh
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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);
-
- /// \overload
- bool is_0_face(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_0_face(const point2d& p)
- {
- return is_0_face(p.row(), p.col());
- }
-
- inline
- bool is_0_face(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return internal::face_dim(row, col) == 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
deleted file mode 100644
index 6f3f47a..0000000
--- a/milena/mln/world/k1/is_0_or_1_face.hh
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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
deleted file mode 100644
index 60e2fdf..0000000
--- a/milena/mln/world/k1/is_1_face.hh
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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);
-
-
- /// \overload
- inline
- bool is_1_face(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_1_face(const point2d& p)
- {
- return is_1_face(p.row(), p.col());
- }
-
- inline
- bool is_1_face(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return internal::face_dim(row, col) == 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
deleted file mode 100644
index e0e9cd8..0000000
--- a/milena/mln/world/k1/is_1_face_horizontal.hh
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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);
-
-
- /// \overload
- bool is_1_face_horizontal(const mln::def::coord& row,
- const mln::def::coord& col);
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_1_face_horizontal(const point2d& p)
- {
- return is_1_face_horizontal(p.row(), p.col());
- }
-
- bool is_1_face_horizontal(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return is_1_face(row, col) && col % 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
deleted file mode 100644
index b96bfe3..0000000
--- a/milena/mln/world/k1/is_1_face_vertical.hh
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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);
-
-
- /// \overload
- bool is_1_face_vertical(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_1_face_vertical(const point2d& p)
- {
- return is_1_face_vertical(p.row(), p.col());
- }
-
-
- inline
- bool is_1_face_vertical(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return is_1_face(row, col) && row % 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
deleted file mode 100644
index 4b40475..0000000
--- a/milena/mln/world/k1/is_2_face.hh
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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);
-
-
- /// \overload
- bool is_2_face(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_2_face(const point2d& p)
- {
- return is_2_face(p.row(), p.col());
- }
-
- bool is_2_face(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return internal::face_dim(row, col) == 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
index 38639cc..7a57c64 100644
--- a/milena/mln/world/k1/is_primary_face.hh
+++ b/milena/mln/world/k1/is_primary_face.hh
@@ -31,7 +31,7 @@
# define MLN_WORLD_K1_IS_PRIMARY_FACE_HH
# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
+# include <mln/world/kn/is_2_face.hh>
namespace mln
@@ -60,14 +60,14 @@ namespace mln
inline
bool is_primary_face(const point2d& p)
{
- return is_2_face(p);
+ return kn::is_2_face(p);
}
inline
bool is_primary_face(const mln::def::coord& row,
const mln::def::coord& col)
{
- return is_2_face(row, col);
+ return kn::is_2_face(row, col);
}
diff --git a/milena/mln/world/k1/un_immerse.hh b/milena/mln/world/k1/un_immerse.hh
index 8506f56..767e4f5 100644
--- a/milena/mln/world/k1/un_immerse.hh
+++ b/milena/mln/world/k1/un_immerse.hh
@@ -32,9 +32,8 @@
# define MLN_WORLD_K1_UN_IMMERSE_HH
# include <mln/core/concept/image.hh>
-# include <mln/core/concept/box.hh>
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
+# include <mln/world/kn/un_immerse.hh>
+
namespace mln
{
@@ -51,66 +50,57 @@ namespace mln
-1 0 1 2 3
-1 . - . - . 0 1
- 0 | o | o | 0 o o
- 1 . - . - . -> 1 o o
- 2 | o | o |
+ 0 | a | b | 0 a b
+ 1 . - . - . -> 1 c d
+ 2 | c | d |
3 . - . - .
\endverbatim
*/
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ un_immerse(const Image<I>& ima, const V& new_value_type);
+
+ /// \overload
template <typename I>
- mln_concrete(I) un_immerse(const Image<I>& ima);
+ mln_concrete(I)
+ un_immerse(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
- namespace internal
- {
-
- /// Return the equivalent point in K1 from a point in K0.
- inline
- point2d un_immerse_point(const point2d& p)
- {
- point2d tmp(p.row() / 2, p.col() / 2);
- return tmp;
- }
- /// \brief Return the equivalent domain in K0 from a domain in
- /// K1.
- template <typename B>
- inline
- B domain_K0_from_K1(const Box<B>& b_)
- {
- mln_precondition(exact(b_).is_valid());
- const B& b = exact(b_);
- return B(un_immerse_point(b.pmin()), un_immerse_point(b.pmax()));
- }
-
- } // end of namespace mln::world::k1::internal
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ un_immerse(const Image<I>& ima_, const V& new_value_type)
+ {
+ trace::entering("mln::world::k1::un_immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+ mln_ch_value(I,V) output = kn::un_immerse(ima, 2, new_value_type);
+ trace::exiting("mln::world::k1::un_immerse");
+ return output;
+ }
- // Facade
template <typename I>
- mln_concrete(I) un_immerse(const Image<I>& ima_)
+ mln_concrete(I)
+ un_immerse(const Image<I>& ima_)
{
trace::entering("mln::world::k1::un_immerse");
mln_precondition(exact(ima_).is_valid());
const I& ima = exact(ima_);
- mln_concrete(I) output(internal::domain_K0_from_K1(ima.domain()));
-
- mln_piter(I) p(ima.domain());
- for_all(p)
- if (is_2_face(p))
- output(internal::un_immerse_point(p)) = ima(p);
+ mln_concrete(I) output = kn::un_immerse(ima, 1);
trace::exiting("mln::world::k1::un_immerse");
return output;
}
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::world::k1
diff --git a/milena/mln/world/k2/fill_0_from_1_faces.hh
b/milena/mln/world/k2/fill_0_from_1_faces.hh
deleted file mode 100644
index 5f4830e..0000000
--- a/milena/mln/world/k2/fill_0_from_1_faces.hh
+++ /dev/null
@@ -1,114 +0,0 @@
-// 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 Fill 1 faces in a K2 2D image using its 2 faces.
-
-#ifndef MLN_WORLD_K2_FILL_0_FROM_1_FACES_HH
-# define MLN_WORLD_K2_FILL_0_FROM_1_FACES_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_0_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /*! \brief Fill 1 faces in a K2 2D image using its 2 faces.
-
- \param[in,out] inout A 2D image immersed in K2.
- \param[in,out] accu An accumulator.
-
- This function use the following neighborhoods:
-
- * In case of vertical 1 faces:
-
- \verbatim
- x | x
- \endverbatim
-
- * In case of horizontal 1 face:
-
- \verbatim
- x
- -
- x
- \endverbatim
-
- */
- template <typename I, typename A>
- void fill_0_from_1_faces(Image<I>& inout,
- const Accumulator<A>& accu);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
-
- template <typename I, typename A>
- void fill_0_from_1_faces(Image<I>& inout_,
- const Accumulator<A>& accu_)
- {
- trace::entering("mln::world::k2::fill_0_from_1_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- (void) accu_;
-
- A accu = A();
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (k1::is_0_face(p))
- {
- accu.init();
- accu.take(inout(p + left));
- accu.take(inout(p + right));
- accu.take(inout(p + up));
- accu.take(inout(p + down));
- inout(p) = accu.to_result();
- }
-
- trace::exiting("mln::world::k2::fill_0_from_1_faces");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_FILL_0_FROM_1_FACES_HH
diff --git a/milena/mln/world/k2/fill_1_from_2_faces.hh
b/milena/mln/world/k2/fill_1_from_2_faces.hh
deleted file mode 100644
index 5e242d2..0000000
--- a/milena/mln/world/k2/fill_1_from_2_faces.hh
+++ /dev/null
@@ -1,118 +0,0 @@
-// 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 Fill 1 faces in a K2 2D image using its 2 faces.
-
-#ifndef MLN_WORLD_K2_FILL_1_FROM_2_FACES_HH
-# define MLN_WORLD_K2_FILL_1_FROM_2_FACES_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_1_face_vertical.hh>
-# include <mln/world/k1/is_1_face_horizontal.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /*! \brief Fill 1 faces in a K2 2D image using its 2 faces.
-
- \param[in,out] inout A 2D image immersed in K2.
- \param[in,out] accu An accumulator.
-
- This function use the following neighborhoods:
-
- * In case of vertical 1 faces:
-
- \verbatim
- x | x
- \endverbatim
-
- * In case of horizontal 1 face:
-
- \verbatim
- x
- -
- x
- \endverbatim
-
- */
- template <typename I, typename A>
- void fill_1_from_2_faces(Image<I>& inout, const Accumulator<A>&
accu);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
-
- template <typename I, typename A>
- void fill_1_from_2_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
- {
- trace::entering("mln::world::k2::fill_1_from_2_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- (void) accu_;
-
- A accu = A();
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (k1::is_1_face_vertical(p))
- {
- accu.init();
- accu.take(inout(p + left));
- accu.take(inout(p + right));
- inout(p) = accu.to_result();
- }
- else if (k1::is_1_face_horizontal(p))
- {
- accu.init();
- accu.take(inout(p + up));
- accu.take(inout(p + down));
- inout(p) = accu.to_result();
- }
-
- trace::exiting("mln::world::k2::fill_1_from_2_faces");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_FILL_1_FROM_2_FACES_HH
diff --git a/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
b/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
new file mode 100644
index 0000000..b97a645
--- /dev/null
+++ b/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
@@ -0,0 +1,197 @@
+// 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 Fill 1 faces in a K2 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_K2_FILL_NON_PRIMARY_FROM_PRIMARY_2_FACES_HH
+# define MLN_WORLD_K2_FILL_NON_PRIMARY_FROM_PRIMARY_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k2/is_non_primary_2_face_vertical.hh>
+# include <mln/world/k2/is_non_primary_2_face_horizontal.hh>
+# include <mln/world/k2/is_non_primary_2_face_center.hh>
+# include <mln/world/kn/safe_cast.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /*! \brief Fill non-primary 2-faces in a K2 2D image using
+ * primary 2-faces.
+
+ \param[in,out] ima A 2D image immersed in K2.
+ \param[in,out] accu An accumulator.
+
+ This function use the following neighborhoods:
+
+ * In case of vertical non-primary 2-faces:
+
+ \verbatim
+ x o x
+ \endverbatim
+
+ * In case of horizontal non-primary 2-face:
+
+ \verbatim
+ x
+ o
+ x
+ \endverbatim
+
+ * In case of center non-primary 2-face:
+
+ \verbatim
+ x x
+ o
+ x x
+ \endverbatim
+
+ */
+ template <typename I, typename A>
+ void fill_non_primary_from_primary_2_faces(Image<I>& ima,
+ const Accumulator<A>& accu);
+
+
+ /// \overload
+ /*!
+
+ \param[in] f_intermediate The function used with non_primary
+ 2-faces located between two primary
+ 2-faces.
+
+ \param[in] f_center The function used with non_primary 2-faces
+ located the middle of four other
+ non-primary 2-faces.
+ */
+ template <typename I, typename F2, typename F4>
+ void fill_non_primary_from_primary_2_faces(Image<I>& ima,
+ const Function_vv2v<F2>& f_intermediate,
+ const Function_vvvv2v<F4>& f_center);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ template <typename I, typename F2, typename F4>
+ void fill_non_primary_from_primary_2_faces(Image<I>& ima_,
+ const Function_vv2v<F2>& f_intermediate_,
+ const Function_vvvv2v<F4>& f_center_)
+ {
+ trace::entering("mln::world::k2::fill_non_primary_from_primary_2_faces");
+
+ mln_precondition(exact(ima_).is_valid());
+ I& ima = exact(ima_);
+ const F2& f_intermediate = exact(f_intermediate_);
+ const F4& f_center = exact(f_center_);
+
+ typedef mln_argument(F2) V2;
+ typedef mln_argument(F4) V4;
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ if (is_non_primary_2_face_vertical(p))
+ {
+ ima(p) = kn::safe_cast(
+ f_intermediate(kn::safe_cast_to<V2>(ima(p + 2 * left)),
+ kn::safe_cast_to<V2>(ima(p + 2 * right))));
+ }
+ else if (is_non_primary_2_face_horizontal(p))
+ {
+ ima(p) = kn::safe_cast(
+ f_intermediate(kn::safe_cast_to<V2>(ima(p + 2 * up)),
+ kn::safe_cast_to<V2>(ima(p + 2 * down))));
+ }
+ else if (is_non_primary_2_face_center(p))
+ {
+ ima(p) = kn::safe_cast(
+ f_center(kn::safe_cast_to<V4>(ima(p + 2 * up_left)),
+ kn::safe_cast_to<V4>(ima(p + 2 * up_right)),
+ kn::safe_cast_to<V4>(ima(p + 2 * down_left)),
+ kn::safe_cast_to<V4>(ima(p + 2 * down_right))));
+ }
+
+ trace::exiting("mln::world::k2::fill_non_primary_from_primary_2_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_non_primary_from_primary_2_faces(Image<I>& ima_,
+ const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k2::fill_non_primary_from_primary_2_faces");
+
+ mln_precondition(exact(ima_).is_valid());
+ I& ima = exact(ima_);
+ A accu = exact(accu_);
+
+ typedef mln_argument(A) V;
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ if (is_non_primary_2_face_vertical(p))
+ {
+ accu.init();
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * left)));
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * right)));
+ ima(p) = kn::safe_cast(accu.to_result());
+ }
+ else if (is_non_primary_2_face_horizontal(p))
+ {
+ accu.init();
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * up)));
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * down)));
+ ima(p) = kn::safe_cast(accu.to_result());
+ }
+ else if (is_non_primary_2_face_center(p))
+ {
+ accu.init();
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * up_left)));
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * up_right)));
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * down_left)));
+ accu.take(kn::safe_cast_to<V>(ima(p + 2 * down_right)));
+ ima(p) = kn::safe_cast(accu.to_result());
+ }
+
+ trace::exiting("mln::world::k2::fill_non_primary_from_primary_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_FILL_NON_PRIMARY_FROM_PRIMARY_2_FACES_HH
diff --git a/milena/mln/world/k2/fill_non_primary_from_primary_faces.hh
b/milena/mln/world/k2/fill_non_primary_from_primary_faces.hh
deleted file mode 100644
index 41d15cc..0000000
--- a/milena/mln/world/k2/fill_non_primary_from_primary_faces.hh
+++ /dev/null
@@ -1,217 +0,0 @@
-// 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 Fill 1 faces in a K2 2D image using its 2 faces.
-
-#ifndef MLN_WORLD_K2_FILL_NON_PRIMARY_FROM_PRIMARY_FACES_HH
-# define MLN_WORLD_K2_FILL_NON_PRIMARY_FROM_PRIMARY_FACES_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k2/is_non_primary_face_vertical.hh>
-# include <mln/world/k2/is_non_primary_face_horizontal.hh>
-# include <mln/world/k2/is_non_primary_face_cross.hh>
-# include <mln/world/k2/converters.hh>
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /*! \brief Fill non-primary 2-faces in a K2 2D image using
- * primary 2-faces.
-
- \param[in,out] inout A 2D image immersed in K2.
- \param[in,out] accu An accumulator.
-
- This function use the following neighborhoods:
-
- * In case of vertical non-primary 2-faces:
-
- \verbatim
- x o x
- \endverbatim
-
- * In case of horizontal non-primary 2-face:
-
- \verbatim
- x
- o
- x
- \endverbatim
-
- * In case of cross non-primary 2-face:
-
- \verbatim
- x x
- o
- x x
- \endverbatim
-
- */
- template <typename I, typename A, typename F>
- void fill_non_primary_from_primary_faces(Image<I>& inout_,
- Accumulator<A>& accu_,
- const F& converter);
- /// \overload
- template <typename I, typename A, typename F>
- void fill_non_primary_from_primary_faces(Image<I>& inout,
- const Accumulator<A>& accu,
- const F& converter);
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- template <typename I, typename A, typename F>
- void fill_non_primary_from_primary_faces(Image<I>& inout_,
- F& functor_,
- const F& converter_)
- {
- trace::entering("mln::world::k2::fill_non_primary_from_primary_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- typedef typename A::argument V;
-
- const F& converter = exact(converter_);
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_non_primary_face_vertical(p))
- {
- V tmp1, tmp2;
-
- tmp1 = converter(inout(p + 2 * left));
- tmp2 = converter(inout(p + 2 * right));
- converter(f(tmp1, tmp2), inout(p));
- }
- else if (is_non_primary_face_horizontal(p))
- {
- V tmp1, tmp2;
-
- tmp1 = converter(inout(p + 2 * up));
- tmp2 = converter(inout(p + 2 * down));
- converter(f(tmp1, tmp2), inout(p));
- }
- else if (is_non_primary_face_cross(p))
- {
- V tmp1, tmp2, tmp3, tmp4;
-
- tmp1 = converter(inout(p + 2 * up_left));
- tmp2 = converter(inout(p + 2 * up_right));
- tmp3 = converter(inout(p + 2 * down_left));
- tmp4 = converter(inout(p + 2 * down_right));
- converter(f(tmp1, tmp2, tmp3, tmp4), inout(p));
- }
-
- trace::exiting("mln::world::k2::fill_non_primary_from_primary_faces");
- }
-
-
- template <typename I, typename A, typename F>
- void fill_non_primary_from_primary_faces(Image<I>& inout_,
- Accumulator<A>& accu_,
- const F& converter_)
- {
- trace::entering("mln::world::k2::fill_non_primary_from_primary_faces");
-
- mln_precondition(exact(inout_).is_valid());
- I& inout = exact(inout_);
- (void) accu_;
- typedef typename A::argument V;
-
- A& accu = exact(accu_);
- const F& converter = exact(converter_);
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (is_non_primary_face_vertical(p))
- {
- accu.init();
- V tmp;
-
- tmp = converter(inout(p + 2 * left));
- accu.take(tmp);
-
- tmp = converter(inout(p + 2 * right));
- accu.take(tmp);
-
- inout(p) = converter(accu.to_result());
- }
- else if (is_non_primary_face_horizontal(p))
- {
- accu.init();
- V tmp;
-
- tmp = converter(inout(p + 2 * up));
- accu.take(tmp);
-
- tmp = converter(inout(p + 2 * down));
- accu.take(tmp);
-
- inout(p) = converter(accu.to_result());
- }
- else if (is_non_primary_face_cross(p))
- {
- accu.init();
- V tmp;
-
- tmp = converter(inout(p + 2 * up_left));
- accu.take(tmp);
-
- tmp = converter(inout(p + 2 * up_right));
- accu.take(tmp);
-
- tmp = converter(inout(p + 2 * down_left));
- accu.take(tmp);
-
- tmp = converter(inout(p + 2 * down_right));
- accu.take(tmp);
-
- inout(p) = converter(accu.to_result());
- }
-
- trace::exiting("mln::world::k2::fill_non_primary_from_primary_faces");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_FILL_NON_PRIMARY_FROM_PRIMARY_FACES_HH
diff --git a/milena/mln/world/k2/immerse.hh b/milena/mln/world/k2/immerse.hh
index eb6ba30..af3c18d 100644
--- a/milena/mln/world/k2/immerse.hh
+++ b/milena/mln/world/k2/immerse.hh
@@ -31,8 +31,7 @@
# define MLN_WORLD_K2_IMMERSE_HH
# include <mln/core/concept/image.hh>
-# include <mln/core/concept/box.hh>
-# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/immerse.hh>
namespace mln
{
@@ -45,72 +44,86 @@ namespace mln
/*! \brief Immerse a 2D image into K2.
- \verbatim
+ \param[in] ima A 2D image.
+ \param[in] new_value_type An instance of the value type used
+ in the resulting immersed image.
- -1 0 1 2 3
- 0 1 -1 . - . - .
- 0 o o 0 | o | o |
- 1 o o -> 1 . - . - .
- 2 | o | o |
- 3 . - . - .
+ \return A 2D image immersed in K2 of type \tparam V.
+ \verbatim
+ -1 0 1 2 3 4 5 6 7
+ 0 1 -1 . - . - . - . - .
+ 0 a b 0 | a | | b | |
+ 1 c d -> 1 . - . - . - . - .
+ 2 | | | | |
+ 3 . - . - . - . - .
+ 4 | c | | d | |
+ 5 . - . - . - . - .
+ 6 | | | | |
+ 7 . - . - . - . - .
\endverbatim
*/
+ template <typename I, typename V>
+ mln_ch_value(I, V)
+ immerse(const Image<I>& ima, const V& new_value_type);
+
+ /// \overload
template <typename I>
- mln_concrete(I) immerse(const Image<I>& ima);
+ mln_concrete(I)
+ immerse(const Image<I>& ima);
+
+ /// \overload
+ /// 0, 1 and non-primary 2-faces values are set to \p
+ /// default_value.
+ template <typename I, typename V>
+ mln_ch_value(I, V)
+ immerse(const Image<I>& ima, const V& new_value_type,
+ const V& default_value);
# ifndef MLN_INCLUDE_ONLY
- namespace internal
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ immerse(const Image<I>& ima, const V& new_value_type)
{
+ trace::entering("mln::world::k2::immerse");
+ mln_precondition(exact(ima).is_valid());
- /// Return the equivalent point in K2 from a point in K0.
- inline
- point2d immerse_point(const point2d& p)
- {
- point2d tmp(4 * p.row(), 4 * p.col());
- return tmp;
- }
+ mln_ch_value(I,V)
+ output = kn::immerse(ima, 2, new_value_type);
- /// \brief Return the equivalent domain in K2 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_);
+ trace::exiting("mln::world::k2::immerse");
+ return output;
+ }
- mln_deduce(B, site, delta) one;
- one.set_all(1);
- return B(immerse_point(b.pmin()) - one, immerse_point(b.pmax()) + one);
- }
- } // end of namespace mln::world::k2::internal
+ template <typename I>
+ mln_concrete(I)
+ immerse(const Image<I>& ima)
+ {
+ trace::entering("mln::world::k2::immerse");
+ mln_precondition(exact(ima).is_valid());
+ mln_concrete(I)
+ output = kn::immerse(ima, 2);
+ trace::exiting("mln::world::k2::immerse");
+ return output;
+ }
- // Facade
- template <typename I>
- mln_concrete(I) immerse(const Image<I>& ima_)
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ immerse(const Image<I>& ima, const V& new_value_type,
+ const V& default_value)
{
trace::entering("mln::world::k2::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);
- output(internal::immerse_point(p) + 2 * right) = ima(p);
- output(internal::immerse_point(p) + 2 * down) = ima(p);
- output(internal::immerse_point(p) + 2 * down_right) = ima(p);
- }
+ mln_precondition(exact(ima).is_valid());
+
+ mln_ch_value(I,V)
+ output = kn::immerse(ima, 2, new_value_type, default_value);
trace::exiting("mln::world::k2::immerse");
return output;
diff --git a/milena/mln/world/k2/immerse_with.hh b/milena/mln/world/k2/immerse_with.hh
deleted file mode 100644
index bc8e8ad..0000000
--- a/milena/mln/world/k2/immerse_with.hh
+++ /dev/null
@@ -1,173 +0,0 @@
-// 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 K2.
-
-#ifndef MLN_WORLD_K2_IMMERSE_HH
-# define MLN_WORLD_K2_IMMERSE_HH
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/box.hh>
-# include <mln/core/alias/point2d.hh>
-# include <mln/value/interval.hh>
-# include <mln/fun/vv2v/span.hh>
-# include <mln/fun/vvvv2v/span.hh>
-
-# include <mln/world/k1/fill_0_from_1_faces.hh>
-# include <mln/world/k1/fill_1_from_2_faces.hh>
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /*! \brief Immerse a 2D image into K2.
-
- \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
- {
-
- /// Return the equivalent point in K2 from a point in K0.
- inline
- point2d immerse_point(const point2d& p)
- {
- point2d tmp(4 * p.row(), 4 * p.col());
- return tmp;
- }
-
- /// \brief Return the equivalent domain in K2 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(immerse_point(b.pmin()) - one, immerse_point(b.pmax()) + one);
- }
-
- } // end of namespace mln::world::k2::internal
-
-
-
- // Facade
-
- template <typename I, typename F2, typename F4>
- mln_ch_value(I, value::interval<mln_result(F4)>)
- immerse_with(const Image<I>& ima_,
- Function_vv2v<F2>& f2_, Function_vvvv2v<F4>& f4_)
- {
- trace::entering("mln::world::k2::immerse_with");
- mln_precondition(exact(ima_).is_valid());
- const I& ima = exact(ima_);
- const F2& f2 = exact(f2_);
- const F4& f4 = exact(f4_);
-
- // FIXME: how to initialize the border... ?
- // border::fill(ima, 0);
-
- typedef mln_result(F4) V;
- typedef value::interval<V> VOUT;
- mln_ch_value(I,VOUT)
- output(internal::domain_from_K0(ima.domain()));
-
- // Filling 2-Faces
- mln_piter(I) p(ima.domain());
- for_all(p)
- {
- // .-.-
- // ab |x|*| -> a
- // cd -> .-.-.
- // |*|*|
- // .-.-.
- output(internal::immerse_point(p)) = ima(p);
-
- // .-.-
- // ab |*|x| -> f2(a,b)
- // cd -> .-.-.
- // |*|*|
- // .-.-.
- output(internal::immerse_point(p) + 2 * right) = f2(ima(p), ima(p + right));
-
- // .-.-
- // ab |*|*|
- // cd -> .-.-.
- // |x|*| -> f2(a,c)
- // .-.-.
- output(internal::immerse_point(p) + 2 * down) = f2(ima(p), ima(p + down));
-
- // .-.-
- // ab |*|*|
- // cd -> .-.-.
- // |*|x| -> f4(a,b,c,d)
- // .-.-.
- output(internal::immerse_point(p) + 2 * down_right)
- = f4(ima(p), ima(p + right), ima(p + down), ima(p + down_right));
- }
-
- fun::vv2v::span<V> span2;
- k1::fill_1_from_2_faces(output, span2);
- fun::vvvv2v::span<V> span4;
- k1::fill_0_from_1_faces(output, span4);
-
- trace::exiting("mln::world::k2::immerse_with");
- return output;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_IMMERSE_HH
diff --git a/milena/mln/world/k2/is_non_primary_2_face.hh
b/milena/mln/world/k2/is_non_primary_2_face.hh
new file mode 100644
index 0000000..d4d7944
--- /dev/null
+++ b/milena/mln/world/k2/is_non_primary_2_face.hh
@@ -0,0 +1,83 @@
+// 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 non-primary face.
+
+#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_HH
+# define MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_2_face.hh>
+# include <mln/world/k2/is_primary_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /// \brief Check if site is a non-primary face
+ bool is_non_primary_2_face(const point2d& p);
+
+
+ /// \overload
+ bool is_non_primary_2_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_non_primary_2_face(const point2d& p)
+ {
+ return is_non_primary_2_face(p.row(), p.col());
+ }
+
+ inline
+ bool is_non_primary_2_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return kn::is_2_face(row, col) && !is_primary_2_face(row, col);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_HH
diff --git a/milena/mln/world/k2/is_non_primary_2_face_center.hh
b/milena/mln/world/k2/is_non_primary_2_face_center.hh
new file mode 100644
index 0000000..79d5d37
--- /dev/null
+++ b/milena/mln/world/k2/is_non_primary_2_face_center.hh
@@ -0,0 +1,88 @@
+// 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 center non-primary face.
+
+#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_CENTER_HH
+# define MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_CENTER_HH
+
+# include <mln/core/alias/point2d.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /// \brief Check if site is a center non-primary face
+ ///
+ /// |a| |b|
+ /// .-.-.-.
+ /// | |x| |
+ /// .-.-.-.
+ /// |c| |d|
+ ///
+ bool is_non_primary_2_face_center(const point2d& p);
+
+
+ /// \overload
+ bool is_non_primary_2_face_center(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_non_primary_2_face_center(const point2d& p)
+ {
+ return is_non_primary_2_face_center(p.row(), p.col());
+ }
+
+ inline
+ bool is_non_primary_2_face_center(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return (row % 4 == 2) && (col % 4 == 2);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_CENTER_HH
diff --git a/milena/mln/world/k2/is_non_primary_2_face_horizontal.hh
b/milena/mln/world/k2/is_non_primary_2_face_horizontal.hh
new file mode 100644
index 0000000..d55ce1a
--- /dev/null
+++ b/milena/mln/world/k2/is_non_primary_2_face_horizontal.hh
@@ -0,0 +1,82 @@
+// 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 horizontal non-primary face.
+
+#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_HORIZONTAL_HH
+# define MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_HORIZONTAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k2/is_non_primary_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /// \brief Check if site is a horizontal non-primary face
+ bool is_non_primary_2_face_horizontal(const point2d& p);
+
+
+ /// \overload
+ bool is_non_primary_2_face_horizontal(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_non_primary_2_face_horizontal(const point2d& p)
+ {
+ return is_non_primary_2_face_horizontal(p.row(), p.col());
+ }
+
+ inline
+ bool is_non_primary_2_face_horizontal(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_non_primary_2_face(row, col) && ! (col % 4);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_HORIZONTAL_HH
diff --git a/milena/mln/world/k2/is_non_primary_2_face_vertical.hh
b/milena/mln/world/k2/is_non_primary_2_face_vertical.hh
new file mode 100644
index 0000000..b89e304
--- /dev/null
+++ b/milena/mln/world/k2/is_non_primary_2_face_vertical.hh
@@ -0,0 +1,82 @@
+// 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 vertical non-primary face.
+
+#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_VERTICAL_HH
+# define MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_VERTICAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k2/is_non_primary_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /// \brief Check if site is a vertical non-primary face
+ bool is_non_primary_2_face_vertical(const point2d& p);
+
+
+ /// \overload
+ bool is_non_primary_2_face_vertical(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_non_primary_2_face_vertical(const point2d& p)
+ {
+ return is_non_primary_2_face_vertical(p.row(), p.col());
+ }
+
+ inline
+ bool is_non_primary_2_face_vertical(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_non_primary_2_face(row, col) && ! (row % 4);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_VERTICAL_HH
diff --git a/milena/mln/world/k2/is_non_primary_face.hh
b/milena/mln/world/k2/is_non_primary_face.hh
deleted file mode 100644
index 2088040..0000000
--- a/milena/mln/world/k2/is_non_primary_face.hh
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 non-primary face.
-
-#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_FACE_HH
-# define MLN_WORLD_K2_IS_NON_PRIMARY_FACE_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
-# include <mln/world/k2/is_primary_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /// \brief Check if site is a non-primary face
- bool is_non_primary_face(const point2d& p);
-
-
- /// \overload
- bool is_non_primary_face(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_non_primary_face(const point2d& p)
- {
- return is_non_primary_face(p.row(), p.col());
- }
-
- inline
- bool is_non_primary_face(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return k1::is_2_face(row, col) && !is_primary_face(row, col);
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_FACE_HH
diff --git a/milena/mln/world/k2/is_non_primary_face_cross.hh
b/milena/mln/world/k2/is_non_primary_face_cross.hh
deleted file mode 100644
index fad4c23..0000000
--- a/milena/mln/world/k2/is_non_primary_face_cross.hh
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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 cross non-primary face.
-
-#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_FACE_CROSS_HH
-# define MLN_WORLD_K2_IS_NON_PRIMARY_FACE_CROSS_HH
-
-# include <mln/core/alias/point2d.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /// \brief Check if site is a cross non-primary face
- ///
- /// |a| |b|
- /// .-.-.-.
- /// | |x| |
- /// .-.-.-.
- /// |c| |d|
- ///
- bool is_non_primary_face_cross(const point2d& p);
-
-
- /// \overload
- bool is_non_primary_face_cross(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_non_primary_face_cross(const point2d& p)
- {
- return is_non_primary_face_cross(p.row(), p.col());
- }
-
- inline
- bool is_non_primary_face_cross(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return (row % 4 == 2) && (col % 4 == 2);
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_FACE_CROSS_HH
diff --git a/milena/mln/world/k2/is_non_primary_face_horizontal.hh
b/milena/mln/world/k2/is_non_primary_face_horizontal.hh
deleted file mode 100644
index 3a65995..0000000
--- a/milena/mln/world/k2/is_non_primary_face_horizontal.hh
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 horizontal non-primary face.
-
-#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_FACE_HORIZONTAL_HH
-# define MLN_WORLD_K2_IS_NON_PRIMARY_FACE_HORIZONTAL_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
-# include <mln/world/k2/is_non_primary_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /// \brief Check if site is a horizontal non-primary face
- bool is_non_primary_face_horizontal(const point2d& p);
-
-
- /// \overload
- bool is_non_primary_face_horizontal(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_non_primary_face_horizontal(const point2d& p)
- {
- return is_non_primary_face_horizontal(p.row(), p.col());
- }
-
- inline
- bool is_non_primary_face_horizontal(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return is_non_primary_face(row, col) && ! (col % 4);
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_FACE_HORIZONTAL_HH
diff --git a/milena/mln/world/k2/is_non_primary_face_vertical.hh
b/milena/mln/world/k2/is_non_primary_face_vertical.hh
deleted file mode 100644
index 5fd2d24..0000000
--- a/milena/mln/world/k2/is_non_primary_face_vertical.hh
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 vertical non-primary face.
-
-#ifndef MLN_WORLD_K2_IS_NON_PRIMARY_FACE_VERTICAL_HH
-# define MLN_WORLD_K2_IS_NON_PRIMARY_FACE_VERTICAL_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
-# include <mln/world/k2/is_non_primary_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /// \brief Check if site is a vertical non-primary face
- bool is_non_primary_face_vertical(const point2d& p);
-
-
- /// \overload
- bool is_non_primary_face_vertical(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_non_primary_face_vertical(const point2d& p)
- {
- return is_non_primary_face_vertical(p.row(), p.col());
- }
-
- inline
- bool is_non_primary_face_vertical(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return is_non_primary_face(row, col) && ! (row % 4);
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_IS_NON_PRIMARY_FACE_VERTICAL_HH
diff --git a/milena/mln/world/k2/is_primary_2_face.hh
b/milena/mln/world/k2/is_primary_2_face.hh
new file mode 100644
index 0000000..cd90bac
--- /dev/null
+++ b/milena/mln/world/k2/is_primary_2_face.hh
@@ -0,0 +1,81 @@
+// 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_K2_IS_PRIMARY_2_FACE_HH
+# define MLN_WORLD_K2_IS_PRIMARY_2_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /// \brief Check if site is a primary face
+ bool is_primary_2_face(const point2d& p);
+
+
+ /// \overload
+ bool is_primary_2_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_primary_2_face(const point2d& p)
+ {
+ return is_primary_2_face(p.row(), p.col());
+ }
+
+ inline
+ bool is_primary_2_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return !((row % 4) + (col % 4));
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_IS_PRIMARY_2_FACE_HH
diff --git a/milena/mln/world/k2/is_primary_face.hh
b/milena/mln/world/k2/is_primary_face.hh
deleted file mode 100644
index 033c7a4..0000000
--- a/milena/mln/world/k2/is_primary_face.hh
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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_K2_IS_PRIMARY_FACE_HH
-# define MLN_WORLD_K2_IS_PRIMARY_FACE_HH
-
-# include <mln/core/alias/point2d.hh>
-# include <mln/world/k1/is_2_face.hh>
-
-
-namespace mln
-{
-
- namespace world
- {
-
- namespace k2
- {
-
- /// \brief Check if site is a primary face
- bool is_primary_face(const point2d& p);
-
-
- /// \overload
- bool is_primary_face(const mln::def::coord& row,
- const mln::def::coord& col);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- // Facade
-
- inline
- bool is_primary_face(const point2d& p)
- {
- return is_primary_face(p.row(), p.col());
- }
-
- inline
- bool is_primary_face(const mln::def::coord& row,
- const mln::def::coord& col)
- {
- return !((row % 4) + (col % 4));
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::world::k2
-
- } // end of namespace mln::world
-
-} // end of namespace mln
-
-#endif // ! MLN_WORLD_K2_IS_PRIMARY_FACE_HH
diff --git a/milena/mln/world/k2/un_immerse.hh b/milena/mln/world/k2/un_immerse.hh
new file mode 100644
index 0000000..3f05ac0
--- /dev/null
+++ b/milena/mln/world/k2/un_immerse.hh
@@ -0,0 +1,114 @@
+// 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 Un-immerse a 2D image from K2 to K0.
+
+
+#ifndef MLN_WORLD_K2_UN_IMMERSE_HH
+# define MLN_WORLD_K2_UN_IMMERSE_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/world/kn/un_immerse.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k2
+ {
+
+ /*! \brief Un-immerse a 2D image from K2 to K0.
+
+ \verbatim
+ -1 0 1 2 3 4 5 6 7
+ -1 . - . - . - . - .
+ 0 | a | | b | |
+ 1 . - . - . - . - . 0 1
+ 2 | | | | | 0 a b
+ 3 . - . - . - . - . -> 1 c d
+ 4 | c | | d | |
+ 5 . - . - . - . - .
+ 6 | | | | |
+ 7 . - . - . - . - .
+ \endverbatim
+
+ */
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ un_immerse(const Image<I>& ima, const V& new_value_type);
+
+ /// \overload
+ template <typename I>
+ mln_concrete(I)
+ un_immerse(const Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ un_immerse(const Image<I>& ima_, const V& new_value_type)
+ {
+ trace::entering("mln::world::k2::un_immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_ch_value(I,V) output = k2::un_immerse(ima, 2, new_value_type);
+
+ trace::exiting("mln::world::k2::un_immerse");
+ return output;
+ }
+
+
+ template <typename I>
+ mln_concrete(I)
+ un_immerse(const Image<I>& ima_)
+ {
+ trace::entering("mln::world::k2::un_immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_concrete(I) output = kn::un_immerse(ima, 2);
+
+ trace::exiting("mln::world::k2::un_immerse");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k2
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K2_UN_IMMERSE_HH
+
diff --git a/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
b/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
new file mode 100644
index 0000000..7324a34
--- /dev/null
+++ b/milena/mln/world/kn/fill_0_1_faces_internal_border.hh
@@ -0,0 +1,103 @@
+// 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 Fill 0 and 1 faces border with a value in a KN 2D image.
+
+#ifndef MLN_WORLD_KN_FILL_0_1_FACES_INTERNAL_BORDER_HH
+# define MLN_WORLD_KN_FILL_0_1_FACES_INTERNAL_BORDER_HH
+
+# include <mln/core/alias/point2d.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Fill 0 and 1 faces border with a value in a KN 2D image.
+
+ \param[in,out] inout A 2D image immersed in KN.
+ \param[in] v The border value.
+
+ Example with \p v=1:
+
+ . - . - . 1 1 1 1 1
+ | o | o | 1 o | o 1
+ . - . - . -> 1 - . - 1
+ | o | o | 1 o | o 1
+ . - . - . 1 1 1 1 1
+
+ */
+ template <typename I>
+ void fill_0_1_faces_internal_border(Image<I>& inout, const
mln_value(I)& v);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I>
+ void fill_0_1_faces_internal_border(Image<I>& inout_, const
mln_value(I)& v)
+ {
+ trace::entering("mln::world::kn::fill_0_1_faces_internal_border");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+
+ // Horizontal borders
+ for (mln::def::coord col = geom::min_col(inout); col <= geom::max_col(inout); ++col)
+ {
+ inout.at_(geom::min_row(inout), col) = v;
+ inout.at_(geom::max_row(inout), col) = v;
+ }
+
+ // Vertical borders
+ for (mln::def::coord row = geom::min_row(inout); row <= geom::max_row(inout); ++row)
+ {
+ inout.at_(row, geom::min_col(inout)) = v;
+ inout.at_(row, geom::max_col(inout)) = v;
+ }
+
+ trace::exiting("mln::world::kn::fill_0_1_faces_internal_border");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FILL_0_1_FACES_INTERNAL_BORDER_HH
diff --git a/milena/mln/world/kn/fill_0_from_1_faces.hh
b/milena/mln/world/kn/fill_0_from_1_faces.hh
new file mode 100644
index 0000000..43b5096
--- /dev/null
+++ b/milena/mln/world/kn/fill_0_from_1_faces.hh
@@ -0,0 +1,114 @@
+// 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 Fill 1 faces in a Kn 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_KN_FILL_0_FROM_1_FACES_HH
+# define MLN_WORLD_KN_FILL_0_FROM_1_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_0_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Fill 1 faces in a KN 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in KN.
+ \param[in,out] accu An accumulator.
+
+ This function use the following neighborhoods:
+
+ * In case of vertical 1 faces:
+
+ \verbatim
+ x | x
+ \endverbatim
+
+ * In case of horizontal 1 face:
+
+ \verbatim
+ x
+ -
+ x
+ \endverbatim
+
+ */
+ template <typename I, typename A>
+ void fill_0_from_1_faces(Image<I>& inout,
+ const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename A>
+ void fill_0_from_1_faces(Image<I>& inout_,
+ const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::kn::fill_0_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_0_face(p))
+ {
+ accu.init();
+ accu.take(inout(p + left));
+ accu.take(inout(p + right));
+ accu.take(inout(p + up));
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::kn::fill_0_from_1_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FILL_0_FROM_1_FACES_HH
diff --git a/milena/mln/world/kn/fill_0_from_2_faces.hh
b/milena/mln/world/kn/fill_0_from_2_faces.hh
new file mode 100644
index 0000000..47fb230
--- /dev/null
+++ b/milena/mln/world/kn/fill_0_from_2_faces.hh
@@ -0,0 +1,127 @@
+// 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 Fill 1 faces in a KN 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_KN_FILL_0_FROM_2_FACES_HH
+# define MLN_WORLD_KN_FILL_0_FROM_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_0_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Fill 0 faces in a KN 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in KN.
+ \param[in,out] f A functor computing a result from four values.
+
+ This function use the following neighborhood:
+
+ \verbatim
+ x x
+ .
+ x x
+ \endverbatim
+
+
+ */
+ template <typename I, typename F>
+ void fill_0_from_2_faces(Image<I>& inout, Function_vvvv2v<F>&
f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_0_from_2_faces(Image<I>& inout, const Accumulator<A>&
accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_0_from_2_faces(Image<I>& inout_, Function_vvvv2v<F>&
f_)
+ {
+ trace::entering("mln::world::kn::fill_0_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_0_face(p))
+ inout(p) = f(inout(p + up_left), inout(p + up_right), inout(p + down_left), inout(p
+ down_right));
+
+ trace::exiting("mln::world::kn::fill_0_from_2_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_0_from_2_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::kn::fill_0_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_0_face(p))
+ {
+ accu.init();
+ accu.take(inout(p + up_left));
+ accu.take(inout(p + up_right));
+ accu.take(inout(p + down_left));
+ accu.take(inout(p + down_right));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::kn::fill_0_from_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FILL_0_FROM_2_FACES_HH
diff --git a/milena/mln/world/kn/fill_1_from_2_faces.hh
b/milena/mln/world/kn/fill_1_from_2_faces.hh
new file mode 100644
index 0000000..b638e81
--- /dev/null
+++ b/milena/mln/world/kn/fill_1_from_2_faces.hh
@@ -0,0 +1,118 @@
+// 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 Fill 1 faces in a Kn 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_KN_FILL_1_FROM_2_FACES_HH
+# define MLN_WORLD_KN_FILL_1_FROM_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Fill 1 faces in a Kn 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in KN.
+ \param[in,out] accu An accumulator.
+
+ This function use the following neighborhoods:
+
+ * In case of vertical 1 faces:
+
+ \verbatim
+ x | x
+ \endverbatim
+
+ * In case of horizontal 1 face:
+
+ \verbatim
+ x
+ -
+ x
+ \endverbatim
+
+ */
+ template <typename I, typename A>
+ void fill_1_from_2_faces(Image<I>& inout, const Accumulator<A>&
accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename A>
+ void fill_1_from_2_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::kn::fill_1_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_1_face_vertical(p))
+ {
+ accu.init();
+ accu.take(inout(p + left));
+ accu.take(inout(p + right));
+ inout(p) = accu.to_result();
+ }
+ else if (is_1_face_horizontal(p))
+ {
+ accu.init();
+ accu.take(inout(p + up));
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::kn::fill_1_from_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FILL_1_FROM_2_FACES_HH
diff --git a/milena/mln/world/kn/fill_1_from_aux_2_faces.hh
b/milena/mln/world/kn/fill_1_from_aux_2_faces.hh
new file mode 100644
index 0000000..eb999cf
--- /dev/null
+++ b/milena/mln/world/kn/fill_1_from_aux_2_faces.hh
@@ -0,0 +1,155 @@
+// 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 Fill 1 faces in a KN 2D image using 2 faces from an
+/// auxiliary image.
+
+#ifndef MLN_WORLD_KN_FILL_1_FROM_AUX_2_FACES_HH
+# define MLN_WORLD_KN_FILL_1_FROM_AUX_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_1_face_vertical.hh>
+# include <mln/world/kn/is_1_face_horizontal.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Fill 1 faces in a KN 2D image using 2 faces from an
+ auxiliary image.
+
+ \param[in,out] inout A 2D image immersed in KN.
+ \param[in] aux A 2D image with the same domain as \p inout.
+ \param[in,out] f A functor computing a result from two values.
+
+ This function use the following neighborhoods:
+
+ * In case of vertical 1 faces:
+
+ \verbatim
+ x | x
+ \endverbatim
+
+ * In case of horizontal 1 face:
+
+ \verbatim
+ x
+ -
+ x
+ \endverbatim
+
+ */
+ template <typename I, typename J, typename F>
+ void fill_1_from_aux_2_faces(Image<I>& inout, const Image<J>&
aux,
+ Function_vv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename J, typename A>
+ void fill_1_from_aux_2_faces(Image<I>& inout, const Image<J>&
aux,
+ const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename J, typename F>
+ void fill_1_from_aux_2_faces(Image<I>& inout_, const Image<J>&
aux_,
+ Function_vv2v<F>& f_)
+ {
+ trace::entering("mln::world::kn::fill_1_from_aux_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ mln_precondition(exact(aux_).is_valid());
+ mln_precondition(exact(inout_).domain() == exact(aux_).domain());
+ I& inout = exact(inout_);
+ const J& aux = exact(aux_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_1_face_vertical(p))
+ inout(p) = f(aux(p + left), aux(p + right));
+ else if (kn::is_1_face_horizontal(p))
+ inout(p) = f(aux(p + up), aux(p + down));
+
+ trace::exiting("mln::world::kn::fill_1_from_aux_2_faces");
+ }
+
+
+ template <typename I, typename J, typename A>
+ void fill_1_from_aux_2_faces(Image<I>& inout_, const Image<J>&
aux_,
+ const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::kn::fill_1_from_aux_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ mln_precondition(exact(aux_).is_valid());
+ mln_precondition(exact(inout_).domain() == exact(aux_).domain());
+ I& inout = exact(inout_);
+ const J& aux = exact(aux_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_1_face_vertical(p))
+ {
+ accu.init();
+ accu.take(aux(p + left));
+ accu.take(aux(p + right));
+ inout(p) = accu.to_result();
+ }
+ else if (kn::is_1_face_horizontal(p))
+ {
+ accu.init();
+ accu.take(aux(p + up));
+ accu.take(aux(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::kn::fill_1_from_aux_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FILL_1_FROM_AUX_2_FACES_HH
diff --git a/milena/mln/world/kn/fill_2_from_1_faces.hh
b/milena/mln/world/kn/fill_2_from_1_faces.hh
new file mode 100644
index 0000000..5887572
--- /dev/null
+++ b/milena/mln/world/kn/fill_2_from_1_faces.hh
@@ -0,0 +1,127 @@
+// 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 Fill 2 faces in a KN 2D image using its 1 faces.
+
+#ifndef MLN_WORLD_KN_FILL_2_FROM_1_FACES_HH
+# define MLN_WORLD_KN_FILL_2_FROM_1_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Fill 0 faces in a KN 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in KN.
+ \param[in,out] f A functor computing a result from four values.
+
+ This function use the following neighborhood:
+
+ \verbatim
+ -
+ |o|
+ -
+ \endverbatim
+
+
+ */
+ template <typename I, typename F>
+ void fill_2_from_1_faces(Image<I>& inout, Function_vvvv2v<F>&
f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_2_from_1_faces(Image<I>& inout, const Accumulator<A>&
accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_2_from_1_faces(Image<I>& inout_, Function_vvvv2v<F>&
f_)
+ {
+ trace::entering("mln::world::kn::fill_2_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_2_face(p))
+ inout(p) = f(inout(p + up), inout(p + left), inout(p + right), inout(p + down));
+
+ trace::exiting("mln::world::kn::fill_2_from_1_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_2_from_1_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::kn::fill_2_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (kn::is_2_face(p))
+ {
+ accu.init();
+ accu.take(inout(p + up));
+ accu.take(inout(p + left));
+ accu.take(inout(p + right));
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::kn::fill_2_from_1_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FILL_2_FROM_1_FACES_HH
diff --git a/milena/mln/world/kn/immerse.hh b/milena/mln/world/kn/immerse.hh
index 835a4a1..8d5f578 100644
--- a/milena/mln/world/kn/immerse.hh
+++ b/milena/mln/world/kn/immerse.hh
@@ -27,20 +27,14 @@
///
/// \brief Immerse a 2D image into Kn.
-#ifndef MLN_WORLD_Kn_IMMERSE_HH
-# define MLN_WORLD_Kn_IMMERSE_HH
+#ifndef MLN_WORLD_KN_IMMERSE_HH
+# define MLN_WORLD_KN_IMMERSE_HH
# include <mln/core/concept/image.hh>
# include <mln/core/concept/box.hh>
-# include <mln/core/alias/point2d.hh>
-# include <mln/value/interval.hh>
-# include <mln/fun/vv2v/span.hh>
-# include <mln/fun/vvvv2v/span.hh>
-# include <mln/world/k1/fill_0_from_1_faces.hh>
-# include <mln/world/k1/fill_1_from_2_faces.hh>
-
-# include <mln/world/k2/converters.hh>
+# include <mln/world/kn/internal/immerse_point.hh>
+# include <mln/world/kn/safe_cast.hh>
namespace mln
{
@@ -55,7 +49,7 @@ namespace mln
\param[in] ima 2D Image in K0.
\param[in] n Set in which space to immerse \p ima (ex: n=1 => k1).
- \param[in] new_type Value type of the immersed image.
+ \param[in] new_value_type Value type of the immersed image.
\return A 2D image immersed in k\p n of value type \tparam V.
@@ -65,17 +59,26 @@ namespace mln
-1 0 1 2 3
0 1 -1 . - . - .
- 0 o o 0 | o | o |
- 1 o o -> 1 . - . - .
- 2 | o | o |
+ 0 a b 0 | a | b |
+ 1 c d -> 1 . - . - .
+ 2 | c | d |
3 . - . - .
\endverbatim
*/
- template <typename I, typename V, typename F>
+ template <typename I, typename V>
+ mln_ch_value(I, V)
+ immerse(const Image<I>& ima, const unsigned n,
+ const V& new_value_type);
+
+ /// \overload
+ /// \param[in] default_value 0, 1 and non-primary 2-faces values
+ /// are initialized with this value.
+ template <typename I, typename V>
mln_ch_value(I, V)
- immerse(const Image<I>& ima_, const unsigned n, const V& new_type,
const F& converter_);
+ immerse(const Image<I>& ima, const unsigned n,
+ const V& new_value_type, const V& default_value);
/// \overload
template <typename I>
@@ -88,14 +91,6 @@ namespace mln
namespace internal
{
- /// Return the equivalent point in Kn from a point in K0.
- inline
- point2d immerse_point(const point2d& p, const unsigned n)
- {
- point2d tmp(std::pow(2u, n) * p.row(), std::pow(2u, n) * p.col());
- return tmp;
- }
-
/// \brief Return the equivalent domain in Kn from a domain in
/// K0.
template <typename B>
@@ -107,25 +102,24 @@ namespace mln
mln_deduce(B, site, delta) one;
one.set_all(1);
- return B(immerse_point(b.pmin(), n) - one, immerse_point(b.pmax(), n) + one);
+ return B(immerse_point(b.pmin(), n) - one,
+ immerse_point(b.pmax(), n) + one);
}
} // end of namespace mln::world::kn::internal
- // Facade
- template <typename I, typename V, typename F>
+ template <typename I, typename V>
mln_ch_value(I, V)
immerse(const Image<I>& ima_, const unsigned n,
- const V& new_type, const F& converter_)
+ const V& new_value_type)
{
- trace::entering("mln::world::kn::immerse_with");
+ trace::entering("mln::world::kn::immerse");
mln_precondition(exact(ima_).is_valid());
const I& ima = exact(ima_);
- const F& converter = exact(converter_);
- (void) new_type;
+ (void) new_value_type;
mln_ch_value(I,V)
output(internal::domain_from_K0(ima.domain(), n));
@@ -133,22 +127,43 @@ namespace mln
// Filling Primary 2-Faces
mln_piter(I) p(ima.domain());
for_all(p)
- {
- V tmp;
- tmp = converter(ima(p));
- output(internal::immerse_point(p, n)) = tmp;
- }
+ output(internal::immerse_point(p, n)) = safe_cast(ima(p));
+
+ trace::exiting("mln::world::kn::immerse");
+ return output;
+ }
+
- trace::exiting("mln::world::kn::immerse_with");
+ template <typename I, typename V>
+ mln_ch_value(I, V)
+ immerse(const Image<I>& ima_, const unsigned n,
+ const V& new_value_type, const V& default_value)
+ {
+ trace::entering("mln::world::kn::immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+ (void) new_value_type;
+
+ mln_ch_value(I,V)
+ output(internal::domain_from_K0(ima.domain(), n));
+ data::fill(output, default_value);
+
+ // Filling Primary 2-Faces
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ output(internal::immerse_point(p, n)) = safe_cast(ima(p));
+
+ trace::exiting("mln::world::kn::immerse");
return output;
}
+
template <typename I>
mln_concrete(I)
immerse(const Image<I>& ima, const unsigned n)
{
typedef mln_value(I) V;
- return immerse(ima, n, V(), k2::generic_converter<V,V>());
+ return immerse(ima, n, V());
}
@@ -160,4 +175,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_WORLD_Kn_IMMERSE_HH
+#endif // ! MLN_WORLD_KN_IMMERSE_HH
diff --git a/milena/mln/world/kn/internal/face_dim.hh
b/milena/mln/world/kn/internal/face_dim.hh
new file mode 100644
index 0000000..105c6cc
--- /dev/null
+++ b/milena/mln/world/kn/internal/face_dim.hh
@@ -0,0 +1,84 @@
+// 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 KN.
+
+#ifndef MLN_WORLD_KN_FACE_DIM_HH
+# define MLN_WORLD_KN_FACE_DIM_HH
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ namespace internal
+ {
+
+ /// \brief Returns the dimension of site in KN.
+ unsigned face_dim(const point2d& p);
+
+ /// \overload
+ unsigned face_dim(const mln::def::coord& row, const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ unsigned face_dim(const point2d& p)
+ {
+ return face_dim(p.row(), p.col());
+ }
+
+ inline
+ unsigned face_dim(const mln::def::coord& row, const mln::def::coord& col)
+ {
+ return (row % 2 == 0) + (col % 2 == 0);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::work::kn::internal
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_FACE_DIM_HH
+
+
diff --git a/milena/mln/world/kn/internal/immerse_point.hh
b/milena/mln/world/kn/internal/immerse_point.hh
new file mode 100644
index 0000000..9dd46c7
--- /dev/null
+++ b/milena/mln/world/kn/internal/immerse_point.hh
@@ -0,0 +1,90 @@
+// 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 corresponding point in Kn from a point in K0.
+
+#ifndef MLN_WORLD_KN_IMMERSE_POINT_HH
+# define MLN_WORLD_KN_IMMERSE_POINT_HH
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ namespace internal
+ {
+
+
+ /// \brief Returns the corresponding point in Kn from a point
+ /// in K0.
+ point2d immerse_point(const def::coord& row,
+ const def::coord& col,
+ const unsigned n);
+
+ /// \overload
+ point2d immerse_point(const point2d& p, const unsigned n);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ inline
+ point2d immerse_point(const point2d& p, const unsigned n)
+ {
+ return immerse_point(p.row(), p.col(), n);
+ }
+
+
+ inline
+ point2d immerse_point(const def::coord& row,
+ const def::coord& col,
+ const unsigned n)
+ {
+ point2d tmp(std::pow(2u, n) * row, std::pow(2u, n) * col);
+ return tmp;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::work::kn::internal
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IMMERSE_POINT_HH
+
+
diff --git a/milena/mln/world/kn/is_0_face.hh b/milena/mln/world/kn/is_0_face.hh
new file mode 100644
index 0000000..c1124ac
--- /dev/null
+++ b/milena/mln/world/kn/is_0_face.hh
@@ -0,0 +1,80 @@
+// 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_KN_IS_0_FACE_HH
+# define MLN_WORLD_KN_IS_0_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /// \brief Check if site is a 0 face
+ bool is_0_face(const point2d& p);
+
+ /// \overload
+ bool is_0_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_0_face(const point2d& p)
+ {
+ return is_0_face(p.row(), p.col());
+ }
+
+ inline
+ bool is_0_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return internal::face_dim(row, col) == 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IS_0_FACE_HH
diff --git a/milena/mln/world/kn/is_0_or_1_face.hh
b/milena/mln/world/kn/is_0_or_1_face.hh
new file mode 100644
index 0000000..6ddbd91
--- /dev/null
+++ b/milena/mln/world/kn/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_KN_IS_0_OR_1_FACE_HH
+# define MLN_WORLD_KN_IS_0_OR_1_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /// \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::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IS_0_OR_1_FACE_HH
diff --git a/milena/mln/world/kn/is_1_face.hh b/milena/mln/world/kn/is_1_face.hh
new file mode 100644
index 0000000..f3bcdfb
--- /dev/null
+++ b/milena/mln/world/kn/is_1_face.hh
@@ -0,0 +1,83 @@
+// 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_KN_IS_1_FACE_HH
+# define MLN_WORLD_KN_IS_1_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face(const point2d& p);
+
+
+ /// \overload
+ inline
+ bool is_1_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face(const point2d& p)
+ {
+ return is_1_face(p.row(), p.col());
+ }
+
+ inline
+ bool is_1_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return internal::face_dim(row, col) == 1;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IS_1_FACE_HH
diff --git a/milena/mln/world/kn/is_1_face_horizontal.hh
b/milena/mln/world/kn/is_1_face_horizontal.hh
new file mode 100644
index 0000000..c203c59
--- /dev/null
+++ b/milena/mln/world/kn/is_1_face_horizontal.hh
@@ -0,0 +1,79 @@
+// 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_KN_IS_1_FACE_HORIZONTAL_HH
+# define MLN_WORLD_KN_IS_1_FACE_HORIZONTAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_1_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face_horizontal(const point2d& p);
+
+
+ /// \overload
+ bool is_1_face_horizontal(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face_horizontal(const point2d& p)
+ {
+ return is_1_face_horizontal(p.row(), p.col());
+ }
+
+ bool is_1_face_horizontal(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_1_face(row, col) && col % 2 == 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IS_1_FACE_HORIZONTAL_HH
diff --git a/milena/mln/world/kn/is_1_face_vertical.hh
b/milena/mln/world/kn/is_1_face_vertical.hh
new file mode 100644
index 0000000..6778a79
--- /dev/null
+++ b/milena/mln/world/kn/is_1_face_vertical.hh
@@ -0,0 +1,83 @@
+// 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_KN_IS_1_FACE_VERTICAL_HH
+# define MLN_WORLD_KN_IS_1_FACE_VERTICAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_1_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face_vertical(const point2d& p);
+
+
+ /// \overload
+ bool is_1_face_vertical(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face_vertical(const point2d& p)
+ {
+ return is_1_face_vertical(p.row(), p.col());
+ }
+
+
+ inline
+ bool is_1_face_vertical(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_1_face(row, col) && row % 2 == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IS_1_FACE_VERTICAL_HH
diff --git a/milena/mln/world/kn/is_2_face.hh b/milena/mln/world/kn/is_2_face.hh
new file mode 100644
index 0000000..e0a658c
--- /dev/null
+++ b/milena/mln/world/kn/is_2_face.hh
@@ -0,0 +1,80 @@
+// 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_KN_IS_2_FACE_HH
+# define MLN_WORLD_KN_IS_2_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /// \brief Check if site is a 2 face
+ bool is_2_face(const point2d& p);
+
+
+ /// \overload
+ bool is_2_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_2_face(const point2d& p)
+ {
+ return is_2_face(p.row(), p.col());
+ }
+
+ bool is_2_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return internal::face_dim(row, col) == 2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_IS_2_FACE_HH
diff --git a/milena/mln/world/kn/un_immerse.hh b/milena/mln/world/kn/un_immerse.hh
new file mode 100644
index 0000000..5159d86
--- /dev/null
+++ b/milena/mln/world/kn/un_immerse.hh
@@ -0,0 +1,144 @@
+// 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 Un-immerse a 2D image from KN to K0.
+
+
+#ifndef MLN_WORLD_KN_UN_IMMERSE_HH
+# define MLN_WORLD_KN_UN_IMMERSE_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/kn/is_2_face.hh>
+# include <mln/world/kn/safe_cast.hh>
+# include <mln/world/kn/internal/immerse_point.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ /*! \brief Un-immerse a 2D image from Kn to K0.
+
+ Example with n = 1:
+ \verbatim
+ -1 0 1 2 3
+ -1 . - . - . 0 1
+ 0 | o | o | 0 o o
+ 1 . - . - . -> 1 o o
+ 2 | o | o |
+ 3 . - . - .
+ \endverbatim
+
+ */
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ un_immerse(const Image<I>& ima_, unsigned n,
+ const V& new_value_type);
+
+ /// \overload
+ template <typename I>
+ mln_concrete(I)
+ un_immerse(const Image<I>& ima, unsigned n);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ /// Return the equivalent point in Kn from a point in K0.
+ inline
+ point2d
+ un_immerse_point(const point2d& p, const unsigned n)
+ {
+ point2d tmp(p.row() / std::pow(2u, n), p.col() / std::pow(2u, n));
+ return tmp;
+ }
+
+ /// \brief Return the equivalent domain in K0 from a domain in
+ /// Kn.
+ template <typename B>
+ inline
+ B
+ domain_K0_from_Kn(const Box<B>& b_, const unsigned n)
+ {
+ mln_precondition(exact(b_).is_valid());
+ const B& b = exact(b_);
+ return B(un_immerse_point(b.pmin(), n),
+ un_immerse_point(b.pmax(), n));
+ }
+
+ } // end of namespace mln::world::kn::internal
+
+
+
+
+ template <typename I, typename V>
+ mln_ch_value(I,V)
+ un_immerse(const Image<I>& ima_, unsigned n,
+ const V& new_value_type)
+ {
+ trace::entering("mln::world::kn::un_immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+ (void) new_value_type;
+
+ mln_concrete(I) output(internal::domain_K0_from_Kn(ima.domain(), n));
+
+ mln_piter(I) p(output.domain());
+ for_all(p)
+ output(p) = safe_cast(ima(internal::immerse_point(p, n)));
+
+ trace::exiting("mln::world::kn::un_immerse");
+ return output;
+ }
+
+
+ template <typename I>
+ mln_concrete(I)
+ un_immerse(const Image<I>& ima, unsigned n)
+ {
+ typedef mln_value(I) V;
+ return un_immerse(ima, n, V());
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_UN_IMMERSE_HH
+
diff --git a/milena/tests/world/Makefile.am b/milena/tests/world/Makefile.am
index 494271c..c4553b1 100644
--- a/milena/tests/world/Makefile.am
+++ b/milena/tests/world/Makefile.am
@@ -20,4 +20,6 @@ include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
binary_2d \
inter_pixel \
- k1
+ k1 \
+ k2 \
+ kn
diff --git a/milena/tests/world/k1/Makefile.am b/milena/tests/world/k1/Makefile.am
index 598d8dd..5c42124 100644
--- a/milena/tests/world/k1/Makefile.am
+++ b/milena/tests/world/k1/Makefile.am
@@ -18,42 +18,24 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
display_enlarged \
- fill_0_1_faces_internal_border \
- fill_0_from_1_faces \
- fill_0_from_2_faces \
- fill_0_from_primary_faces \
+ fill_0_from_1_faces \
fill_1_from_2_faces \
- fill_1_from_aux_2_faces \
- fill_2_from_1_faces \
+ fill_0_from_primary_faces \
immerse \
+ immerse_with \
immerse_and_duplicate_2_to_1_faces \
immerse_and_duplicate_2_to_0_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 \
un_immerse
display_enlarged_SOURCES = display_enlarged.cc
-fill_0_1_faces_internal_border_SOURCES = fill_0_1_faces_internal_border.cc
fill_0_from_1_faces_SOURCES = fill_0_from_1_faces.cc
-fill_0_from_2_faces_SOURCES = fill_0_from_2_faces.cc
-fill_0_from_primary_faces_SOURCES = fill_0_from_primary_faces.cc
fill_1_from_2_faces_SOURCES = fill_1_from_2_faces.cc
-fill_1_from_aux_2_faces_SOURCES = fill_1_from_aux_2_faces.cc
-fill_2_from_1_faces_SOURCES = fill_2_from_1_faces.cc
+fill_0_from_primary_faces_SOURCES = fill_0_from_primary_faces.cc
immerse_SOURCES = immerse.cc
+immerse_with_SOURCES = immerse_with.cc
immerse_and_duplicate_2_to_1_faces_SOURCES = immerse_and_duplicate_2_to_1_faces.cc
immerse_and_duplicate_2_to_0_1_faces_SOURCES = immerse_and_duplicate_2_to_0_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
un_immerse_SOURCES = un_immerse.cc
diff --git a/milena/tests/world/k1/fill_0_1_faces_internal_border.cc
b/milena/tests/world/k1/fill_0_1_faces_internal_border.cc
deleted file mode 100644
index fbb9f73..0000000
--- a/milena/tests/world/k1/fill_0_1_faces_internal_border.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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/make/box2d.hh>
-#include <mln/data/compare.hh>
-#include <mln/world/k1/fill_0_1_faces_internal_border.hh>
-
-int main()
-{
- using namespace mln;
-
- int refvals[5][5] = {
- {1, 1, 1, 1, 1 },
- {1, 2, 0, 2, 1 },
- {1, 0, 0, 0, 1 },
- {1, 2, 0, 2, 1 },
- {1, 1, 1, 1, 1 }
- };
- image2d<int> ref = make::image(refvals, point2d(-1, -1));
-
- int vals[5][5] = {
- {0, 0, 0, 0, 0 },
- {0, 2, 0, 2, 0 },
- {0, 0, 0, 0, 0 },
- {0, 2, 0, 2, 0 },
- {0, 0, 0, 0, 0 }
- };
- image2d<int> imak1 = make::image(vals, point2d(-1, -1));
-
- {
- world::k1::fill_0_1_faces_internal_border(imak1, 1);
- mln_assertion(ref == imak1);
- }
-}
diff --git a/milena/tests/world/k1/fill_0_from_1_faces.cc
b/milena/tests/world/k1/fill_0_from_1_faces.cc
index b6c1db6..e667734 100644
--- a/milena/tests/world/k1/fill_0_from_1_faces.cc
+++ b/milena/tests/world/k1/fill_0_from_1_faces.cc
@@ -76,14 +76,6 @@ int main()
/// Make sure the border is set to 0 to get deterministic results.
border::fill(imak1, 0);
-
- // Overload with accumulator
- {
- accu::math::sum<int> accu;
- world::k1::fill_0_from_1_faces(imak1, accu);
- mln_assertion(ref == imak1);
- }
-
// Overload with function
{
sum_t f;
diff --git a/milena/tests/world/k1/fill_0_from_2_faces.cc
b/milena/tests/world/k1/fill_0_from_2_faces.cc
deleted file mode 100644
index c32a0f2..0000000
--- a/milena/tests/world/k1/fill_0_from_2_faces.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// 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/make/box2d.hh>
-#include <mln/data/compare.hh>
-#include <mln/accu/math/sum.hh>
-#include <mln/world/k1/fill_0_from_2_faces.hh>
-#include <mln/border/fill.hh>
-
-
-namespace mln
-{
-
- struct sum_t : Function_vvvv2v<sum_t>
- {
- typedef int result;
-
- int operator()(const int& v1, const int& v2, const int& v3, const
int& v4) const
- {
- return v1 + v2 + v3 + v4;
- }
-
- };
-
-}
-
-
-
-int main()
-{
- using namespace mln;
-
- int refvals[5][5] = {
- {1, 0, 2, 0, 1},
- {0, 1, 0, 1, 0},
- {2, 0, 4, 0, 2},
- {0, 1, 0, 1, 0},
- {1, 0, 2, 0, 1}
- };
- image2d<int> ref = make::image(refvals, point2d(-1, -1));
-
- int vals[5][5] = {
- {0, 0, 0, 0, 0 },
- {0, 1, 0, 1, 0 },
- {0, 0, 0, 0, 0 },
- {0, 1, 0, 1, 0 },
- {0, 0, 0, 0, 0 }
- };
- image2d<int> imak1 = make::image(vals, point2d(-1, -1));
-
- /// Make sure the border is set to 0 to get deterministic results.
- border::fill(imak1, 0);
-
-
- // Overload with accumulator
- {
- accu::math::sum<int> accu;
- world::k1::fill_0_from_2_faces(imak1, accu);
- mln_assertion(ref == imak1);
- }
-
- // Overload with function
- {
- sum_t f;
- world::k1::fill_0_from_2_faces(imak1, f);
- mln_assertion(ref == imak1);
- }
-}
diff --git a/milena/tests/world/k1/fill_1_from_2_faces.cc
b/milena/tests/world/k1/fill_1_from_2_faces.cc
index 8822e60..4045674 100644
--- a/milena/tests/world/k1/fill_1_from_2_faces.cc
+++ b/milena/tests/world/k1/fill_1_from_2_faces.cc
@@ -71,24 +71,16 @@ int main()
{0, 3, 0, 3, 0 },
{1, 0, 1, 0, 1 }
};
- image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+ image2d<int> imakn = make::image(vals, point2d(-1, -1));
/// Make sure the border is set to 0 to get deterministic results.
- border::fill(imak1, 0);
-
-
- // Overload with accumulator
- {
- accu::math::sum<int> accu;
- world::k1::fill_1_from_2_faces(imak1, accu);
- mln_assertion(ref == imak1);
- }
+ border::fill(imakn, 0);
// Overload with function
{
sum_t f;
- world::k1::fill_1_from_2_faces(imak1, f);
- mln_assertion(ref == imak1);
+ world::k1::fill_1_from_2_faces(imakn, f);
+ mln_assertion(ref == imakn);
}
}
diff --git a/milena/tests/world/k1/fill_1_from_aux_2_faces.cc
b/milena/tests/world/k1/fill_1_from_aux_2_faces.cc
deleted file mode 100644
index 045f540..0000000
--- a/milena/tests/world/k1/fill_1_from_aux_2_faces.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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/make/box2d.hh>
-#include <mln/data/compare.hh>
-#include <mln/accu/math/sum.hh>
-#include <mln/world/k1/fill_1_from_aux_2_faces.hh>
-#include <mln/border/fill.hh>
-
-
-namespace mln
-{
-
- struct sum_t : Function_vv2v<sum_t>
- {
- typedef int result;
-
- int operator()(const int& v1, const int& v2) const
- {
- return v1 + v2;
- }
-
- };
-
-}
-
-
-
-int main()
-{
- using namespace mln;
-
- int refvals[5][5] = {
- {1, 1, 1, 4, 1},
- {1, 3, 5, 3, 4},
- {1, 5, 1, 5, 1},
- {4, 3, 5, 3, 1},
- {1, 4, 1, 1, 1}
- };
- image2d<int> ref = make::image(refvals, point2d(-1, -1));
-
- int auxvals[5][5] = {
- {0, 0, 0, 0, 0 },
- {0, 1, 0, 4, 0 },
- {0, 0, 0, 0, 0 },
- {0, 4, 0, 1, 0 },
- {0, 0, 0, 0, 1 }
- };
- image2d<int> aux = make::image(auxvals, point2d(-1, -1));
-
-
- int vals[5][5] = {
- {1, 0, 1, 0, 1 },
- {0, 3, 0, 3, 0 },
- {1, 0, 1, 0, 1 },
- {0, 3, 0, 3, 0 },
- {1, 0, 1, 0, 1 }
- };
- image2d<int> imak1 = make::image(vals, point2d(-1, -1));
-
- /// Make sure the border is set to 0 to get deterministic results.
- border::fill(imak1, 0);
-
-
- // Overload with accumulator
- {
- accu::math::sum<int> accu;
- world::k1::fill_1_from_aux_2_faces(imak1, aux, accu);
- mln_assertion(ref == imak1);
- }
-
- // Overload with function
- {
- sum_t f;
- world::k1::fill_1_from_aux_2_faces(imak1, aux, f);
- mln_assertion(ref == imak1);
- }
-
-}
diff --git a/milena/tests/world/k1/fill_2_from_1_faces.cc
b/milena/tests/world/k1/fill_2_from_1_faces.cc
deleted file mode 100644
index 6fb3e96..0000000
--- a/milena/tests/world/k1/fill_2_from_1_faces.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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/make/box2d.hh>
-#include <mln/data/compare.hh>
-#include <mln/accu/math/sum.hh>
-#include <mln/world/k1/fill_2_from_1_faces.hh>
-#include <mln/border/fill.hh>
-
-
-namespace mln
-{
-
- struct sum_t : Function_vvvv2v<sum_t>
- {
- typedef int result;
-
- int operator()(const int& v1, const int& v2, const int& v3, const
int& v4) const
- {
- return v1 + v2 + v3 + v4;
- }
-
- };
-
-}
-
-
-
-int main()
-{
- using namespace mln;
-
- int refvals[5][5] = {
- {0, 1, 0, 1, 0},
- {1, 4, 1, 4, 1},
- {0, 1, 0, 1, 0},
- {1, 4, 1, 4, 1},
- {0, 1, 0, 1, 0}
- };
- image2d<int> ref = make::image(refvals, point2d(-1, -1));
-
- int vals[5][5] = {
- {0, 1, 0, 1, 0 },
- {1, 0, 1, 0, 1 },
- {0, 1, 0, 1, 0 },
- {1, 0, 1, 0, 1 },
- {0, 1, 0, 1, 0 }
- };
- image2d<int> imak1 = make::image(vals, point2d(-1, -1));
-
- /// Make sure the border is set to 0 to get deterministic results.
- border::fill(imak1, 0);
-
-
- // Overload with accumulator
- {
- accu::math::sum<int> accu;
- world::k1::fill_2_from_1_faces(imak1, accu);
- mln_assertion(ref == imak1);
- }
-
- // Overload with function
- {
- sum_t f;
- world::k1::fill_2_from_1_faces(imak1, f);
- mln_assertion(ref == imak1);
- }
-
-}
diff --git a/milena/tests/world/k1/immerse.cc b/milena/tests/world/k1/immerse.cc
index 8a17056..4abfb44 100644
--- a/milena/tests/world/k1/immerse.cc
+++ b/milena/tests/world/k1/immerse.cc
@@ -27,27 +27,57 @@
#include <mln/core/image/image2d.hh>
#include <mln/world/k1/immerse.hh>
-#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
int main()
{
using namespace mln;
+ int ivals[][2] = {
+ {1, 2},
+ {3, 4}
+ };
+ image2d<int> ima = make::image(ivals);
+
+ int vals[][5] = {
+ {0, 0, 0, 0, 0},
+ {0, 1, 0, 2, 0},
+ {0, 0, 0, 0, 0},
+ {0, 3, 0, 4, 0},
+ {0, 0, 0, 0, 0}
+ };
+ image2d<int> ref = make::image(vals, point2d(-1,-1));
- int vals[2][2] = {
- {1, 2 },
- {3, 4 }
+ int fvals[][5] = {
+ {5, 5, 5, 5, 5},
+ {5, 1, 5, 2, 5},
+ {5, 5, 5, 5, 5},
+ {5, 3, 5, 4, 5},
+ {5, 5, 5, 5, 5}
};
- image2d<int> ima = make::image(vals);
+ image2d<int> ref_fill = make::image(fvals, point2d(-1,-1));
+
+ {
+ image2d<int> immersed = world::k1::immerse(ima);
+ mln_assertion(immersed.domain() == ref_fill.domain());
+ mln_assertion(immersed(point2d(0,0)) == 1);
+ mln_assertion(immersed(point2d(0,2)) == 2);
+ mln_assertion(immersed(point2d(2,0)) == 3);
+ mln_assertion(immersed(point2d(2,2)) == 4);
+ }
- image2d<int> immersed = world::k1::immerse(ima);
+ {
+ image2d<long> immersed = world::k1::immerse(ima, long());
+ mln_assertion(immersed.domain() == ref_fill.domain());
+ mln_assertion(immersed(point2d(0,0)) == 1);
+ mln_assertion(immersed(point2d(0,2)) == 2);
+ mln_assertion(immersed(point2d(2,0)) == 3);
+ mln_assertion(immersed(point2d(2,2)) == 4);
+ }
- // Check domain
- mln_assertion(immersed.domain() == make::box2d(-1, -1, 3, 3));
+ {
+ image2d<long> immersed = world::k1::immerse(ima, long(), 5l);
+ mln_assertion(immersed == ref_fill);
+ }
- // 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/immerse_with.cc
b/milena/tests/world/k1/immerse_with.cc
new file mode 100644
index 0000000..3b7e8fc
--- /dev/null
+++ b/milena/tests/world/k1/immerse_with.cc
@@ -0,0 +1,63 @@
+// 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_with.hh>
+#include <mln/data/compare.hh>
+#include <mln/border/fill.hh>
+#include <mln/fun/vv2v/max.hh>
+#include <mln/fun/vvvv2v/max.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int ivals[][2] = {
+ {1, 2},
+ {3, 4}
+ };
+ image2d<int> ima = make::image(ivals);
+ border::fill(ima, 0); // Make sure there is not border effect.
+
+ int fvals[][5] = {
+ {1, 1, 2, 2, 2},
+ {1, 1, 2, 2, 2},
+ {3, 3, 4, 4, 4},
+ {3, 3, 4, 4, 4},
+ {3, 3, 4, 4, 4}
+ };
+ image2d<int> ref = make::image(fvals, point2d(-1,-1));
+
+ {
+ image2d<long>
+ immersed = world::k1::immerse_with(ima, long(),
+ fun::vv2v::max<long>(),
+ fun::vvvv2v::max<long>());
+ mln_assertion(immersed == ref);
+ }
+
+}
diff --git a/milena/tests/world/k1/is_0_face.cc b/milena/tests/world/k1/is_0_face.cc
deleted file mode 100644
index 6033af6..0000000
--- a/milena/tests/world/k1/is_0_face.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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
deleted file mode 100644
index f977566..0000000
--- a/milena/tests/world/k1/is_0_or_1_face.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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
deleted file mode 100644
index bd50f84..0000000
--- a/milena/tests/world/k1/is_1_face.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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
deleted file mode 100644
index 4f6e406..0000000
--- a/milena/tests/world/k1/is_1_face_horizontal.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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
deleted file mode 100644
index e204f97..0000000
--- a/milena/tests/world/k1/is_1_face_vertical.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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
deleted file mode 100644
index 912567d..0000000
--- a/milena/tests/world/k1/is_2_face.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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/un_immerse.cc b/milena/tests/world/k1/un_immerse.cc
index 47e06e4..dc1b8db 100644
--- a/milena/tests/world/k1/un_immerse.cc
+++ b/milena/tests/world/k1/un_immerse.cc
@@ -27,7 +27,6 @@
#include <mln/core/image/image2d.hh>
#include <mln/world/k1/un_immerse.hh>
-#include <mln/make/box2d.hh>
#include <mln/data/compare.hh>
int main()
@@ -35,17 +34,17 @@ int main()
using namespace mln;
int refvals[2][2] = {
- {3, 3},
- {3, 3}
+ {1, 2},
+ {3, 4}
};
image2d<int> ref = make::image(refvals);
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 }
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 2, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 3, 0, 4, 0 },
+ {0, 0, 0, 0, 0 }
};
image2d<int> imak1 = make::image(vals, point2d(-1, -1));
diff --git a/milena/tests/world/k2/Makefile.am b/milena/tests/world/k2/Makefile.am
new file mode 100644
index 0000000..84b0801
--- /dev/null
+++ b/milena/tests/world/k2/Makefile.am
@@ -0,0 +1,38 @@
+# 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 = \
+ fill_non_primary_from_primary_2_faces \
+ is_non_primary_2_face \
+ is_non_primary_2_face_center \
+ is_non_primary_2_face_horizontal \
+ is_non_primary_2_face_vertical \
+ is_primary_2_face \
+ immerse \
+ un_immerse
+
+fill_non_primary_from_primary_2_faces_SOURCES = fill_non_primary_from_primary_2_faces.cc
+is_non_primary_2_face_SOURCES = is_non_primary_2_face.cc
+is_non_primary_2_face_center_SOURCES = is_non_primary_2_face_center.cc
+is_non_primary_2_face_horizontal_SOURCES = is_non_primary_2_face_horizontal.cc
+is_non_primary_2_face_vertical_SOURCES = is_non_primary_2_face_vertical.cc
+is_primary_2_face_SOURCES = is_primary_2_face.cc
+immerse_SOURCES = immerse.cc
+un_immerse_SOURCES = un_immerse.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/world/k2/fill_non_primary_from_primary_2_faces.cc
b/milena/tests/world/k2/fill_non_primary_from_primary_2_faces.cc
new file mode 100644
index 0000000..c83a613
--- /dev/null
+++ b/milena/tests/world/k2/fill_non_primary_from_primary_2_faces.cc
@@ -0,0 +1,105 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k2/fill_non_primary_from_primary_2_faces.hh>
+
+namespace mln
+{
+
+ struct sum4_t : Function_vvvv2v<sum4_t>
+ {
+ typedef int argument;
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const
int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+ struct sum2_t : Function_vv2v<sum2_t>
+ {
+ typedef int argument;
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2) const
+ {
+ return v1 + v2;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[][7] = {
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 3, 0, 2, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 4, 0, 10, 0, 6, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 3, 0, 7, 0, 4, 0},
+ {0, 0, 0, 0, 0, 0, 0}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[][7] = {
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 2, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 3, 0, 0, 0, 4, 0},
+ {0, 0, 0, 0, 0, 0, 0}
+ };
+
+ // Overload with accumulator
+ {
+ image2d<int> ima = make::image(vals, point2d(-1,-1));
+ accu::math::sum<int> accu;
+ world::k2::fill_non_primary_from_primary_2_faces(ima, accu);
+ mln_assertion(ref == ima);
+ }
+
+ // Overload with function
+ {
+ image2d<int> ima = make::image(vals, point2d(-1,-1));
+ world::k2::fill_non_primary_from_primary_2_faces(ima, sum2_t(), sum4_t());
+ mln_assertion(ref == ima);
+ }
+
+}
diff --git a/milena/tests/world/k2/immerse.cc b/milena/tests/world/k2/immerse.cc
new file mode 100644
index 0000000..d00f095
--- /dev/null
+++ b/milena/tests/world/k2/immerse.cc
@@ -0,0 +1,78 @@
+// 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/k2/immerse.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int ivals[][2] = {
+ {1, 2},
+ {3, 4}
+ };
+ image2d<int> ima = make::image(ivals);
+
+ int fvals[][7] = {
+ {5, 5, 5, 5, 5, 5, 5},
+ {5, 1, 5, 5, 5, 2, 5},
+ {5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5},
+ {5, 3, 5, 5, 5, 4, 5},
+ {5, 5, 5, 5, 5, 5, 5}
+ };
+ image2d<int> ref_fill = make::image(fvals, point2d(-1,-1));
+
+
+ {
+ image2d<int> immersed = world::k2::immerse(ima);
+
+ mln_assertion(immersed.domain() == ref_fill.domain());
+ mln_assertion(immersed(point2d(0,0)) == 1);
+ mln_assertion(immersed(point2d(0,4)) == 2);
+ mln_assertion(immersed(point2d(4,0)) == 3);
+ mln_assertion(immersed(point2d(4,4)) == 4);
+ }
+
+ {
+ image2d<long> immersed = world::k2::immerse(ima, long());
+ mln_assertion(immersed.domain() == ref_fill.domain());
+ mln_assertion(immersed(point2d(0,0)) == 1);
+ mln_assertion(immersed(point2d(0,4)) == 2);
+ mln_assertion(immersed(point2d(4,0)) == 3);
+ mln_assertion(immersed(point2d(4,4)) == 4);
+ }
+
+ {
+ image2d<long> immersed = world::k2::immerse(ima, long(), 5l);
+ mln_assertion(immersed == ref_fill);
+ }
+
+}
diff --git a/milena/tests/world/k2/is_non_primary_2_face.cc
b/milena/tests/world/k2/is_non_primary_2_face.cc
new file mode 100644
index 0000000..4a0bd4c
--- /dev/null
+++ b/milena/tests/world/k2/is_non_primary_2_face.cc
@@ -0,0 +1,50 @@
+// 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/k2/is_non_primary_2_face.hh>
+
+
+int main()
+{
+ using namespace mln::world;
+
+ mln_assertion(!k2::is_non_primary_2_face(-1, -1));
+ mln_assertion(!k2::is_non_primary_2_face(-1, 0));
+ mln_assertion(!k2::is_non_primary_2_face(0, -1));
+
+ mln_assertion(!k2::is_non_primary_2_face(0, 0));
+
+ mln_assertion(k2::is_non_primary_2_face(2, 2));
+ mln_assertion(k2::is_non_primary_2_face(2, 0));
+ mln_assertion(k2::is_non_primary_2_face(4, 6));
+
+ mln_assertion(!k2::is_non_primary_2_face(2, 1));
+ mln_assertion(!k2::is_non_primary_2_face(1, 2));
+
+ mln_assertion(!k2::is_non_primary_2_face(4, 4));
+}
diff --git a/milena/tests/world/k2/is_non_primary_2_face_center.cc
b/milena/tests/world/k2/is_non_primary_2_face_center.cc
new file mode 100644
index 0000000..d6178a6
--- /dev/null
+++ b/milena/tests/world/k2/is_non_primary_2_face_center.cc
@@ -0,0 +1,48 @@
+// 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/k2/is_non_primary_2_face_center.hh>
+
+
+int main()
+{
+ using namespace mln::world;
+
+ mln_assertion(!k2::is_non_primary_2_face_center(-1, -1));
+ mln_assertion(!k2::is_non_primary_2_face_center(-1, 0));
+ mln_assertion(!k2::is_non_primary_2_face_center(0, -1));
+ mln_assertion(!k2::is_non_primary_2_face_center(0, 0));
+
+ mln_assertion(k2::is_non_primary_2_face_center(2, 2));
+
+ mln_assertion(!k2::is_non_primary_2_face_center(2, 1));
+ mln_assertion(!k2::is_non_primary_2_face_center(1, 2));
+ mln_assertion(!k2::is_non_primary_2_face_center(4, 4));
+
+ mln_assertion(k2::is_non_primary_2_face_center(2, 6));
+}
diff --git a/milena/tests/world/k2/is_non_primary_2_face_horizontal.cc
b/milena/tests/world/k2/is_non_primary_2_face_horizontal.cc
new file mode 100644
index 0000000..c04c15b
--- /dev/null
+++ b/milena/tests/world/k2/is_non_primary_2_face_horizontal.cc
@@ -0,0 +1,52 @@
+// 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/k2/is_non_primary_2_face_horizontal.hh>
+
+
+int main()
+{
+ using namespace mln::world;
+
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(-1, -1));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(-1, 0));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(0, -1));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(0, 0));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(2, 2));
+
+ mln_assertion(k2::is_non_primary_2_face_horizontal(2, 0));
+ mln_assertion(k2::is_non_primary_2_face_horizontal(2, 4));
+
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(0, 2));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(4, 6));
+
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(2, 1));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(1, 2));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(4, 4));
+ mln_assertion(!k2::is_non_primary_2_face_horizontal(2, 6));
+}
diff --git a/milena/tests/world/k2/is_non_primary_2_face_vertical.cc
b/milena/tests/world/k2/is_non_primary_2_face_vertical.cc
new file mode 100644
index 0000000..5b00ec9
--- /dev/null
+++ b/milena/tests/world/k2/is_non_primary_2_face_vertical.cc
@@ -0,0 +1,50 @@
+// 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/k2/is_non_primary_2_face_vertical.hh>
+
+
+int main()
+{
+ using namespace mln::world;
+
+ mln_assertion(!k2::is_non_primary_2_face_vertical(-1, -1));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(-1, 0));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(0, -1));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(0, 0));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(2, 2));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(2, 0));
+
+ mln_assertion(k2::is_non_primary_2_face_vertical(0, 2));
+ mln_assertion(k2::is_non_primary_2_face_vertical(4, 6));
+
+ mln_assertion(!k2::is_non_primary_2_face_vertical(2, 1));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(1, 2));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(4, 4));
+ mln_assertion(!k2::is_non_primary_2_face_vertical(2, 6));
+}
diff --git a/milena/tests/world/k2/is_primary_2_face.cc
b/milena/tests/world/k2/is_primary_2_face.cc
new file mode 100644
index 0000000..7a9bf69
--- /dev/null
+++ b/milena/tests/world/k2/is_primary_2_face.cc
@@ -0,0 +1,52 @@
+// 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/k2/is_primary_2_face.hh>
+
+
+int main()
+{
+ using namespace mln::world;
+
+ mln_assertion(!k2::is_primary_2_face(-1, -1));
+ mln_assertion(!k2::is_primary_2_face(-1, 0));
+ mln_assertion(!k2::is_primary_2_face(0, -1));
+
+ mln_assertion(k2::is_primary_2_face(0, 0));
+
+ mln_assertion(!k2::is_primary_2_face(2, 2));
+ mln_assertion(!k2::is_primary_2_face(2, 0));
+ mln_assertion(!k2::is_primary_2_face(0, 2));
+ mln_assertion(!k2::is_primary_2_face(4, 6));
+
+ mln_assertion(k2::is_primary_2_face(4, 4));
+
+ mln_assertion(!k2::is_primary_2_face(2, 1));
+ mln_assertion(!k2::is_primary_2_face(1, 2));
+ mln_assertion(!k2::is_primary_2_face(2, 6));
+}
diff --git a/milena/tests/world/k2/un_immerse.cc b/milena/tests/world/k2/un_immerse.cc
new file mode 100644
index 0000000..acb7012
--- /dev/null
+++ b/milena/tests/world/k2/un_immerse.cc
@@ -0,0 +1,55 @@
+// 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/k2/un_immerse.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[2][2] = {
+ {1, 2},
+ {3, 4}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[][7] = {
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 2, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+ {0, 3, 0, 0, 0, 4, 0},
+ {0, 0, 0, 0, 0, 0, 0}
+ };
+ image2d<int> imak2 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::k2::un_immerse(imak2);
+ mln_assertion(imak0 == ref);
+}
diff --git a/milena/tests/world/kn/Makefile.am b/milena/tests/world/kn/Makefile.am
new file mode 100644
index 0000000..6996528
--- /dev/null
+++ b/milena/tests/world/kn/Makefile.am
@@ -0,0 +1,51 @@
+# 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 = \
+ fill_0_1_faces_internal_border \
+ fill_0_from_1_faces \
+ fill_0_from_2_faces \
+ fill_1_from_2_faces \
+ fill_1_from_aux_2_faces \
+ fill_2_from_1_faces \
+ immerse \
+ is_0_face \
+ is_0_or_1_face \
+ is_1_face \
+ is_1_face_vertical \
+ is_1_face_horizontal \
+ is_2_face \
+ un_immerse
+
+fill_0_1_faces_internal_border_SOURCES = fill_0_1_faces_internal_border.cc
+fill_0_from_1_faces_SOURCES = fill_0_from_1_faces.cc
+fill_0_from_2_faces_SOURCES = fill_0_from_2_faces.cc
+fill_1_from_2_faces_SOURCES = fill_1_from_2_faces.cc
+fill_1_from_aux_2_faces_SOURCES = fill_1_from_aux_2_faces.cc
+fill_2_from_1_faces_SOURCES = fill_2_from_1_faces.cc
+immerse_SOURCES = immerse.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
+un_immerse_SOURCES = un_immerse.cc
+
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/world/kn/fill_0_1_faces_internal_border.cc
b/milena/tests/world/kn/fill_0_1_faces_internal_border.cc
new file mode 100644
index 0000000..7bd186e
--- /dev/null
+++ b/milena/tests/world/kn/fill_0_1_faces_internal_border.cc
@@ -0,0 +1,59 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/world/kn/fill_0_1_faces_internal_border.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 1, 1, 1, 1 },
+ {1, 2, 0, 2, 1 },
+ {1, 0, 0, 0, 1 },
+ {1, 2, 0, 2, 1 },
+ {1, 1, 1, 1, 1 }
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 0, 0, 0, 0 },
+ {0, 2, 0, 2, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 2, 0, 2, 0 },
+ {0, 0, 0, 0, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ {
+ world::kn::fill_0_1_faces_internal_border(imak1, 1);
+ mln_assertion(ref == imak1);
+ }
+}
diff --git a/milena/tests/world/kn/fill_0_from_1_faces.cc
b/milena/tests/world/kn/fill_0_from_1_faces.cc
new file mode 100644
index 0000000..00f3c01
--- /dev/null
+++ b/milena/tests/world/kn/fill_0_from_1_faces.cc
@@ -0,0 +1,69 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/kn/fill_0_from_1_faces.hh>
+#include <mln/border/fill.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {2, 1, 3, 1, 2},
+ {1, 0, 1, 0, 1},
+ {3, 1, 4, 1, 3},
+ {1, 0, 1, 0, 1},
+ {2, 1, 3, 1, 2}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::kn::fill_0_from_1_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+}
diff --git a/milena/tests/world/kn/fill_0_from_2_faces.cc
b/milena/tests/world/kn/fill_0_from_2_faces.cc
new file mode 100644
index 0000000..f7e4cf7
--- /dev/null
+++ b/milena/tests/world/kn/fill_0_from_2_faces.cc
@@ -0,0 +1,93 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/kn/fill_0_from_2_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vvvv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const
int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 0, 2, 0, 1},
+ {0, 1, 0, 1, 0},
+ {2, 0, 4, 0, 2},
+ {0, 1, 0, 1, 0},
+ {1, 0, 2, 0, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 1, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 1, 0 },
+ {0, 0, 0, 0, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::kn::fill_0_from_2_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::kn::fill_0_from_2_faces(imak1, f);
+ mln_assertion(ref == imak1);
+ }
+}
diff --git a/milena/tests/world/kn/fill_1_from_2_faces.cc
b/milena/tests/world/kn/fill_1_from_2_faces.cc
new file mode 100644
index 0000000..bd14ace
--- /dev/null
+++ b/milena/tests/world/kn/fill_1_from_2_faces.cc
@@ -0,0 +1,87 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/kn/fill_1_from_2_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2) const
+ {
+ return v1 + v2;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 3, 1, 3, 1},
+ {3, 3, 6, 3, 3},
+ {1, 6, 1, 6, 1},
+ {3, 3, 6, 3, 3},
+ {1, 3, 1, 3, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 }
+ };
+ image2d<int> imakn = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imakn, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::kn::fill_1_from_2_faces(imakn, accu);
+ mln_assertion(ref == imakn);
+ }
+
+}
diff --git a/milena/tests/world/kn/fill_1_from_aux_2_faces.cc
b/milena/tests/world/kn/fill_1_from_aux_2_faces.cc
new file mode 100644
index 0000000..1475f75
--- /dev/null
+++ b/milena/tests/world/kn/fill_1_from_aux_2_faces.cc
@@ -0,0 +1,104 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/kn/fill_1_from_aux_2_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2) const
+ {
+ return v1 + v2;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 1, 1, 4, 1},
+ {1, 3, 5, 3, 4},
+ {1, 5, 1, 5, 1},
+ {4, 3, 5, 3, 1},
+ {1, 4, 1, 1, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int auxvals[5][5] = {
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 4, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 4, 0, 1, 0 },
+ {0, 0, 0, 0, 1 }
+ };
+ image2d<int> aux = make::image(auxvals, point2d(-1, -1));
+
+
+ int vals[5][5] = {
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 }
+ };
+ image2d<int> imakn = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imakn, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::kn::fill_1_from_aux_2_faces(imakn, aux, accu);
+ mln_assertion(ref == imakn);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::kn::fill_1_from_aux_2_faces(imakn, aux, f);
+ mln_assertion(ref == imakn);
+ }
+
+}
diff --git a/milena/tests/world/kn/fill_2_from_1_faces.cc
b/milena/tests/world/kn/fill_2_from_1_faces.cc
new file mode 100644
index 0000000..1f0d170
--- /dev/null
+++ b/milena/tests/world/kn/fill_2_from_1_faces.cc
@@ -0,0 +1,94 @@
+// 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/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/kn/fill_2_from_1_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vvvv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const
int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {0, 1, 0, 1, 0},
+ {1, 4, 1, 4, 1},
+ {0, 1, 0, 1, 0},
+ {1, 4, 1, 4, 1},
+ {0, 1, 0, 1, 0}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 }
+ };
+ image2d<int> imakn = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imakn, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::kn::fill_2_from_1_faces(imakn, accu);
+ mln_assertion(ref == imakn);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::kn::fill_2_from_1_faces(imakn, f);
+ mln_assertion(ref == imakn);
+ }
+
+}
diff --git a/milena/tests/world/kn/immerse.cc b/milena/tests/world/kn/immerse.cc
new file mode 100644
index 0000000..9419a67
--- /dev/null
+++ b/milena/tests/world/kn/immerse.cc
@@ -0,0 +1,90 @@
+// 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/kn/immerse.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int ivals[][2] = {
+ {1, 2},
+ {3, 4}
+ };
+ image2d<int> ima = make::image(ivals);
+
+ int fvals[][19] = {
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
+ {5, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5},
+ {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}
+ };
+ image2d<int> ref_fill = make::image(fvals, point2d(-1,-1));
+
+
+ {
+ image2d<int> immersed = world::kn::immerse(ima, 4);
+
+ mln_assertion(immersed.domain() == ref_fill.domain());
+ mln_assertion(immersed(point2d(0,0)) == 1);
+ mln_assertion(immersed(point2d(0,16)) == 2);
+ mln_assertion(immersed(point2d(16,0)) == 3);
+ mln_assertion(immersed(point2d(16,16)) == 4);
+ }
+
+ {
+ image2d<long> immersed = world::kn::immerse(ima, 4, long());
+ mln_assertion(immersed.domain() == ref_fill.domain());
+ mln_assertion(immersed(point2d(0,0)) == 1);
+ mln_assertion(immersed(point2d(0,16)) == 2);
+ mln_assertion(immersed(point2d(16,0)) == 3);
+ mln_assertion(immersed(point2d(16,16)) == 4);
+ }
+
+ {
+ image2d<long> immersed = world::kn::immerse(ima, 4, long(), 5l);
+ mln_assertion(immersed == ref_fill);
+ }
+
+}
diff --git a/milena/tests/world/kn/is_0_face.cc b/milena/tests/world/kn/is_0_face.cc
new file mode 100644
index 0000000..46ed01b
--- /dev/null
+++ b/milena/tests/world/kn/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/kn/is_0_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(world::kn::is_0_face(point2d(-1, -1)));
+ mln_assertion(!world::kn::is_0_face(point2d(-1, 0)));
+ mln_assertion(!world::kn::is_0_face(point2d(0, -1)));
+ mln_assertion(!world::kn::is_0_face(point2d(0, 0)));
+ mln_assertion(world::kn::is_0_face(point2d(1, 1)));
+}
diff --git a/milena/tests/world/kn/is_0_or_1_face.cc
b/milena/tests/world/kn/is_0_or_1_face.cc
new file mode 100644
index 0000000..12f2d0e
--- /dev/null
+++ b/milena/tests/world/kn/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/kn/is_0_or_1_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(world::kn::is_0_or_1_face(point2d(-1, -1)));
+ mln_assertion(world::kn::is_0_or_1_face(point2d(-1, 0)));
+ mln_assertion(world::kn::is_0_or_1_face(point2d(0, -1)));
+ mln_assertion(!world::kn::is_0_or_1_face(point2d(0, 0)));
+ mln_assertion(world::kn::is_0_or_1_face(point2d(1, 1)));
+}
diff --git a/milena/tests/world/kn/is_1_face.cc b/milena/tests/world/kn/is_1_face.cc
new file mode 100644
index 0000000..b0b17bf
--- /dev/null
+++ b/milena/tests/world/kn/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/kn/is_1_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::kn::is_1_face(point2d(-1, -1)));
+ mln_assertion(world::kn::is_1_face(point2d(-1, 0)));
+ mln_assertion(world::kn::is_1_face(point2d(0, -1)));
+ mln_assertion(!world::kn::is_1_face(point2d(0, 0)));
+}
diff --git a/milena/tests/world/kn/is_1_face_horizontal.cc
b/milena/tests/world/kn/is_1_face_horizontal.cc
new file mode 100644
index 0000000..ab1a2c2
--- /dev/null
+++ b/milena/tests/world/kn/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/kn/is_1_face_horizontal.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::kn::is_1_face_horizontal(point2d(-1, -1)));
+ mln_assertion(world::kn::is_1_face_horizontal(point2d(-1, 0)));
+ mln_assertion(world::kn::is_1_face_horizontal(point2d(1, 0)));
+ mln_assertion(!world::kn::is_1_face_horizontal(point2d(0, -1)));
+ mln_assertion(!world::kn::is_1_face_horizontal(point2d(0, 1)));
+ mln_assertion(!world::kn::is_1_face_horizontal(point2d(0, 0)));
+}
diff --git a/milena/tests/world/kn/is_1_face_vertical.cc
b/milena/tests/world/kn/is_1_face_vertical.cc
new file mode 100644
index 0000000..96b81e4
--- /dev/null
+++ b/milena/tests/world/kn/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/kn/is_1_face_vertical.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::kn::is_1_face_vertical(point2d(-1, -1)));
+ mln_assertion(!world::kn::is_1_face_vertical(point2d(-1, 0)));
+ mln_assertion(!world::kn::is_1_face_vertical(point2d(1, 0)));
+ mln_assertion(world::kn::is_1_face_vertical(point2d(0, -1)));
+ mln_assertion(world::kn::is_1_face_vertical(point2d(0, 1)));
+ mln_assertion(!world::kn::is_1_face_vertical(point2d(0, 0)));
+}
diff --git a/milena/tests/world/kn/is_2_face.cc b/milena/tests/world/kn/is_2_face.cc
new file mode 100644
index 0000000..ba04c6a
--- /dev/null
+++ b/milena/tests/world/kn/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/kn/is_2_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::kn::is_2_face(point2d(-1, -1)));
+ mln_assertion(!world::kn::is_2_face(point2d(-1, 0)));
+ mln_assertion(!world::kn::is_2_face(point2d(0, -1)));
+ mln_assertion(world::kn::is_2_face(point2d(0, 0)));
+}
diff --git a/milena/tests/world/kn/un_immerse.cc b/milena/tests/world/kn/un_immerse.cc
new file mode 100644
index 0000000..e05bc0e
--- /dev/null
+++ b/milena/tests/world/kn/un_immerse.cc
@@ -0,0 +1,67 @@
+// 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/kn/un_immerse.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[2][2] = {
+ {1, 2},
+ {3, 4}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[][19] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ };
+ image2d<int> imak4 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::kn::un_immerse(imak4, 4);
+ mln_assertion(imak0 == ref);
+}
--
1.7.2.5