00001 /*========================================================================= 00002 UberSim Source Code Release 00003 ------------------------------------------------------------------------- 00004 Copyright (C) 2002 Manuela Veloso, Brett Browning, Mike Bowling, 00005 James Bruce; {mmv, brettb, mhb, jbruce}@cs.cmu.edu 00006 Erick Tryzelaar {erickt}@andrew.cmu.edu 00007 School of Computer Science, Carnegie Mellon University 00008 ------------------------------------------------------------------------- 00009 This software is distributed under the GNU General Public License, 00010 version 2. If you do not have a copy of this licence, visit 00011 www.gnu.org, or write: Free Software Foundation, 59 Temple Place, 00012 Suite 330 Boston, MA 02111-1307 USA. This program is distributed 00013 in the hope that it will be useful, but WITHOUT ANY WARRANTY, 00014 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 -------------------------------------------------------------------------*/ 00016 00017 #ifndef __SIM_MATH_H__ 00018 #define __SIM_MATH_H__ 00019 00025 typedef double Real; 00026 00027 class Math 00028 { 00029 public: 00030 static const Real INF; 00031 static const Real PI; 00032 static const Real TWO_PI; 00033 static const Real HALF_PI; 00034 static const Real FOURTH_PI; 00035 static const Real RAD_TO_DEG; 00036 static const Real DEG_TO_RAD; 00037 00038 public: 00039 static Real abs (Real r); 00040 static Real sign (Real r); 00041 static Real sqrt (Real r); 00042 static Real min (Real r1, Real r2); 00043 static Real max (Real r1, Real r2); 00044 00045 public: 00046 static Real sin (Real a); 00047 static Real cos (Real a); 00048 static Real tan (Real a); 00049 00050 static Real asin (Real r); 00051 static Real acos (Real r); 00052 static Real atan (Real r); 00053 static Real atan2 (Real y, Real x); 00054 00055 public: 00056 static Real random (); 00057 static Real random (Real min, Real max); 00058 00059 static bool isEqual(Real aValue, Real anotherValue); 00060 static int double2int(double value); 00061 00062 }; 00063 00064 #endif