00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <mln/core/alias/box1d.hh>
00027 #include <mln/core/alias/box2d.hh>
00028 #include <mln/core/alias/box3d.hh>
00029 #include <mln/core/box_runstart_piter.hh>
00030
00031 int main()
00032 {
00033 using namespace mln;
00034
00036 {
00037 box1d b1(point1d(40), point1d(42));
00038 box_runstart_piter<point1d> p1(b1);
00039 for_all(p1)
00040 {
00041 mln_assertion(p1[0] == 40);
00042 std::cout << p1 <<std::endl;
00043 }
00044 std::cout << "run_len : " << p1.run_length()<<std::endl;
00045 mln_assertion(p1.run_length() == 3);
00046 }
00047
00048
00050 {
00051 box2d b2(point2d(1,2), point2d(5,8));
00052 box_runstart_piter<point2d> p2(b2);
00053 int i = 1;
00054 for_all(p2)
00055 {
00056 mln_assertion(p2[1] == 2 && p2[0] == i++);
00057 std::cout << p2 <<std::endl;
00058 }
00059 std::cout << "run_len : " << p2.run_length()<<std::endl;
00060 mln_assertion(p2.run_length() == 7);
00061 }
00062
00063
00064 {
00065 box3d b3(point3d(1,2,3), point3d(5,8,7));
00066 box_runstart_piter<point3d> p3(b3);
00067 int i = 1;
00068 int j = 2;
00069 for_all(p3)
00070 {
00071 std::cout << p3 << std::endl;
00072 if (i++ == 5)
00073 i = 1;
00074 if (j++ == 8)
00075 j = 2;
00076 }
00077 std::cout << "run_len : " << p3.run_length() << std::endl;
00078 mln_assertion(p3.run_length() == 5);
00079 }
00080
00081 }