https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Tiny fix in windows.
* mln/core/w_window.hh (is_symmetric): New.
* mln/border/duplicate.hh: Fix typo.
* mln/win/sym.hh: Fix copyright.
(sym): Add trace.
border/duplicate.hh | 2 +-
core/w_window.hh | 18 +++++++++++++++++-
win/sym.hh | 14 ++++++++++----
3 files changed, 28 insertions(+), 6 deletions(-)
Index: mln/core/w_window.hh
--- mln/core/w_window.hh (revision 2820)
+++ mln/core/w_window.hh (working copy)
@@ -116,6 +116,9 @@
const mln::window<D>& win() const;
+ /// Test if the window is symmetric.
+ bool is_symmetric() const;
+
/// Apply a central symmetry to the window.
void sym();
@@ -278,11 +281,24 @@
template <typename D, typename W>
inline
+ bool
+ w_window<D,W>::is_symmetric() const
+ {
+ if (! win_.is_symmetric())
+ return false;
+ w_window<D,W> tmp;
+ tmp.sym();
+ return *this == tmp;
+ }
+
+ template <typename D, typename W>
+ inline
void
w_window<D,W>::sym()
{
w_window<D,W> tmp;
- for (unsigned i = 0; i < this->size(); ++i)
+ unsigned n = this->size();
+ for (unsigned i = 0; i < n; ++i)
tmp.insert(this->w(i), - this->dp(i));
*this = tmp;
}
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 2820)
+++ mln/border/duplicate.hh (working copy)
@@ -46,7 +46,7 @@
{
/*! Assign the virtual (outer) border of image \p ima with the
- * dupplicate of the inner border of this image.
+ * duplicate of the inner border of this image.
*
* \param[in,out] ima The image whose border is to be duplicated.
*
Index: mln/win/sym.hh
--- mln/win/sym.hh (revision 2820)
+++ mln/win/sym.hh (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_WIN_SYM_HH
# define MLN_WIN_SYM_HH
-/*! \file mln/win/sym.hh
- *
- * \brief Give the symmetrical object.
- */
+/// \file mln/win/sym.hh
+///
+/// Give the symmetrical object.
# include <mln/core/concept/window.hh>
# include <mln/core/concept/weighted_window.hh>
@@ -61,8 +61,11 @@
inline
W sym(const Window<W>& win)
{
+ trace::entering("win::sym");
+ // mln_precondition(win.is_valid());
W tmp = exact(win);
tmp.sym();
+ trace::exiting("win::sym");
return tmp;
}
@@ -70,8 +73,11 @@
inline
W sym(const Weighted_Window<W>& w_win)
{
+ trace::entering("win::sym");
+ // mln_precondition(win.is_valid());
W tmp = exact(w_win);
tmp.sym();
+ trace::exiting("win::sym");
return tmp;
}