
* mln/topo/is_simple_2d.hh (mln::topo::is_simple_2d_t<N>::nb_connectivity2d): (mln::topo::is_simple_2d_t<N>::nb_connectivity2d__): Use a more reliable method to identify the neighborhood. * mln/topo/is_simple_point2d.hh: Typo in comment. --- milena/ChangeLog | 10 +++++++++ milena/mln/topo/is_simple_2d.hh | 38 ++++++++++++++-------------------- milena/mln/topo/is_simple_point2d.hh | 4 ++-- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index fc897d2..e282864 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2013-08-28 Roland Levillain <roland@lrde.epita.fr> + Improve mln::topo::is_simple_2d_t. + + * mln/topo/is_simple_2d.hh + (mln::topo::is_simple_2d_t<N>::nb_connectivity2d): + (mln::topo::is_simple_2d_t<N>::nb_connectivity2d__): + Use a more reliable method to identify the neighborhood. + * mln/topo/is_simple_point2d.hh: Typo in comment. + +2013-08-28 Roland Levillain <roland@lrde.epita.fr> + Reintroduce is_simple_2d and connectivity_number_2d into mln::topo. * mln/topo/is_simple_2d.hh (mln::topo::is_simple_2d) diff --git a/milena/mln/topo/is_simple_2d.hh b/milena/mln/topo/is_simple_2d.hh index 30cccf5..123e805 100644 --- a/milena/mln/topo/is_simple_2d.hh +++ b/milena/mln/topo/is_simple_2d.hh @@ -241,18 +241,15 @@ namespace mln res = res | 1; } - switch (nbh.size()) - { - case 4: // C4 - return internal::connectivity_number_c4[res]; - case 8: // C8 - return internal::connectivity_number_c8[res]; - default: - mln_assertion(0); - - } + unsigned number; + if (nbh == c4()) + number = internal::connectivity_number_c4[res]; + else if (nbh == c8()) + number = internal::connectivity_number_c8[res]; + else + abort(); - return 0; + return number; } @@ -277,18 +274,15 @@ namespace mln res = res | 1; } - switch (nbh.size()) - { - case 4: // C4 - return internal::connectivity_number_c4[res]; - case 8: // C8 - return internal::connectivity_number_c8[res]; - default: - mln_assertion(0); - - } + unsigned number; + if (nbh == c4()) + number = internal::connectivity_number_c4[res]; + else if (nbh == c8()) + number = internal::connectivity_number_c8[res]; + else + abort(); - return 0; + return number; } diff --git a/milena/mln/topo/is_simple_point2d.hh b/milena/mln/topo/is_simple_point2d.hh index 145b9d8..0efa646 100644 --- a/milena/mln/topo/is_simple_point2d.hh +++ b/milena/mln/topo/is_simple_point2d.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -43,7 +43,7 @@ namespace mln { /** \brief A predicate for the simplicity of an mln::point2d based - on based on the mask-based criterion mln::topo::is_simple_2d. + on the mask-based criterion mln::topo::is_simple_2d. This functor acts as an adapter, since mln::topo::is_simple_2d does not fit (yet) in the canvas of -- 1.7.10.4