* mln/geom/all.hh: Include rotate.hh.
* tests/transformation/rotate.cc,
* mln/transformation/rotate.hh: Move...
* tests/geom/rotate.cc,
* mln/geom/rotate.hh: ... here.
* mln/transformation/all.hh,
* mln/transformation/essential.hh,
* tests/transformation/Makefile.am: Remove.
* tests/geom/Makefile.am: add rotate.
---
milena/ChangeLog | 17 ++++++
milena/mln/geom/all.hh | 4 +-
milena/mln/{transformation => geom}/rotate.hh | 61 ++++++++++++++++------
milena/mln/transformation/all.hh | 43 ----------------
milena/mln/transformation/essential.hh | 31 ------------
milena/tests/geom/Makefile.am | 2 +
milena/tests/{transformation => geom}/rotate.cc | 4 +-
milena/tests/transformation/Makefile.am | 27 ----------
8 files changed, 68 insertions(+), 121 deletions(-)
rename milena/mln/{transformation => geom}/rotate.hh (65%)
delete mode 100644 milena/mln/transformation/all.hh
delete mode 100644 milena/mln/transformation/essential.hh
rename milena/tests/{transformation => geom}/rotate.cc (95%)
delete mode 100644 milena/tests/transformation/Makefile.am
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1b6acde..68068a4 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,20 @@
+2009-06-30 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
+ Move transformation::rotate to geom::rotate.
+
+ * mln/geom/all.hh: Include rotate.hh.
+
+ * tests/transformation/rotate.cc,
+ * mln/transformation/rotate.hh: Move...
+ * tests/geom/rotate.cc,
+ * mln/geom/rotate.hh: ... here.
+
+ * mln/transformation/all.hh,
+ * mln/transformation/essential.hh,
+ * tests/transformation/Makefile.am: Remove.
+
+ * tests/geom/Makefile.am: add rotate.
+
2009-06-29 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
* tests/geom/Makefile.am: remove rotate from test list.
diff --git a/milena/mln/geom/all.hh b/milena/mln/geom/all.hh
index 628401c..f2d1fd3 100644
--- a/milena/mln/geom/all.hh
+++ b/milena/mln/geom/all.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -61,6 +62,7 @@ namespace mln
# include <mln/geom/nsites.hh>
# include <mln/geom/nslis.hh>
# include <mln/geom/pmin_pmax.hh>
+# include <mln/geom/rotate.hh>
# include <mln/geom/seeds2tiling.hh>
# include <mln/geom/seeds2tiling_roundness.hh>
# include <mln/geom/size1d.hh>
diff --git a/milena/mln/transformation/rotate.hh b/milena/mln/geom/rotate.hh
similarity index 65%
rename from milena/mln/transformation/rotate.hh
rename to milena/mln/geom/rotate.hh
index 0e1b698..e3a5094 100644
--- a/milena/mln/transformation/rotate.hh
+++ b/milena/mln/geom/rotate.hh
@@ -23,8 +23,15 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_TRANSFORMATION_ROTATE_HH
-# define MLN_TRANSFORMATION_ROTATE_HH
+/// \file
+///
+/// Rotate an image.
+
+#ifndef MLN_GEOM_ROTATE_HH
+# define MLN_GEOM_ROTATE_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/site_set.hh>
# include <mln/core/routine/extend.hh>
@@ -46,23 +53,31 @@
namespace mln
{
- namespace transformation
+ namespace geom
{
/// Perform a rotation from the center of an image.
///
- /// \param[in] input_ An image.
- /// \param[in] angle An angle in degrees.
- /// \param[in] extension_ Function, image or value which will be used as
- /// extension. This extension allows to map values
- /// to sites which where not part of the domain
- /// before the rotation.
+ /// \param[in] input_ An image.
+ /// \param[in] angle An angle in degrees.
+ /// \param[in] extension_ Function, image or value which will be used
+ /// as extension. This extension allows to map
+ /// values to sites which where not part
+ /// of the domain before the rotation.
+ /// \param[in] output_domain_ The domain of the output image.
///
/// \return An image with the same domain as \p input_.
//
+ template <typename I, typename Ext, typename S>
+ mln_concrete(I)
+ rotate(const Image<I>& input_, double angle,
+ const Ext& extension_, const Site_Set<S>& output_domain);
+
+
+ /// \overload
template <typename I, typename Ext>
mln_concrete(I)
- rotate(const Image<I>& input_, double angle, const Ext& extension_);
+ rotate(const Image<I>& input, double angle, const Ext& extension);
/// \overload
@@ -75,16 +90,19 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename Ext>
+ template <typename I, typename Ext, typename S>
mln_concrete(I)
- rotate(const Image<I>& input_, double angle, const Ext& extension_)
+ rotate(const Image<I>& input_, double angle,
+ const Ext& extension_, const Site_Set<S>& output_domain_)
{
- trace::entering("transformation::rotate");
+ trace::entering("geom::rotate");
const I& input = exact(input_);
+ const S& output_domain = exact(output_domain_);
mln_precondition(input.is_valid());
mln_precondition(angle >= -360.0f && angle <= 360.0f);
+ mlc_converts_to(Ext, mln_value(I))::check();
/// FIXME: A precondition is probably missing for the extension value.
mln_site(I) c = geom::bbox(input).center();
@@ -97,16 +115,25 @@ namespace mln
mln_concrete(I) output;
initialize(output, input);
- data::paste(transposed_image(input.domain(),
+
+ data::paste(transposed_image(output_domain_,
extend(input, extension_),
compose(t_1, compose(rot, t))),
output);
- trace::exiting("transformation::rotate");
+ trace::exiting("geom::rotate");
return output;
}
+ template <typename I, typename Ext>
+ mln_concrete(I)
+ rotate(const Image<I>& input, double angle, const Ext& extension)
+ {
+ return rotate(input, angle, extension, exact(input).domain());
+ }
+
+
template <typename I>
mln_concrete(I)
rotate(const Image<I>& input, double angle)
@@ -118,9 +145,9 @@ namespace mln
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::transformation
+ } // end of namespace mln::geom
} // end of namespace mln
-#endif // ! MLN_TRANSFORMATION_ROTATE_HH
+#endif // ! MLN_GEOM_ROTATE_HH
diff --git a/milena/mln/transformation/all.hh b/milena/mln/transformation/all.hh
deleted file mode 100644
index 0b2cfa1..0000000
--- a/milena/mln/transformation/all.hh
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project 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.
-
-#ifndef MLN_TRANSFORMATION_ALL_HH
-# define MLN_TRANSFORMATION_ALL_HH
-
-namespace mln
-{
-
- /// Namespace of transformation routines.
- namespace transformation
- {
-
- } // end of namespace mln::transformation
-
-} // end of namespace mln
-
-
-# include <mln/transformation/rotate.hh>
-
-#endif // ! MLN_TRANSFORMATION_ALL_HH
diff --git a/milena/mln/transformation/essential.hh b/milena/mln/transformation/essential.hh
deleted file mode 100644
index 7058302..0000000
--- a/milena/mln/transformation/essential.hh
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project 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.
-
-#ifndef MLN_TRANSFORMATION_ESSENTIAL_HH
-# define MLN_TRANSFORMATION_ESSENTIAL_HH
-
-// None.
-
-#endif // ! MLN_TRANSFORMATION_ESSENTIAL_HH
diff --git a/milena/tests/geom/Makefile.am b/milena/tests/geom/Makefile.am
index fae2c31..8572a6b 100644
--- a/milena/tests/geom/Makefile.am
+++ b/milena/tests/geom/Makefile.am
@@ -35,6 +35,7 @@ nrows \
nsites \
nslis \
pmin_pmax \
+rotate \
seed2tiling \
seed2tiling_roundness
@@ -54,6 +55,7 @@ nrows_SOURCES = nrows.cc
nsites_SOURCES = nsites.cc
nslis_SOURCES = nslis.cc
pmin_pmax_SOURCES = pmin_pmax.cc
+rotate_SOURCES = rotate.cc
seed2tiling_SOURCES = seed2tiling.cc
seed2tiling_roundness_SOURCES = seed2tiling_roundness.cc
diff --git a/milena/tests/transformation/rotate.cc b/milena/tests/geom/rotate.cc
similarity index 95%
rename from milena/tests/transformation/rotate.cc
rename to milena/tests/geom/rotate.cc
index b8f8283..bd2e1f0 100644
--- a/milena/tests/transformation/rotate.cc
+++ b/milena/tests/geom/rotate.cc
@@ -24,7 +24,7 @@
// executable file might be covered by the GNU General Public License.
# include <mln/core/image/image2d.hh>
-# include <mln/transformation/rotate.hh>
+# include <mln/geom/rotate.hh>
# include <mln/make/image.hh>
# include <mln/data/compare.hh>
@@ -47,7 +47,7 @@ int main()
image2d<bool> ima = make::image(values);
image2d<bool> ref = make::image(ref_values);
- image2d<bool> ima_rot = transformation::rotate(ima, 45);
+ image2d<bool> ima_rot = geom::rotate(ima, 45);
mln_assertion(ima_rot == ref);
}
diff --git a/milena/tests/transformation/Makefile.am b/milena/tests/transformation/Makefile.am
deleted file mode 100644
index 4293f2c..0000000
--- a/milena/tests/transformation/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
-#
-# This file is part of Olena.
-#
-# Olena is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, version 2 of the License.
-#
-# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
-#
-
-## Process this file through Automake to create Makefile.in.
-
-include $(top_srcdir)/milena/tests/tests.mk
-
-check_PROGRAMS = \
- rotate
-
-rotate_SOURCES = rotate.cc
-
-TESTS = $(check_PROGRAMS)
--
1.5.6.5