aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs31
1 files changed, 16 insertions, 15 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
index 3207f15..d805794 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
@@ -27,33 +27,34 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
35 class Tools 33 internal class Tools
36 { 34 {
37 public static double LinearInterpolate(double a, double b, double amount) 35 public static double LinearInterpolate(double a, double b, double amount)
38 { 36 {
39 return a + ((b - a) * amount); 37 return a + ((b - a)*amount);
40 } 38 }
41 39
42 public static double ExponentialInterpolate(double a, double b, double amount) 40 public static double ExponentialInterpolate(double a, double b, double amount)
43 { 41 {
44 a = Math.Pow(a, amount); 42 a = Math.Pow(a, amount);
45 b = Math.Pow(b - a, 1.0 - amount); 43 b = Math.Pow(b - a, 1.0 - amount);
46 return a+b; 44 return a + b;
47 } 45 }
48 46
49 public static int PowerOf2Log2(int n) { 47 public static int PowerOf2Log2(int n)
50 for (int i = 0; i < 31; i++) { 48 {
51 if ((n & 1) == 1) { 49 for (int i = 0; i < 31; i++)
52 return i; 50 {
53 } 51 if ((n & 1) == 1)
54 n >>= 1; 52 {
55 } 53 return i;
56 return 0; 54 }
57 } 55 n >>= 1;
56 }
57 return 0;
58 }
58 } 59 }
59} 60} \ No newline at end of file