
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena ChangeLog: 2008-10-21 Matthieu Garrigues <garrigues@lrde.epita.fr> Fix chamfer. * mln/canvas/chamfer.hh: use image2d.domain.has method instead of image2d.has. * mln/geom/chamfer.hh: Fix output initialisation. --- canvas/chamfer.hh | 4 ++-- geom/chamfer.hh | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) Index: branches/cleanup-2008/milena/mln/geom/chamfer.hh =================================================================== --- branches/cleanup-2008/milena/mln/geom/chamfer.hh (revision 2615) +++ branches/cleanup-2008/milena/mln/geom/chamfer.hh (revision 2616) @@ -69,6 +69,7 @@ struct chamfer_t { typedef I_ I; + typedef mln_ch_value(I, unsigned) O; typedef W_ W; typedef mln_site(I_) P; @@ -77,14 +78,30 @@ const I& input; const W& win; - mln_ch_value(I_, unsigned) output; + O output; bool status; unsigned max; + void fill_output() + { + mln_piter(O) p(output.domain()); + for_all(p) + { + if (input(p) == true) + output(p) = 0; + else + output(p) = max; + } + } + inline void init() { initialize(output, exact(input)); - level::fill((output | (input | pw::cst(true)).domain()).rw(), 0); - level::fill((output | (input | pw::cst(false)).domain()).rw(), max); } + fill_output(); + // Was : + // level::fill((output | (input | pw::cst(true)).domain()).rw(), 0); + // level::fill((output | (input | pw::cst(false)).domain()).rw(), max); + debug::println(output); + } inline bool handles(const P& p) const { return input(p) == false; } Index: branches/cleanup-2008/milena/mln/canvas/chamfer.hh =================================================================== --- branches/cleanup-2008/milena/mln/canvas/chamfer.hh (revision 2615) +++ branches/cleanup-2008/milena/mln/canvas/chamfer.hh (revision 2616) @@ -86,7 +86,7 @@ mln_qiter(W) q(f.win, p); for_all(p) if (f.handles (p)) - for_all(q) if (f.input.has(q)) + for_all(q) if (f.input.domain().has(q)) if (f.output(q) != f.max && f.output(q) + q.w() < f.output(p)) f.output(p) = f.output(q) + q.w(); @@ -100,7 +100,7 @@ mln_qiter(W) q(w_win_b, p); for_all(p) if (f.handles (p)) - for_all(q) if (f.input.has(q)) + for_all(q) if (f.input.domain().has(q)) if (f.output(q) != f.max && f.output(q) + q.w() < f.output(p)) f.output(p) = f.output(q) + q.w();
participants (1)
-
Matthieu Garrigues