---
milena/ChangeLog | 7 +++-
milena/mln/world/kn/fill_1_from_2_faces.hh | 55 +++++-----------------------
2 files changed, 16 insertions(+), 46 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fe23428..0a784ae 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,4 +1,9 @@
-2012-11-01 Guillaume Lazzara <z(a)lrde.epita.fr>
+2012-11-01 Guilelaume Lazzara <z(a)lrde.epita.fr>
+
+ * mln/world/kn/fill_1_from_2_faces.hh: Rely on
+ fill_1_from_aux_2_faces.
+
+2012-11-01 Guilelaume Lazzara <z(a)lrde.epita.fr>
Add world::kn::fill_2_from_aux_1_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
index c190347..43dc6ac 100644
--- a/milena/mln/world/kn/fill_1_from_2_faces.hh
+++ b/milena/mln/world/kn/fill_1_from_2_faces.hh
@@ -30,11 +30,9 @@
#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>
-# include <mln/world/kn/border/compute_1_faces.hh>
-# include <mln/world/kn/safe_cast.hh>
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/world/kn/fill_1_from_aux_2_faces.hh>
namespace mln
{
@@ -84,59 +82,26 @@ namespace mln
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 Accumulator<A>&
accu)
{
trace::entering("mln::world::kn::fill_1_from_2_faces");
- I& inout = exact(inout_);
- mln_precondition(inout.is_valid());
-
- A accu = exact(accu_);
- typedef mln_argument(A) arg;
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (kn::is_1_face_vertical(p))
- {
- accu.init();
- if (inout.domain().has(p + left))
- accu.take(safe_cast_to<arg>(inout(p + left)));
- if (inout.domain().has(p + right))
- accu.take(safe_cast_to<arg>(inout(p + right)));
- inout(p) = safe_cast(accu.to_result());
- }
- else if (is_1_face_horizontal(p))
- {
- accu.init();
- if (inout.domain().has(p + up))
- accu.take(safe_cast_to<arg>(inout(p + up)));
- if (inout.domain().has(p + down))
- accu.take(safe_cast_to<arg>(inout(p + down)));
- inout(p) = safe_cast(accu.to_result());
- }
+ mln_precondition(exact(inout).is_valid());
+
+ kn::fill_1_from_aux_2_faces(inout, inout, accu);
trace::exiting("mln::world::kn::fill_1_from_2_faces");
}
template <typename I, typename F>
- void fill_1_from_2_faces(Image<I>& inout_, const
Function_vv2v<F>& f_)
+ void fill_1_from_2_faces(Image<I>& inout, const
Function_vv2v<F>& f)
{
trace::entering("mln::world::kn::fill_1_from_2_faces");
- I& inout = exact(inout_);
- const F& f = exact(f_);
- mln_precondition(inout.is_valid());
-
- kn::border::compute_1_faces(inout, f);
+ mln_precondition(exact(inout).is_valid());
- mln_piter(I) p(inout.domain());
- for_all(p)
- if (kn::is_1_face_vertical(p))
- inout(p) = safe_cast(f(safe_cast(inout(p + left)),
- safe_cast(inout(p + right))));
- else if (is_1_face_horizontal(p))
- inout(p) = safe_cast(f(safe_cast(inout(p + up)),
- safe_cast(inout(p + down))));
+ kn::fill_1_from_aux_2_faces(inout, inout, f);
trace::exiting("mln::world::kn::fill_1_from_2_faces");
}
--
1.7.2.5
Show replies by date