URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-13 Simon Nivault <simon.nivault(a)lrde.epita.fr>
disk2d windows well created, fix on sym
* mln/core/win/disk2d.hh: Well created.
* mln/geom/sym.hh: Fixed.
* tests/win_disk2d.cc: New.
---
mln/core/win/disk2d.hh | 7 ++++++-
mln/geom/sym.hh | 4 ++--
tests/win_disk2d.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 3 deletions(-)
Index: trunk/milena/tests/win_disk2d.cc
===================================================================
--- trunk/milena/tests/win_disk2d.cc (revision 0)
+++ trunk/milena/tests/win_disk2d.cc (revision 1108)
@@ -0,0 +1,48 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library 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 this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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 tests/win_diag2d.cc
+ *
+ * \brief Tests on mln::win::diag2d.
+ */
+
+#include <mln/core/win/disk2d.hh>
+
+#include <mln/convert/to_image.hh>
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned l = 55;
+ win::disk2d disk(l);
+
+ debug::println(convert::to_image(disk));
+}
+
Index: trunk/milena/mln/geom/sym.hh
===================================================================
--- trunk/milena/mln/geom/sym.hh (revision 1107)
+++ trunk/milena/mln/geom/sym.hh (revision 1108)
@@ -34,7 +34,7 @@
*/
# include <mln/core/concept/window.hh>
-# include <mln/core/concept/w_window.hh>
+# include <mln/core/concept/weighted_window.hh>
@@ -67,7 +67,7 @@
template <typename W>
W sym(const Weighted_Window<W>& w_win)
{
- W tmp = exact(win);
+ W tmp = exact(w_win);
return tmp.sym();
}
Index: trunk/milena/mln/core/win/disk2d.hh
===================================================================
--- trunk/milena/mln/core/win/disk2d.hh (revision 1107)
+++ trunk/milena/mln/core/win/disk2d.hh (revision 1108)
@@ -129,7 +129,12 @@
: length_(length)
{
mln_precondition(length % 2 == 1);
- insert(dpoint2d::zero); //FIXME : Do the right insert.
+ const int r = length / 2;
+ const int r2 = r * r;
+ for (int a = -r; a <= r; ++a)
+ for (int b = -r; b <= r; ++b)
+ if (a * a + b * b <= r2)
+ insert(make::dpoint2d(a, b));
}
bool disk2d::is_centered() const