URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-25 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update draw mesh.
* draw_mesh.hh,
* main.cc: Update.
---
draw_mesh.hh | 18 ++++++++++++++++++
main.cc | 12 ++++++------
2 files changed, 24 insertions(+), 6 deletions(-)
Index: trunk/milena/sandbox/duhamel/draw_mesh.hh
===================================================================
--- trunk/milena/sandbox/duhamel/draw_mesh.hh (revision 1177)
+++ trunk/milena/sandbox/duhamel/draw_mesh.hh (revision 1178)
@@ -20,7 +20,25 @@
point2d p2,
mln_value(I) link_v)
{
+ mln_dpoint(I) d = p1 - p2;
+ float e = 0.5;
+ if (!d[0])
+ return;
+ float e1 = (float)d[1] / (float)d[0];
+ std::cout << " " << d[1] << " " << d[0]
<< " "<< e1 << std::endl;
+ float e2 = -1.0;
+ int y = p1[1];
+ for (int x = p1[0]; x < p2[0]; ++x)
+ {
+ exact(ima)(make::point2d(x,y)) = link_v;
+ e += e1;
+ if (e >= 0.5)
+ {
+ ++y;
+ e += e2;
+ }
+ }
}
template <typename I, typename P>
Index: trunk/milena/sandbox/duhamel/main.cc
===================================================================
--- trunk/milena/sandbox/duhamel/main.cc (revision 1177)
+++ trunk/milena/sandbox/duhamel/main.cc (revision 1178)
@@ -19,23 +19,23 @@
g.add_node ();
g.add_edge (0, 1);
- g.add_edge (1, 2);
g.add_edge (0, 2);
- g.add_edge (2, 3);
- g.add_edge (0, 3);
+// g.add_edge (0, 2);
+// g.add_edge (2, 3);
+// g.add_edge (0, 3);
g.coherence ();
// g.print_debug ();
std::vector<point2d> v;
v.push_back (make::point2d (1,2));
- v.push_back (make::point2d (14,6));
+ v.push_back (make::point2d (5,6));
v.push_back (make::point2d (1,15));
- v.push_back (make::point2d (16,19));
+ v.push_back (make::point2d (16,5));
image2d_b<int> ima (20, 20, 1);
Mesh_p<point2d> m(g, v);
- draw::mesh (ima, m, 42, 1);
+ draw::mesh (ima, m, 7, 1);
debug::println (ima);
}