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 <iostream>
00027 #include <mln/fun/x2x/translation.hh>
00028 #include <mln/fun/x2x/rotation.hh>
00029 #include <mln/fun/x2x/composed.hh>
00030 #include <mln/fun/i2v/all_to.hh>
00031
00032
00033
00034 int main()
00035 {
00036 using namespace mln;
00037
00038 float
00039 a = 2.3,
00040 b = 0,
00041 c = 2.9;
00042
00043 algebra::vec<3,float> vec1 = make::vec(a, b, c);
00044 fun::x2x::translation<3,float> tr(all_to(1.6));
00045 algebra::vec<3,float> axis;
00046 axis[0] = 0;
00047 axis[1] = 1;
00048 axis[0] = 0;
00049 fun::x2x::rotation<3,float> rot(0.3, axis);
00050
00051 std::cout << "vec : " << vec1 << std::endl;
00052 std::cout << "tr(vec) : " << tr(vec1) << std::endl;
00053 std::cout << "rot(vec) : " << rot(vec1) << std::endl;
00054 std::cout << "tr(rot(vec)) : " << compose(tr, rot)(vec1) << std::endl;
00055 std::cout << "rot(rot_1(vec)) : " << compose(rot, rot.inv())(vec1)
00056 << std::endl;
00057 std::cout << "tr(rot(tr(vec))) : " << compose(tr, compose(rot, tr))(vec1)
00058 << std::endl;
00059 std::cout << "(rototr_1)(rot(tr(vec)))) : "
00060 << compose(compose(rot, tr).inv(), compose(rot, tr))(vec1)
00061 << std::endl;
00062 mln_assertion(fabs(compose(rot, tr)(vec1)[0] - rot(tr(vec1))[0]) <= 0.125);
00063 mln_assertion(fabs(compose(rot, tr)(vec1)[1] - rot(tr(vec1))[1]) <= 0.125);
00064 mln_assertion(fabs(compose(rot, tr)(vec1)[2] - rot(tr(vec1))[2]) <= 0.125);
00065 }