qa_angle.cpp

00001 
00002 /***************************************************************************
00003  *  qa_angle.cpp - angle QA app
00004  *
00005  *  Created: Mon Jun 18 15:54:55
00006  *  Copyright  2007  Tim Niemueller [www.niemueller.de]
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. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #include <utils/math/angle.h>
00025 #include <cstdio>
00026 
00027 using namespace fawkes;
00028 
00029 int
00030 main(int argc, char **argv)
00031 {
00032   float f = -2 * M_PI;
00033   float fnm = normalize_mirror_rad(f);
00034   float expd = 0;
00035   printf("f=%f   normalize_mirror_rad(f)=%f   expected=%f\n", f, fnm, expd);
00036 
00037   f = 2 * M_PI;
00038   fnm = normalize_mirror_rad(f);
00039   expd = 0;
00040   printf("f=%f   normalize_mirror_rad(f)=%f   expected=%f\n", f, fnm, expd);
00041 
00042 
00043   f = 2 * M_PI + 1;
00044   fnm = normalize_mirror_rad(f);
00045   expd = 1;
00046   printf("f=%f   normalize_mirror_rad(f)=%f   expected=%f\n", f, fnm, expd);
00047 
00048 
00049   f = - 2 * M_PI - 1.4;
00050   fnm = normalize_mirror_rad(f);
00051   expd = -1.4;
00052   printf("f=%f   normalize_mirror_rad(f)=%f   expected=%f\n", f, fnm, expd);
00053 
00054 
00055   f = - 2 * M_PI - 2.9;
00056   fnm = normalize_mirror_rad(f);
00057   expd = -2.9;
00058   printf("f=%f   normalize_mirror_rad(f)=%f   expected=%f\n", f, fnm, expd);
00059 
00060 
00061   f = - 3 * M_PI - 1;
00062   fnm = normalize_mirror_rad(f);
00063   expd = f + 4 * M_PI;
00064   printf("f=%f   normalize_mirror_rad(f)=%f   expected=%f\n", f, fnm, expd);
00065 
00066 
00067   f = -M_PI;
00068   float fnr = normalize_rad(f);
00069   expd = M_PI;
00070   printf("f=%f   normalize_rad(f)=%f   expected=%f\n", f, fnr, expd);
00071 
00072   f = 3 * M_PI;
00073   fnr = normalize_rad(f);
00074   expd = M_PI;
00075   printf("f=%f   normalize_rad(f)=%f   expected=%f\n", f, fnr, expd);
00076 
00077   f = - 3 * M_PI;
00078   fnr = normalize_rad(f);
00079   expd = M_PI;
00080   printf("f=%f   normalize_rad(f)=%f   expected=%f\n", f, fnr, expd);
00081 
00082   f = - 2 * M_PI - 1;
00083   fnr = normalize_rad(f);
00084   expd = 2 * M_PI - 1;
00085   printf("f=%f   normalize_rad(f)=%f   expected=%f\n", f, fnr, expd);
00086 
00087   f = 10 * M_PI;
00088   fnr = normalize_rad(f);
00089   expd = 0;
00090   printf("f=%f   normalize_rad(f)=%f   expected=%f\n", f, fnr, expd);
00091 
00092   return 0;
00093 }

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