FLTK 1.3.0
|
00001 // 00002 // "$Id: math.h 7903 2010-11-28 21:06:39Z matt $" 00003 // 00004 // Math header file for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 // Xcode on OS X includes files by recursing down into directories. 00029 // This code catches the cycle and directly includes the required file. 00030 #ifdef fl_math_h_cyclic_include 00031 # include "/usr/include/math.h" 00032 #endif 00033 00034 #ifndef fl_math_h 00035 # define fl_math_h 00036 00037 # define fl_math_h_cyclic_include 00038 # include <math.h> 00039 # undef fl_math_h_cyclic_include 00040 00041 # ifdef __EMX__ 00042 # include <float.h> 00043 # endif 00044 00045 00046 # ifndef M_PI 00047 # define M_PI 3.14159265358979323846 00048 # define M_PI_2 1.57079632679489661923 00049 # define M_PI_4 0.78539816339744830962 00050 # define M_1_PI 0.31830988618379067154 00051 # define M_2_PI 0.63661977236758134308 00052 # endif // !M_PI 00053 00054 # ifndef M_SQRT2 00055 # define M_SQRT2 1.41421356237309504880 00056 # define M_SQRT1_2 0.70710678118654752440 00057 # endif // !M_SQRT2 00058 00059 # if (defined(WIN32) || defined(CRAY)) && !defined(__MINGW32__) && !defined(__MWERKS__) 00060 00061 inline double rint(double v) {return floor(v+.5);} 00062 inline double copysign(double a, double b) {return b<0 ? -a : a;} 00063 00064 # endif // (WIN32 || CRAY) && !__MINGW32__ && !__MWERKS__ 00065 00066 #endif // !fl_math_h 00067 00068 00069 // 00070 // End of "$Id: math.h 7903 2010-11-28 21:06:39Z matt $". 00071 //