qa_vector.cpp

00001 
00002 /***************************************************************************
00003  *  qa_matrix.cpp - DESC
00004  *
00005  *  Created:  Fri Feb 17 14:31:48 2009
00006  *  Copyright 2009 Christof Rath <christof.rath@gmail.com>
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 /// @cond EXAMPLES
00023 
00024 #include <geometry/vector.h>
00025 #include <utils/time/tracker.h>
00026 #include <core/exceptions/software.h>
00027 
00028 #include <iostream>
00029 #include <cmath>
00030 
00031 using namespace fawkes;
00032 using namespace std;
00033 
00034 int
00035 main(int argc, char **argv)
00036 {
00037 //  TimeTracker *tt = new TimeTracker();
00038 //  unsigned int loop_count = 0;
00039 //  unsigned int ttc_trans = tt->add_class("Tra");
00040 //  unsigned int ttc_rot = tt->add_class("Rot");
00041 //  unsigned int ttc_inv = tt->add_class("Inv");
00042 
00043   Vector v1;
00044   v1.x(1);
00045   v1.y(2);
00046   v1.z(3);
00047 
00048   cout << "v1: " << v1 << endl;
00049   Vector v2 = v1 / 10;
00050   cout << "v2 = v1 / 10: " << v2 << endl;
00051   v1 /= 10;
00052   cout << "v1 /= 10: " << v1 << endl << endl << endl;
00053 
00054   Vector v4;
00055   v4.x(1);
00056   v4.y(2);
00057   v4.z(3);
00058 
00059   Vector v5;
00060   v5.x(4);
00061   v5.y(5);
00062   v5.z(6);
00063 
00064   Vector v6(4);
00065   v6.x(7);
00066   v6.y(8);
00067   v6.z(9);
00068 
00069   cout << "v4: " << v4 << " v5: " << v5 << endl;
00070   Vector v7 = v4 + v5;
00071   cout << "v7 = v4 + v5: " << v7 << endl;
00072   v4 += v5;
00073   cout << "v4 += v5: " << v4 << endl << endl;
00074 
00075   try {
00076     Vector v8 = v4 + v6;
00077   }
00078   catch (fawkes::TypeMismatchException &e) {
00079     cout << e.what() << endl << endl << endl;
00080   }
00081 
00082   try {
00083     v4 += v6;
00084   }
00085   catch (fawkes::TypeMismatchException &e) {
00086     cout << e.what() << endl << endl << endl;
00087   }
00088 }
00089 
00090 
00091 /// @endcond

Generated on Tue Feb 22 13:31:26 2011 for Fawkes API by  doxygen 1.4.7