1 /*
2 Copyright (C) 2004 Parallel Realities
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 
19 */
20 
21 class Math {
22 
23 	private:
24 
Math()25 		Math(){}
26 
27 	public:
28 
29 	static void limitChar(signed char *in, int low, int high);
30 	static void limitChar(unsigned char *in, int low, int high);
31 	static void limitInt(int *in, int low, int high);
32 	static void limitFloat(float *in, float low, float high);
33 
34 	static void wrapChar(signed char *in, signed char low, signed char high);
35 	static void wrapInt(int *in, int low, int high);
36 	static void wrapFloat(float *in, float low, float high);
37 
38 	static void swap(int *i1, int *i2);
39 	static void swap(float *f1, float *f2);
40 
41 	static int rrand(int min, int max);
42 
43 	static bool boolFromWord(const char *word);
44 
45 	static void addBit(unsigned int *currentBits, int newBits);
46 	static void removeBit(unsigned int *currentBits, int oldBits);
47 	static void calculateSlope(float x, float y, float x2, float y2, float *dx, float *dy);
48 
49 };
50