aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools
diff options
context:
space:
mode:
authorAdam Frisby2007-07-21 22:25:42 +0000
committerAdam Frisby2007-07-21 22:25:42 +0000
commitf84937367f7180140bd17444d507977f9b7e3d2e (patch)
tree944f2824669e42b5df3b6655bd09999c89b50376 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools
parent* Renamed terrain functions to match OpenSim naming styles. (diff)
downloadopensim-SC_OLD-f84937367f7180140bd17444d507977f9b7e3d2e.zip
opensim-SC_OLD-f84937367f7180140bd17444d507977f9b7e3d2e.tar.gz
opensim-SC_OLD-f84937367f7180140bd17444d507977f9b7e3d2e.tar.bz2
opensim-SC_OLD-f84937367f7180140bd17444d507977f9b7e3d2e.tar.xz
* Deleted libTerrain-BSD.dll
* Added libTerrain to BasicTerrain directly as a subfolder
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs49
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs60
2 files changed, 109 insertions, 0 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs
new file mode 100644
index 0000000..69c1148
--- /dev/null
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs
@@ -0,0 +1,49 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 public class Point2D
39 {
40 public double x;
41 public double y;
42
43 public Point2D(double X, double Y)
44 {
45 x = X;
46 y = Y;
47 }
48 }
49}
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
new file mode 100644
index 0000000..3f7ab68
--- /dev/null
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
@@ -0,0 +1,60 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 class Tools
39 {
40 public static double linearInterpolate(double a, double b, double amount)
41 {
42 return a + ((b - a) * amount);
43 }
44 public static double exponentialInterpolate(double a, double b, double amount)
45 {
46 a = Math.Pow(a, amount);
47 b = Math.Pow(b - a, 1.0 - amount);
48 return a+b;
49 }
50 public static int powerOf2Log2(int n) {
51 for (int i = 0; i < 31; i++) {
52 if ((n & 1) == 1) {
53 return i;
54 }
55 n >>= 1;
56 }
57 return 0;
58 }
59 }
60}