cleanup-2008 2369: Add basic conversion + minor fixes.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Add basic conversion + minor fixes. * mln/border/adjust.hh: Remove wrong check. * mln/convert/from_to.hh: Add vec to rgb. * mln/fun/x2x/translation.hh: Fix matrix update. border/adjust.hh | 6 ++++-- convert/from_to.hh | 15 +++++++++++++++ fun/x2x/translation.hh | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) Index: mln/border/adjust.hh --- mln/border/adjust.hh (revision 2368) +++ mln/border/adjust.hh (working copy) @@ -35,7 +35,7 @@ */ # include <mln/border/resize.hh> - +# include <mln/metal/is.hh> namespace mln { @@ -66,7 +66,9 @@ { trace::entering("border::adjust"); - mlc_is(mln_trait_image_border(I), trait::image::border::some)::check(); + //FIXME: fix this check + //mlc_is(mln_trait_image_border(I), + // trait::image::border::some)::check(); const I& ima = exact(ima_); mln_precondition(ima.has_data()); Index: mln/convert/from_to.hh --- mln/convert/from_to.hh (revision 2368) +++ mln/convert/from_to.hh (working copy) @@ -40,6 +40,7 @@ # include <mln/core/concept/object.hh> # include <mln/core/concept/gpoint.hh> # include <mln/value/concept/all.hh> +# include <mln/value/rgb.hh> # include <mln/convert/impl/all.hh> @@ -117,6 +118,20 @@ to[i] = static_cast< typename P::coord >(from[i]); } + // algebra::vec -> rgb. + template <typename T, unsigned m> + inline + void + from_to_(const algebra::vec<3,T>& from, value::rgb<m>& to_) + { + value::rgb<m>& to = exact(to_); + algebra::vec<3, unsigned> tmp; + for (unsigned i = 0; i < 3; ++i) + tmp[i] = static_cast<unsigned>(from[i]); + + to = value::rgb<m>(tmp); + } + template <typename F, typename T> inline Index: mln/fun/x2x/translation.hh --- mln/fun/x2x/translation.hh (revision 2368) +++ mln/fun/x2x/translation.hh (working copy) @@ -95,7 +95,6 @@ translation<n,C>::translation(const algebra::vec<n,C>& t) :t_(t) { - this->m_ = algebra::h_mat<n,C>::Id; this->update(); } @@ -131,6 +130,7 @@ void translation<n,C>::update() { + this->m_ = algebra::h_mat<n,C>::Id; for (unsigned i = 0; i < n; ++i) this->m_(i,n) = this->t_[i]; } Index: mln/algebra/mat.hh
participants (1)
-
Ugo Jardonnet