Commit 899f6280 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add a new meta tool to deduce an extension type.

	mln/core/routine/extend.hh: Introduce a new macro
	mln_extension_type.

	mln/geom/rotate.hh: Make use of this new macro.
parent 98cab347
2010-05-25 Guillaume Lazzara <z@lrde.epita.fr>
Add a new meta tool to deduce an extension type.
mln/core/routine/extend.hh: Introduce a new macro
mln_extension_type.
mln/geom/rotate.hh: Make use of this new macro.
2010-05-25 Guillaume Lazzara <z@lrde.epita.fr>
 
Reduce precision issues in transformations.
 
* milena/mln/core/image/imorph/interpolated.hh: Make the vector
type more generic.
* mln/core/image/imorph/interpolated.hh: Make the vector type more
generic.
 
* milena/mln/core/point.hh: Provide specific conversion operators
for float and double.
* mln/core/point.hh: Provide specific conversion operators for
float and double.
 
* milena/mln/fun/internal/x2x_linear_impl.hh: Allow to set the
matrix value type.
* mln/fun/internal/x2x_linear_impl.hh: Allow to set the matrix
value type.
 
* milena/mln/fun/x2x/composed.hh,
* milena/mln/fun/x2x/rotation.hh,
* milena/mln/fun/x2x/translation.hh: Introduce data_t typedef
passed to x2x_linear_impl.
* mln/fun/x2x/composed.hh,
* mln/fun/x2x/rotation.hh,
* mln/fun/x2x/translation.hh: Introduce data_t typedef passed to
x2x_linear_impl.
 
2010-04-30 Guillaume Lazzara <z@lrde.epita.fr>
 
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -38,11 +39,65 @@
# include <mln/core/image/dmorph/extension_fun.hh>
# include <mln/core/image/dmorph/extension_val.hh>
# include <mln/trait/undef.hh>
# define mln_extension_type(I,J) \
typename mln::internal::extension_type<I,J>::result;
# define mln_extension_type_(I,J) \
mln::internal::extension_type<I,J>::result;
namespace mln
{
namespace internal
{
template <typename I, typename J, typename B1, typename B2>
struct extension_type_selector
{
typedef mln::trait::undef result;
};
template <typename I, typename J>
struct extension_type_selector<I,J,
metal::bool_<false>, metal::bool_<false> >
: mlc_converts_to(J, mln_value(I))::check_t
{
typedef extension_val<I> result;
};
template <typename I, typename J>
struct extension_type_selector<I,J,
metal::bool_<false>, metal::bool_<true> >
{
typedef extension_fun<I, J> result;
};
template <typename I, typename J>
struct extension_type_selector<I,J,
metal::bool_<true>, metal::bool_<false> >
{
typedef extension_ima<I, J> result;
};
template <typename I, typename J>
struct extension_type
: extension_type_selector<I, J,
typename mlc_is_a(J,Image)::eval,
typename mlc_is_a(J,Function)::eval>
{
};
} // end of namespace mln::internal
/// Routines for domain extension with a function.
......
......@@ -45,6 +45,8 @@
# include <mln/geom/bbox.hh>
# include <mln/extension/duplicate.hh>
# include <mln/fun/x2x/composed.hh>
# include <mln/fun/x2x/rotation.hh>
# include <mln/fun/x2x/translation.hh>
......@@ -112,10 +114,12 @@ namespace mln
// further in this routine, we define a default domain.
mln_precondition(input.is_valid());
mln_precondition(angle >= -360.0f && angle <= 360.0f);
mlc_converts_to(mln_exact(Ext), mln_value(I))::check();
// mlc_converts_to(mln_exact(Ext), mln_value(I))::check();
mlc_is_a(S,Box)::check();
// FIXME: A precondition is probably missing for the extension value.
extension::duplicate(input);
mln_site(I) c = geom::bbox(input).pcenter();
typedef fun::x2x::translation<2,double> trans_t;
trans_t
......@@ -145,9 +149,12 @@ namespace mln
}
typedef
tr_image<mln_box(I), extension_val<const I>, comp_transf_t> tr_t;
typename mln::internal::extension_type<const I, mln_exact(Ext)>::result ext_t;
typedef
tr_image<mln_box(I), ext_t, comp_transf_t> tr_t;
tr_t tr = transposed_image(b, extend(input, extension), comp_transf);
tr_t tr = transposed_image(b, ext_t(input, extension), comp_transf);
typedef mln_site(I) P;
P rpmin = P(rot(input.domain().pmin().to_vec()));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment