Welcome to the NetCologne GmbH open source mirroring service!

This machine mirrors various open-source projects. 20 Gbit/s uplink.

If there are any issues or you want another project mirrored, please contact mirror-service -=AT=- netcologne DOT de !

math.hxx Source File
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

math.hxx

Go to the documentation of this file.
00001 //  $Id: math.hxx,v 1.3 2003/01/04 20:12:38 grumbel Exp $
00002 // 
00003 //  Construo - A wire-frame construction gamee
00004 //  Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 // 
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef CONSTRUO_MATH_HXX
00021 #define CONSTRUO_MATH_HXX
00022 
00028 namespace Math {
00029 
00030 const double pi   = 3.14159265358979323846;     /* pi */
00031 const double pi_2 = 1.57079632679489661923;     /* pi/2 */
00032 
00033 template<class T> 
00034 T min (const T& a, const T& b) 
00035 {
00036   if (a < b)
00037     return a;
00038   else
00039     return b;
00040 }
00041 
00042 template<class T> 
00043 T max (const T& a, const T& b) 
00044 {
00045   if (a > b)
00046     return a;
00047   else
00048     return b;
00049 }
00050 
00051 template<class T> 
00052 T mid (const T& a, const T& b, const T& c) 
00053 {
00054   return max((a), min((b), (c)));
00055 }
00056 
00057 inline int round(float a)
00058 {
00059   return int((a > 0) ? (a + .5f) : (a - .5));
00060 }
00061 
00062 } // namespace Math
00063 
00064 #endif

Generated on Thu Jul 24 10:24:30 2003 for Construo by doxygen1.3-rc3