
* mln/core/alias/neighb3d.hh: add c8_3d. * mln/core/alias/window2d.hh: add win_c8p. * mln/core/alias/window3d.hh: add win_c4p_3d and win_c8p_3d. --- milena/ChangeLog | 10 +++++ milena/mln/core/alias/neighb3d.hh | 33 ++++++++++++++++ milena/mln/core/alias/window2d.hh | 30 +++++++++++++++ milena/mln/core/alias/window3d.hh | 74 +++++++++++++++++++++++++++++++++++++ 4 files changed, 147 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 9de7f13..8d754e2 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2009-03-02 Guillaume Lazzara <lazzara@lrde.epita.fr> + Add more window aliases. + + * mln/core/alias/neighb3d.hh: add c8_3d. + + * mln/core/alias/window2d.hh: add win_c8p. + + * mln/core/alias/window3d.hh: add win_c4p_3d and win_c8p_3d. + +2009-03-02 Guillaume Lazzara <lazzara@lrde.epita.fr> + Add missing traces in basic routines in geom/* (ticket #49). * mln/geom/bbox.hh, diff --git a/milena/mln/core/alias/neighb3d.hh b/milena/mln/core/alias/neighb3d.hh index 59d72bb..ad0545d 100644 --- a/milena/mln/core/alias/neighb3d.hh +++ b/milena/mln/core/alias/neighb3d.hh @@ -68,6 +68,25 @@ namespace mln /// const neighb3d& c4_3d(); + /// 8-connectivity neighborhood on the 3D grid. + /// + /// . . . + /// . . . + /// . . . + /// + /// o o o + /// o x o + /// o o o + /// + /// . . . + /// . . . + /// . . . + /// + /// \return A neighb3d. + /// + const neighb3d& c8_3d(); + + /*! \brief 6-connectivity neighborhood on the 3D grid. * * . . . @@ -159,6 +178,20 @@ namespace mln } inline + const neighb3d& c8_3d() + { + static neighb3d it; + if (it.size() == 0) + { + static const bool vals[] = { 1, 1, 1, + 1, 0, 1, + 1, 1, 1 }; + convert::from_to(vals, it); + } + return it; + } + + inline const neighb3d& c6() { static neighb3d it; diff --git a/milena/mln/core/alias/window2d.hh b/milena/mln/core/alias/window2d.hh index cd66a79..f1acabe 100644 --- a/milena/mln/core/alias/window2d.hh +++ b/milena/mln/core/alias/window2d.hh @@ -59,6 +59,16 @@ namespace mln /// \return A window2d. const window2d& win_c4p(); + /// \brief 8-connectivity window on the 2D grid, including the + /// center. + /// + /// o o o + /// o x o + /// o o o + /// + /// \return A window2d. + const window2d& win_c8p(); + namespace convert { @@ -96,6 +106,26 @@ namespace mln return it; } + inline const window2d& + win_c8p() + { + static window2d it; + if (it.size() == 0) + { + it + .insert(-1, -1) + .insert( 0, -1) + .insert(+1, -1) + .insert(-1, 0) + .insert( 0, 0) + .insert(+1, 0) + .insert(-1, +1) + .insert( 0, +1) + .insert(+1, +1); + } + return it; + } + namespace convert { diff --git a/milena/mln/core/alias/window3d.hh b/milena/mln/core/alias/window3d.hh index 04484fb..fe197f8 100644 --- a/milena/mln/core/alias/window3d.hh +++ b/milena/mln/core/alias/window3d.hh @@ -47,6 +47,44 @@ namespace mln /// the 3D square grid with integer coordinates. typedef window<mln::dpoint3d> window3d; + /// \brief 4-connectivity window on the 3D grid, including the + /// center. + /// + /// - - - + /// - - - + /// - - - + /// + /// - o - + /// o x o + /// - o - + /// + /// - - - + /// - - - + /// - - - + /// + /// + /// \return A window3d. + const window3d& win_c4p_3d(); + + /// \brief 8-connectivity window on the 3D grid, including the + /// center. + /// + /// - - - + /// - - - + /// - - - + /// + /// o o o + /// o x o + /// o o o + /// + /// - - - + /// - - - + /// - - - + /// + /// \return A window3d. + const window3d& win_c8p_3d(); + + namespace convert { @@ -65,6 +103,42 @@ namespace mln # ifndef MLN_INCLUDE_ONLY + inline const window3d& + win_c4p_3d() + { + static window3d it; + if (it.size() == 0) + { + it + .insert( 0, -1) + .insert(-1, 0) + .insert( 0, 0) + .insert(+1, 0) + .insert( 0, +1); + } + return it; + } + + inline const window3d& + win_c8p_3d() + { + static window3d it; + if (it.size() == 0) + { + it + .insert(-1, -1) + .insert( 0, -1) + .insert(+1, -1) + .insert(-1, 0) + .insert( 0, 0) + .insert(+1, 0) + .insert(-1, +1) + .insert( 0, +1) + .insert(+1, +1); + } + return it; + } + namespace convert { -- 1.5.6.5