Gel2D - The free/open source game creation suite

gelMath.h
Go to the documentation of this file.
00001 /*
00002 Gel2D Game Engine - Cross-platform 2D gaming middleware
00003 Copyright (C) 2010-2011 Mark D. Procarione
00004 
00005 Gel2D is free software: you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation, either version 3 of the License, or
00008 (at your option) any later version.
00009 
00010 Gel2D is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014 */
00015 
00016 #ifndef __GELMATH_H__
00017 #define __GELMATH_H__
00018 
00019 #define PI 3.14159265358979323846f
00020 
00021 namespace gel
00022 {
00025 
00026     class GelMath
00027     {
00028         public:
00030 
00033             static int randomi( int min, int max );
00034 
00036 
00039             static float random( float min, float max );
00040 
00042 
00044             static int absolute( int num );
00045 
00047 
00049             static float absolute( float num );
00050 
00052             static int mini( int a, int b );
00053 
00055             static int maxi( int a, int b );
00056 
00058             static float minf( float a, float b );
00059 
00061             static float maxf( float a, float b );
00062 
00064 
00068             static bool inRange( int num, int start, int end );
00069 
00071 
00075             static bool inRange( float num, float start, float end );
00076 
00078 
00080             static float degToRad( float deg );
00081 
00083 
00085             static float radToDeg( float rad );
00086 
00088 
00090             static float clampDeg( float deg );
00091 
00093 
00095             static float sqr( float num );
00096 
00097             static int nearestPower( int num, int power );
00098     };
00100 }
00101 
00102 #endif // __GELMATH_H__