aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs33
1 files changed, 16 insertions, 17 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
index 730f206..2ad784b 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
@@ -28,8 +28,6 @@
28 28
29 29
30using System; 30using System;
31using System.Collections.Generic;
32using System.Text;
33 31
34namespace libTerrain 32namespace libTerrain
35{ 33{
@@ -39,6 +37,7 @@ namespace libTerrain
39 { 37 {
40 return w; 38 return w;
41 } 39 }
40
42 public int GetHeight() 41 public int GetHeight()
43 { 42 {
44 return h; 43 return h;
@@ -47,7 +46,7 @@ namespace libTerrain
47 public Channel Copy() 46 public Channel Copy()
48 { 47 {
49 Channel x = new Channel(w, h); 48 Channel x = new Channel(w, h);
50 x.map = (double[,])this.map.Clone(); 49 x.map = (double[,]) map.Clone();
51 return x; 50 return x;
52 } 51 }
53 52
@@ -58,9 +57,9 @@ namespace libTerrain
58 57
59 public void SetDiff(int val) 58 public void SetDiff(int val)
60 { 59 {
61 for (int x = 0; x < w / 16; x++) 60 for (int x = 0; x < w/16; x++)
62 { 61 {
63 for (int y = 0; y < h / 16; y++) 62 for (int y = 0; y < h/16; y++)
64 { 63 {
65 diff[x, y] = val; 64 diff[x, y] = val;
66 } 65 }
@@ -69,7 +68,7 @@ namespace libTerrain
69 68
70 public void SetDiff(int x, int y) 69 public void SetDiff(int x, int y)
71 { 70 {
72 diff[x / 16, y / 16]++; 71 diff[x/16, y/16]++;
73 } 72 }
74 73
75 public void Set(int x, int y, double val) 74 public void Set(int x, int y, double val)
@@ -124,10 +123,10 @@ namespace libTerrain
124 y = 0.0; 123 y = 0.0;
125 124
126 int stepSize = 1; 125 int stepSize = 1;
127 double h00 = Get((int)x, (int)y); 126 double h00 = Get((int) x, (int) y);
128 double h10 = Get((int)x + stepSize, (int)y); 127 double h10 = Get((int) x + stepSize, (int) y);
129 double h01 = Get((int)x, (int)y + stepSize); 128 double h01 = Get((int) x, (int) y + stepSize);
130 double h11 = Get((int)x + stepSize, (int)y + stepSize); 129 double h11 = Get((int) x + stepSize, (int) y + stepSize);
131 double h1 = h00; 130 double h1 = h00;
132 double h2 = h10; 131 double h2 = h10;
133 double h3 = h01; 132 double h3 = h01;
@@ -136,9 +135,9 @@ namespace libTerrain
136 double a10 = h2 - h1; 135 double a10 = h2 - h1;
137 double a01 = h3 - h1; 136 double a01 = h3 - h1;
138 double a11 = h1 - h2 - h3 + h4; 137 double a11 = h1 - h2 - h3 + h4;
139 double partialx = x - (int)x; 138 double partialx = x - (int) x;
140 double partialz = y - (int)y; 139 double partialz = y - (int) y;
141 double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); 140 double hi = a00 + (a10*partialx) + (a01*partialz) + (a11*partialx*partialz);
142 return hi; 141 return hi;
143 } 142 }
144 143
@@ -159,7 +158,7 @@ namespace libTerrain
159 { 158 {
160 SetDiff(x, y); 159 SetDiff(x, y);
161 160
162 map[x % w, y % h] = val; 161 map[x%w, y%h] = val;
163 } 162 }
164 163
165 public void SetWrapClip(int x, int y, double val) 164 public void SetWrapClip(int x, int y, double val)
@@ -171,7 +170,7 @@ namespace libTerrain
171 if (val < 0.0) 170 if (val < 0.0)
172 val = 0.0; 171 val = 0.0;
173 172
174 map[x % w, y % h] = val; 173 map[x%w, y%h] = val;
175 } 174 }
176 175
177 public void Fill(double val) 176 public void Fill(double val)
@@ -255,7 +254,7 @@ namespace libTerrain
255 254
256 public double Avg() 255 public double Avg()
257 { 256 {
258 return Sum() / (w * h); 257 return Sum()/(w*h);
259 } 258 }
260 259
261 public bool ContainsNaN() 260 public bool ContainsNaN()
@@ -274,4 +273,4 @@ namespace libTerrain
274 return false; 273 return false;
275 } 274 }
276 } 275 }
277} 276} \ No newline at end of file